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

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

问题描述

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

Possible Duplicate:
is it possible to select a particular region in a scatterplot

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

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或调用xlimylimzlimaxes上指定限制功能

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天全站免登陆