File Exchange

image thumbnail

ploty4.m

version 1.1.0.0 (1.98 KB) by Peter (PB) Bodin
PLOTY4 support for a third and fourth y-axis.

16 Downloads

Updated 02 Aug 2009

View Version History

View License

PLOTY4 is based on plotyyy by Denis Gilbert and allows a fourth y-axis. Labelling of all four y-axes is possible.

Cite As

Peter (PB) Bodin (2021). ploty4.m (https://www.mathworks.com/matlabcentral/fileexchange/4425-ploty4-m), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (31)

Harsh Parasramka

David Cirino

Can I use this for 3 axes instead of 4?

Jonas Hemsen

Solution to the upcoming error:
Replace code in line 78 by this:

for i=1:numel(ax)
set(ax(i).YLabel,'String',{ylabels{i}}');
end

Couldn't find an elegant solution without for loop unfortunately

Zoe Chu

Vince Clementi

Hi Great code. Question: how can I reverse the direction of any of these y axes I made using this function? Thanks.

firat gunkan

Martin Brandel

As Jeff said. The y labels have a bug. If I coppy-paste the sample code in the function it gives me an error:

Error using cell2mat (line 52)
CELL2MAT does not support cell arrays containing cell arrays or objects.

Error in ploty4 (line 78)
set(cell2mat(get(ax,{'ylabel'})),{'String'},{ylabels{:}}');

And I can't find a fix for this.

Sachin Hegde

luis ocaña camperon

jjj

wenzhu wang

How to zoom in or zoom out the added line?

Marc Timmer

Jeff Driscoll

I get the following errors and the axis labels do not appear, can they be fixed? or am I doing something wrong?

Error using cell2mat (line 52)
CELL2MAT does not support cell arrays containing cell arrays or objects.

Error in ploty4 (line 78)
set(cell2mat(get(ax,{'ylabel'})),{'String'},{ylabels{:}}');

Lindsey Belliveau

Hello! Great script, but I am very new to matlab and have one question - I need a scatter plot, is there any way to use this to get a scatter plot? Thanks! :)

ahmed kamar

I can not do with matlab ,the code not run, Why?

ahmed kamar

good

Great contribution! Really handy. It would be great to have the option to pass the axes handle as an input. Still, 5 of 5 stars ;) .

Earther

poncerv

Excellent!

poncerv

huang

well done

Adrien

bug for lines 3 and 4 when we use "datetick".
Otherwise a good solution.
Thanks

Wu Zhiyong

good work! Thanks

In fact, I need 3 lines + 1 bar, but don't know how to do that.
Peter, do you have any suggestion to derive the plot of 3 lines + 1 bar ?
Thanks so much

Mario Liverpool

very well done, thanks a lot!

Thierry Dalon

Zoom does not work properly :-(

Boris Peters

need to clean the code and work on exceptions

Tobi Broge

Very handy!easy to plot four biotech parameters in function of the time!Thanks for this

Francois Dewarrat

Although it has some minor defaults as plotyy (scaling, ytick..), it is the best solution I know by now for such multiple plots.

wind cooky

excellent!!

Izru Garner

It's very simple to use, but by this, excellent!

Anja Noser

Denis Gilbert

Works like a charm !

Well done, Denis.

MATLAB Release Compatibility
Created with R13
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired by: plotyyy

Inspired: myaxisc, plotyn(varargin)

Community Treasure Hunt

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

Start Hunting!