限制在 Matlab 中绘图的轴 [英] limit the axes for plotting in Matlab

查看:33
本文介绍了限制在 Matlab 中绘图的轴的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能的重复:
是否可以选择特定区域散点图

是否可以减少输入文本文件中的数据点,这样我的计算中就不会出现这些数据点.我正在使用以下来读取数据

is it possible to reduce the datapoints from the input text file, so that those dont come in my calculation. I am using following to read the data

fid = fopen('cr.txt');
A =  textscan(fid, '%f %f %f %f %f %*f %*f %*f %*f %*f %*s %*s %*s') ;
%read the file
a = A{1};
e = A{2};
c = A{3};
x = A{4};
y = A{5};

这里 x,y 是距离,如果我应用 xlim 和 ylim,我还想限制文件中相应的 a,e,c.该文件有大约一百万个数据点.

here x,y are the distances and if I apply xlim and ylim, I want to limit the corresponding a,e,c from the file also. the file has around million data points.

我将进一步绘制 x、y 和 z(根据 a、e、c 计算)作为散点和颜色条我用于整个数据点的绘图代码是

And I will be further plotting the x,y and z(which is calculated from a,e,c) as a scatter and colorbar the plotting code I am using for the entire data points is

lg=log10(g2);
scatter(x(1:end-1), y(1:end-1),5, lg);
colorbar('eastoutside');
caxis([14 max(lg)]);
xlabel(' X-axis (microns)');
ylabel('Y-axis (microns)');

lg 是根据前面显示的 a,e,c 确定的.所以我想要做的就是在 x,y 的选定部分和相应的 lg 之间做一个绘图.

the lg is determined from the a,e,c shown earlier. so all I want to do is do a plot between a selected portion of x,y and the corresponding lg.

请帮忙!!

推荐答案

是的,您可以使用 set 或通过调用 直接在 axes 上指定限制xlimylimzlim 函数

Yes you can specify the limits directly on the axes using set or by calling the xlim, ylim, and zlim functions

plot(rand(1,100));
set(gca,'XLim', [10 20] ); % set the xlims to 10,20

plot(rand(1,100));
xlim([10 20]); % set the xlims to 10,20

这篇关于限制在 Matlab 中绘图的轴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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