How to create a graph with 3 y axis

55 views (last 30 days)
Rebecca Ellis
Rebecca Ellis on 27 Jan 2019
Commented: dpb on 29 Jan 2019
Hello,
I been trying to create a graph with 3 y axis and centralise the zero in the middel.
figure
yyaxis left
quiver(EC_time', zeros(size(x_velocity)),x_velocity,y_velocity);
ylim([-0.05 0.05])
axis equal
datetick('x')
axis equal
yyaxis right
bar(EC_time, Mayflux);
ylim([-40 40]);
axis equal
hold on
plot(EC_time, oxygen_may1, 'o-');
hold all
plot(EC_time, oxygen_may1, 'ro-');
plot(EC_time, oxygen_may_optode1, 'go-');
ylim([245 248]);
Could some one give me advise on this? I was trying addaxis but it was not working.
figure
plot(advN.harmonic_fit.thf, Umagadvh)
addaxis(EC_time, Mayflux)
% hold on
addaxis(advN.harmonic_fit.thf, udiradvh);
addaxis(EC_time, oxygen_may1, 'ro-')
datetick 'x'
Thank you.
  14 Comments
Rebecca Ellis
Rebecca Ellis on 29 Jan 2019
My attempt with addaxis
figure
yyaxis left
quiver(EC_time', zeros(size(x_velocity)),x_velocity,y_velocity);
ylim([-0.05 0.05])
xlim([736838.387690925 736839.514656334])
datetick('x')
% axis equal
yyaxis right
bar(EC_time, Mayflux);
ylim([-40 40]);
xlim([736838.387690925 736839.514656334])
% axis equal
grid on
addaxis(plot(EC_time, oxygen_may3));
hold on
plot(EC_time, oxygen_may_optode1, 'go-');
datetick('x')
grid on
ylim([240 254]);
xlim([736838.387690925 736839.514656334])
but a need a comination of there graphs
figure
yyaxis left
quiver(EC_time', zeros(size(North_red)), East_red, North_red);
ylim([-0.05 0.05])
axis equal
datetick('x')
axis equal
yyaxis right
hold all
plot(EC_time, oxygen_may3, 'ro-');
plot(EC_time, oxygen_may_optode1, 'go-');
ylim([240 254]);
axis equal
title('ADV')
grid on
figure
yyaxis left
quiver(EC_time', zeros(size(North_red)), East_red, North_red);
axis equal
ylim([-0.05 0.05])
axis equal
datetick('x')
yyaxis right
bar(EC_time, Mayflux);
ylim([-40 40]);
axis equal
grid on
title('ADV / flux')
datetick('x')
Thank you for your advise, sorry I dont really understand everything you have written. An example would be great as I have many other graphs to make with 3 yaxis.
dpb
dpb on 29 Jan 2019
I've got pressing deadlines to take too much time away from at present to invest a great deal of time at this instant, sorry...
I'd again make two suggestions--
1) Convert your time data to datetime from the deprecated datenum and you may just find that things work better as there is an overloaded plot function that will automagically get called and you can get rid of datetick
2) If that doesn't bring joy, download and look at the other FEX submission link I showed and see if its application of the third axis will give you a set of axes that you can live. It's much less complicated a solution and you should be able to modify it at will.

Sign in to comment.

Answers (0)

Categories

Find more on Line Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!