Imagesc in Julia v0.5

Up to and including Julia v0.4 I have been using Winston for plotting, but I am experiencing problems in v0.5 and hence I am starting to use other packages.

One particular thing I miss is the imagesc function for viewing matrices as images. I know Gadfly has a spy function, but I prefer an external window for graphics.

Does anyone know of such an imagesc-ish function?

here are a 2 valid approaches with the newly released GLVisualize:

Pkg.update(); Pkg.add("GLVisualize"); Pkg.add("Plots")

With Plots.jl

using Plots, Colors; glvisualize()
plot(rand(RGBA{U8}, 1000, 1000))

More bare bone:

using GLVisualize, Colors; w = glscreen(); @async renderloop(w)
_view(visualize(rand(RGBA{U8}, 1000, 1000)))

And of course this isn’t limited to the glvisualize backend. Plotting a
matrix of colors “shows an image”, but there’s also a heatmap and spy (I
forget…might be in StatPlots…)

In PyPlot the function is called imshow

Wow! There are lots of options :slight_smile:

Thanks a lot!

I use PlotlyJS’s heatmap function for this sort of thing. I think it’s not as efficient as a raw raster display, as it creates a rectangle per-pixel, but it works relatively well. Plotly has an open issue to support raster data directly.

could you please give more context, about what doesn’t work in v0.5 and information about your system?

Sure. Tried on both Linux Mint and OS X Yosemite and the problem is the same.

In order to make Winston work I have to load it as the first package and open a plot (maybe using Winston; plot(something) should even be the first commands).

If I load other packages first, do some calculations, then load Winston and try to plot I get errors.

I can provide a (non-)working example if you’re interested, but probably not before Monday.

imagesc works fine for me with julia 0.5

The following

  Winston.imagesc([0 2 4 6; 8 10 12 14; 16 18 20 22])

gives a result pretty close to the picture displayed on the matlab website
I would agree that Winston segfaults sometimes (e.g. when closing a plot window) but not more frequently since 0.5.

Yes, using Winston and then running that command also works for me. But with a package of mine there are problems:

using GeneralizedSampling
using Winston


error during Tk callback:
ERROR: TypeError: non-boolean (Bool) used in boolean context
Error showing value of type Winston.FramedPlot:
ERROR: TypeError: non-boolean (Bool) used in boolean context

After a bit of testing I have concluded that my GeneralizedSampling package is the problem (on Julia v0.5, not v0.4), but I am not going to look deeper into the roots of this now.