フィルターのクリア

How to plot three different things with different y-directions in current plot?

2 ビュー (過去 30 日間)
Mahesh
Mahesh 2014 年 7 月 16 日
回答済み: Neha Talnikar 2014 年 7 月 21 日
Dear all I am trying to plot three different kinds in one axis of the plot. However, one of the graph has different Ylimit. I would like to have similar plots in excel. In this regard I am not talking about subplot. Below is the code , I developed.
clean
dirOut = 'Graphics\Scatters';
mkdir(dirOut);
prgm = 131;Nyears=60; decile=10;
expr = ['dy = fm_model_' int2str(prgm) '(p, ndata);']; % model to use
Paramlabel = parameters(prgm);
numparam = length(Paramlabel);
ndays = 5;
parray = zeros(Nyears, numparam);
decilevec = zeros(Nyears, 2);
m = 1;
for data_choice=1:Nyears
[dirGraph, RName, Filein, DiaryFile, param_file] = drawer(data_choice,...
prgm);
data = getdata( Filein ); data=data(:);
ndata = length(data);
[p itn] = getparam(param_file, 4, m);
[Dpy, DLy ] = percentile(data,decile);
decilevec(data_choice,1) = DLy;
eval(expr);
dy = stat_moving(dy,ndays);
[Ppy, PLy ] = percentile(dy,decile);
parray(data_choice,:) = p;
decilevec(data_choice,2) = PLy;
end
hold on
h1 = plot(decilevec(:,1), 'k');
h2 = plot(decilevec(:,2), 'r');
h3 = plot(parray(:,2), 'b');
set(h3, 'YDir', 'reverse');
hold off;
While running I got error like this. Error using graph2d.lineseries/set The name 'YDir' is not an accessible property for an instance of class 'lineseries'.
It will be great if anyone knows how to solve this problem. Sooner response will be appreciative and cooperative, Thanks in advance.
Sincerely Mahesh

採用された回答

Neha Talnikar
Neha Talnikar 2014 年 7 月 21 日
The command h = plot() returns the column vector of lineseries handles which does not have the property ‘YDir’. The axes object has this property. You should be looking to set this property for an axes object instead.
I would suggest using ‘plotyyy’ for doing this. ‘plotyyy’ lets you have 3 y-axes. The plot looks less cluttered and is easier to manipulate.
This is available on File Exchange and following is the link: http://www.mathworks.com/matlabcentral/fileexchange/1017-plotyyy
Once you use the ‘plotyyy’ to create the figure, then you can change the ‘YDir’ property of the specific axes by using ‘set’ function:
ax = plotyyy(x,y1,x,y2,x,y3);
set(ax(3),'YDir','reverse');

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraphics Object Programming についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by