change appearence of 3rd plot in plotyy and plot legend
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hello,
I am trying to have 3 different plots show in the same graph. I have one plot associated with the left y-axis and 2 plots associated with the right y-axis. I am having a problem differentiating the 2 plots associated with the right axis. Can you help me get the right associated plots to show as '-.' in red and ':' in green? Here is my code:
clc;
clear;
samples = (1:100)';
theta_1 = 0 + (90)*rand(100,1);
r2v = 0 + (0.5)*rand(100,1);
r3v = 0 + (0.5)*rand(100,1);
% plot(samples, theta_1, '.r', samples, r2v, '.b', samples, r3v, '.g' );
figure
[hAx,hLine1,hLine2] = plotyy(samples,theta_1, [samples',samples'], [r2v',r3v']);
hLine1.LineStyle = '-.';
hLine2.LineStyle = ':';
0 Commenti
Risposte (1)
Jacky Jo
il 27 Ott 2015
Check the following. Also, check the range of theta_1 and (r2v or r3v). If you try to plot these three in a graph you can't see r2v and r3v that much; since it have range much lesser than theta_1. Therefore I did in separate plots.
samples = (1:100)';
theta_1 = 0 + (90)*rand(100,1);
r2v = 0 + (0.5)*rand(100,1);
r3v = 0 + (0.5)*rand(100,1);
figure;
plot(samples, theta_1,'.r'); % Check the Y scale of fig1 and fig 2
figure; hold on;
plot (samples, r2v, '.b');
plot (samples, r3v, '.g' );
figure
[hAx,hLine1,hLine2] = plotyy(samples,theta_1, [samples',samples'], [r2v',r3v']);
set(hLine1,'LineStyle','--')
set(hLine2,'LineStyle',':')
1 Commento
Vedere anche
Categorie
Scopri di più su Two y-axis in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!