is there way to allocate yyaxis automatically

3 ビュー (過去 30 日間)
woongki park
woongki park 2018 年 10 月 20 日
回答済み: Kevin Chng 2018 年 11 月 1 日
I have question about yyaxis i use gui checkbox in matlab
so if i check a and b -> a plot in y left b plot in y right
if i check b and c -> b plot in y left c plot in y right
like this is there way to allocate yyaxis automatically?
if yyaxis left is used i can use yyaxis right
  7 件のコメント
woongki park
woongki park 2018 年 10 月 31 日
when i check more than 2 check box.what should i do?(handles.countplot>2)
Kevin Chng
Kevin Chng 2018 年 11 月 1 日
Hi Wongki,
Do you want to plot more than 3plot in a graph? In your original question, i guess you want maximum 2 plot in the same axes.if more than 3, warn your user.

サインインしてコメントする。

回答 (1 件)

Kevin Chng
Kevin Chng 2018 年 11 月 1 日
Two conditions have to be fulfilled
1) Maximum plot not allow more than 3, so it ensure your graph don't have 3rd yaxis.
2) How you program know that how many plot have been done on your graph/axes?
Assign a value to handle first if you are using guide GUI
handles.countplot = 0
then in your call back function of checkbox
if handles.checkbox.Value == 1
handles.countplot = handles.countplot + 1;
% call your plot function
else handles.checkbox.Value ==0
handles.countplot = handles.countplot - 1;
% call your plot function
end
In your call function for plot,
if handles.countplot == 0
% plot what you want.
elseif handles.countplot ==1
% plot what you want.
yyaxis left
elseif handles.countplot ==2
% plot what you wat.
yyaxis right
elseif handles.countplot >2
%remind or do some action to restrict user to plot more than 3 graph
end

カテゴリ

Help Center および File ExchangeSpecifying Target for Graphics Output についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by