我有一个代码(下面),它绘制了简单的x,y数据.我的时间(x轴)最初是1-1257的数字,相当于我看的天数.我将其转换为序列日期以便绘制它.但是,当它在MATLAB中绘制时,x轴上没有足够的标签.当我尝试设置更多刻度标记时,我要么以串行格式返回标签(我想要'mmm yyyy'格式),或者当我尝试使用NumTicks时,我会得到很多标签,但它们不正确,因为它们只是原始标签重复多次.
% Find indexes at which the lat and lon match the conditions
lon_ind = find(X(:,1) == 224); % Longitude closest to 136 03.56W
lat_ind = find(Y(1,:) == -66.75); % Latitude closest to 66 39.67S
% Pull out all the data at the point 2240W and 66.75
data_point = data_All(lon_ind, lat_ind, :);
t = 1:1257; % Days 1:1257 inclusive. 20100101 to 20130611
y = reshape(data_point,[],1); % Change data_point into a 1 column matrix
x = datenum(2009, 12, 31) + …
Run Code Online (Sandbox Code Playgroud) 我有一个看起来像这样的矩阵:
0.06 -0.22 -0.10 0.68 NaN -0.33
0.04 -0.07 0.12 0.23 NaN -0.47
NaN NaN NaN NaN NaN 0.28
0.37 0.36 0.14 0.58 -0.14 -0.15
NaN 0.11 0.24 0.71 -0.13 NaN
0.57 0.53 0.41 0.65 -0.43 0.03
Run Code Online (Sandbox Code Playgroud)
我想根据色图在每个值中着色.在Python中,我知道我可以使用imshow
为每个框分配颜色.我怎么能在MATLAB中做到这一点?
我正在编写一个程序来在循环中绘制图形,我想将每个图形保存为 .jpg 文件,文件名有所不同。这是我保存图形的代码:
filename = strcat('WI_Pollutants_', D(i,6), '_200706_O3');
saveas(gcf, filename, 'jpg');
Run Code Online (Sandbox Code Playgroud)
保存的文件应如下所示,其中 D(i,6) 更改循环的每次迭代。
WI_Pollutants_003-0010_200706_O3.jpg
Run Code Online (Sandbox Code Playgroud)
但是,我运行了一个错误:(也许是因为saveas
只想要一个字符串?)
Error using saveas (line 81)
Invalid filename.
Run Code Online (Sandbox Code Playgroud)