请教高手如何绘制多y 轴的曲线图啊
请教高手如何绘制多y 轴的曲线图啊 help plotyy那只是双y轴吧?
那只是双y轴吧? 原帖由 bill0301 于 2006-9-2 16:19 发表那只是双y轴吧?
还是把具体问题写出来比较好,这样别人也好理解一些 你说的多y轴是什么意思,能否详细说明一下 x = ;
y = ;
a = ;
k = ;
以x为横坐标其余为纵坐标画在一个图里面
请教怎么发送图片啊我把图片发上来就明白了啊
在这个图上采用3种坐标比例
[ 本帖最后由 ChaChing 于 2009-11-28 23:40 编辑 ] 原帖由 bill0301 于 2006-9-3 09:40 发表
请教怎么发送图片啊我把图片发上来就明白了啊
上传图片就行,和上传附件一样 谢谢,不过我还不知道在哪上传附件啊 原帖由 bill0301 于 2006-9-3 10:27 发表
谢谢,不过我还不知道在哪上传附件啊
看帖子http://forum.vibunion.com/forum/thread-23571-1-1.html 原帖由 bill0301 于 2006-9-3 09:31 发表
x = ;
y = ;
a = ;
k = ;
以x为横坐标其余为纵坐标画在一个图里面
那有一个Y坐标显示不了了?是吧。 Get this M file from FileExchange in mathworks website
function = plotyyy(x1,y1,x2,y2,x3,y3,ylabels)
%PLOTYYY - Extends plotyy to include a third y-axis
%Syntax: = plotyyy(x1,y1,x2,y2,x3,y3,ylabels)
%Inputs: x1,y1 are the xdata and ydata for the first axes' line
% x2,y2 are the xdata and ydata for the second axes' line
% x3,y3 are the xdata and ydata for the third axes' line
% ylabels is a 3x1 cell array containing the ylabel strings
%Outputs: ax - 3x1 double array containing the axes' handles
% hlines - 3x1 double array containing the lines' handles
%Author: Denis Gilbert, Ph.D., physical oceanography
%Maurice Lamontagne Institute
%Dept. of Fisheries and Oceans Canada
%email: gilbertd@dfo-mpo.gc.ca
%Web: http://www.qc.dfo-mpo.gc.ca/iml/
%April 2000; Last revision: 14-Nov-2001
if nargin==6
ylabels{1}=' '; ylabels{2}=' '; ylabels{3}=' ';
elseif nargin > 7
error('Too many input arguments')
elseif nargin < 6
error('Not enough input arguments')
end
figure('units','normalized',...
'DefaultAxesXMinorTick','on','DefaultAxesYminorTick','on');
= plotyy(x1,y1,x2,y2);
cfig = get(gcf,'color');
pos = ;
offset = pos(3)/5.5;
pos(3) = pos(3) - offset/2;
set(ax,'position',pos);
pos3=;
limx1=get(ax(1),'xlim');
limx3=;
ax(3)=axes('Position',pos3,'box','off',...
'Color','none','XColor','k','YColor','r',...
'xtick',[],'xlim',limx3,'yaxislocation','right');
hlines(3) = line(x3,y3,'Color','r','Parent',ax(3));
limy3=get(ax(3),'YLim');
line(,,...
'Color',cfig,'Parent',ax(3),'Clipping','off');
axes(ax(2))
set(get(ax(1),'ylabel'),'string',ylabels{1})
set(get(ax(2),'ylabel'),'string',ylabels{2})
set(get(ax(3),'ylabel'),'string',ylabels{3})
=============================================================================
run code shown as below in "Command Window"
x = ;
y = ;
a = ;
k = ;
ylabels{1}='轴1';
ylabels{2}='轴2';
ylabels{3}='轴3';
= plotyyy(x,y,x,a,x,k,ylabels);
legend(hlines, 'y = x','a =x','k = x',2)
Relative Figure shown as below:
[ 本帖最后由 bainhome 于 2006-9-3 11:17 编辑 ] 这个方法解决得好,绘制出3条曲线容易,可是给出第3个y轴的刻度就不好办了,我还在想呢,答案就给出来了^_^ 对就是这个意思,谢谢了,不过那个编程太长够让我头疼的了啊,
还有在这个图上能不能找到任意一点的 坐标啊
[ 本帖最后由 ChaChing 于 2009-11-28 23:43 编辑 ] This function made by Genial
function hc
ezplot('sin(x)');
set(gcf,'pointer','cross');
set(gcf,'WindowButtonMotionFcn',@tempfcn2);
function tempfcn2(hObject, eventdata, handles)
p=get(gca,'currentpoint');
if(isempty(findobj('tag','htext')))
ht=text('tag','htext','string',sprintf('(%g, %g)', p(1), p(3)),'position',);
else
ht = findobj('tag','htext');
set(ht,'string',sprintf('(%g, %g)', p(1), p(3)),'position',);
end
[ 本帖最后由 bainhome 于 2006-9-3 20:40 编辑 ] 太强了啊,虽然看不懂,但是非常的感谢
页:
[1]
2