散景图像字形将图像上下颠倒显示 [英] Bokeh image glyph displays image upside-down

查看:55
本文介绍了散景图像字形将图像上下颠倒显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

散景图像字形显示的图像上下颠倒,并且y轴不符合图像显示标准,其中刻度线零从顶部开始(矩阵符号).

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)

除了翻转图像lena_img[::-1, :]之外,还有其他解决方案吗?仍然使y轴处于坐标系模式.

Is there a solution other than flipping image lena_img[::-1, :]? This still leaves y-axis in coordinate system mode.

推荐答案

Bokeh图像绘图存在相同的问题.唯一适合我的方法是在绘制img之前添加img=np.flipud(img).当然,您必须事先导入numpy.

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.

希望有帮助!

这篇关于散景图像字形将图像上下颠倒显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆