Image is upside down using Plots.plot

hi Guys,
I am trying to use Plots.plot to save images in REPL on ubuntu. However it always save the picture upside down even if I have not do anything on the image yet.
Please help.

julia Version 1.1.1 (2019-05-16)

using Plots,Images
backend()
#Plots.GRBackend()
pic=Images.load(“image_orig.png”);
Plots.plot(pic);
Plots.savefig(“myplot_test.png”)
#open the picture of myplot_test.png in browser, the pic is upside down

1 Like

I’m not very familiar with Plots.jl but try setting yflip = true, it’s quite common for plotting packages to put (0,0) on the top left corner instead of the bottom left.

3 Likes

Thanks.

however, it does not help for both yflip = true and false

Plots.plot(pic, yflip = true)

#still upside down

Plots.plot(pic, yflip = false)

#still upside down

1 Like

This works fine on my Windows 10 computer. I have not used this package before, but I just added Images and ImageMagick, and get:

If I use pyplot as backend while plotting, I get:

If I change and use backend gr() instead, I get exactly the same result.

NB: this also works with *.png files on my computer.

I am using Ubuntu

I’m facing a similar problem. It seems that image plotting won’t flip the y axis no matter how you put it. I’ve managed to go around that by reversing the array itself: plot(img[end:-1:begin,:]) but of course that leaves now the y-ticks in the wrong order.