[英]Pcolorfast image/array rotation
I have the code below: 我有下面的代码:
fig, ax = pyplot.subplots()
graph = ax.pcolorfast(data, cmap='viridis', vmin = min, vmax = max)
pyplot.colorbar(graph)
pyplot.show()
and it plots what I wanted, however it is sideways. 并绘制了我想要的图,但是它是横向的。 Is there a good way of rotating it -90 or 270 degrees?
是否有将它旋转-90或270度的好方法? I have tried
aT
, which returns the original plot. 我尝试了
aT
,它返回了原始图。 I have also tried ndimage.rotate(graph, -90|270)
, ndimage.interpolation.rotate(graph, -90|270)
, and numpy.rot90(data,3)
. 我也尝试了
ndimage.rotate(graph, -90|270)
, ndimage.interpolation.rotate(graph, -90|270)
和numpy.rot90(data,3)
。 The first two return errors for invalid rotation planes and the second appears to shove the graph off the edge, losing a majority of my data points. 前两个错误返回无效旋转平面的错误,第二个错误似乎使图形偏离边缘,从而丢失了我的大部分数据点。
If anyone has some thoughts, I would be very grateful. 如果有人有什么想法,我将不胜感激。 Even if it's that I put in the wrong arguments.
即使是我提出了错误的论点。 I am at a loss here.
我在这里茫然。
Is a
supposed to be equal to data
in your example? 是
a
应该是相等data
在你的榜样? Tried your code with a random 2D array, and np.transpose(a)
as well as aT
seem to properly rotate the figure, as opposed to what you indicate here ('returns the original plot'). 使用随机的2D数组尝试了代码,并且
np.transpose(a)
和aT
似乎可以正确旋转图形,这与您在此处指示的内容相反(“返回原始图形”)。 If this is not the case for you, I think we need more information. 如果您不是这种情况,我认为我们需要更多信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.