问题描述
clear all;close all;clc
x =linspace(pi,2*pi,20)
y =linspace(0,pi,20)
C = [1 2];
imagesc(x,y,C)
colorbar
https://i.stack.imgur.com/3lPm6.png
上面的链接是自下而上没有增加的纵轴的图片。 我可以知道如何解决这个问题吗?我试过使用flipr() 使垂直轴从下到上增加。
解决方法
您使用的是图像,因此轴处于 image
模式,坐标从左上角开始。
imagesc
和其他图像显示函数会自动调用 axis image;
。您可以通过在 axis xy;
调用后调用 imagesc
将其更改为法线轴。
您还可以通过更改 YDir 属性来更改 y 轴(或任何轴)的方向。
% Get the handle to the axes
ax = gca;
% Change the y axis direction
ax.YDir = 'normal';