【发布时间】:2014-04-17 09:27:51
【问题描述】:
我想通过在 X-Y 平面上单击我希望它通过的点在空(半对数)图上绘制一条曲线。
有这个功能吗?
编辑:我正在尝试通过获取最后一个指针单击的位置来做到这一点-
axis([0 3000 0 1000]);
co=get(gcf, 'CurrentPoint');
好像是返回执行时的光标位置,但是后面没有变化。
edit2:这对我有用。我可以使用收集的点数组进行实际绘图。
clear
clc
h=plot(0);
grid on;
xlim([0 3000]);
ylim([0 1000]);
datacursormode on;
% Enlarge figure to full screen.
screenSize = get(0,'ScreenSize');
set(gcf, 'units','pixels','outerposition', screenSize);
hold on;
% Print the x,y coordinates - will be in plot coordinates
x=zeros(1,10); y=zeros(1,10);
for p=1:10;
[x(p),y(p)] = ginput(1) ;
% Mark where they clicked with a cross.
plot(x(p),y(p), 'r+', 'MarkerSize', 20, 'LineWidth', 3);
% Print coordinates on the plot.
label = sprintf('(%.1f, %.1f)', x(p), y(p));
text(x(p)+20, y(p), label);
end
【问题讨论】:
标签: matlab graph coordinates draw curve