Plotting an image without white borders
Hello
Is there a way to plot an image without axes labels and blank area around it (using imagesc)?
Regards Mike
If you just want the raw image itself (no axes), you can use ImageView's write_to_png.
write_to_png(imagesc(rand(300,400)),"file.png") gives an error : write_to_png has no method matching write_to_png(::FramedPlot, ::ASCIIString)
Could you help me out?
You have to use ImageView to plot the image, too. See https://github.com/timholy/ImageView.jl#programmatic-usage
imgc, _ = view(img)
write_to_png(imgc, filename)
Can't figure this out, i have a matrix 256x320 with temperature values from 20 - 50 celsius and when i run the code below it pops up empty window, I can adjust the contrast slider , but it gives me image in a grayscale, and i need a RGB image.
k=vars["p15"]["Frame90"] #Matrix Float64 256x320
zimg=convert(Image,k)
img,_=ImageView.view(zimg)
Currently there isn't a function like imagesc, but you can write it in a few lines using ImageCmap, something along the lines of
mn,mx = extrema(img)
lookup = round(Int, length(cmap)*(img-mn)/(mx-mn)
ImageCmap(lookup, cmap)
where cmap is a vector of ColorType. (Not tested.)
The better way would be to create a custom MapInfo object, because that wouldn't allocate any unnecessary memory.