Bokeh image glyph shows images upside-down and y-axis does not conform to standards of image display, where tick mark zero starts at the top (matrix-like notation).
from scipy.misc import lena
import bokeh.plotting as bp
import matplotlib.pyplot as plt
bp.output_notebook()
%matplotlib inline
lena_img = lena()/256.0
plt.figure(figsize=(10, 10))
plt.imshow(lena_img, cmap='gray')
plt.show()
f1 = bp.figure(plot_width=512, plot_height=512,
x_range=[0, 512], y_range=[0, 512], logo='grey')
f1.image(image=image=[lena_img], x=[0], y=[0],
dw=[512], dh=[512], palette='Greys9')
f1.title = 'Lena upside-down'
f1.title_text_color = 'red'
f1.title_text_font_style = 'bold'
bp.show(f1)
Is there a solution other than flipping image lena_img[::-1, :]
? This still leaves y-axis in coordinate system mode.
Same issue with Bokeh image plot.The only thing that worked for me was adding img=np.flipud(img)
before plotting img
. Of course you will have to import numpy beforehand.
Hope that helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With