File Exchange

image thumbnail

addaxes.m v1.1 (Sep 2009)

version 1.1.0.0 (7.1 KB) by Carlos Adrian Vargas Aguilera
Adds a new linked axis related by ANY monotonic function. Includes ZOOM/PAN and DATETICK utility!

2 Downloads

Updated 21 Sep 2009

View Version History

View License

With PLOTYY you can add a new axis, which will be linearly related with the old one. With this function, the new axis may be related by ANY monotonic ascending or descending function with the old one (which should be specified), and works with the x-axis as well.

Besides, both axes will be linked to work with the ZOOM/PAN functionalities and even the DATETICK or TLABEL function for a time axis.

For example, to include a new x-axis with an exponential relationship with the old one just use:
>> addaxes('XFun','exp')

Enjoy it!
Any comments and bug reports will be very appreciated!

Cite As

Carlos Adrian Vargas Aguilera (2020). addaxes.m v1.1 (Sep 2009) (https://www.mathworks.com/matlabcentral/fileexchange/24875-addaxes-m-v1-1-sep-2009), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (3)

Andrea

This is great! Only thing I can't have working is the 'XTickLabel'.
I tried this syntax
addaxes('XFunction',xFun,'XLeg','Pressure (psi)','XTick',for_XTick_Mpa,'XTickLabel',{'1000','2000','3000','4000','5000'})
and get this error
Error using addaxes>parseInputs (line
628)
When 'TickLabel's are specified, the
respective 'Tick's should be given too.

Error in addaxes (line 188)
[data,xTic,yTic,xTLa,yTLa,flag] =
parseInputs(data,dFun,varargin{:});

Error in Hydrogen_index_jouran_paper
(line 52)
addaxes('XFunction',xFun,'XLeg','Pressure
(psi)','XTick',for_XTick_Mpa,'XTickLabel',{'1000','2000','3000','4000','5000'})

Anybody able to help?
if I comment the 'XTickLabel' part (but leave the 'XTick' part) everything looks OK and the ticks at the expected locations...

Allen

Fantastic simple to use function which adds a second axis. Perfect for two different units plotted on two different x-axes. [Even handles the inversion.] Allows for zoom as well!

jvc

Simply terrific. I've wanted something like this for years. Thank you!

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

Community Treasure Hunt

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

Start Hunting!