4.5

4.5 | 4 ratings Rate this file 85 downloads (last 30 days) File Size: 3.29 KB File ID: #9046

Add top X-axis with different scale

by Emmanuel Dinnat

 

15 Nov 2005 (Updated 29 Nov 2005)

Code covered by the BSD License  

Add an X-axis on top (additional to the one on bottom) of the figure, with its own ticks labels ...

Download Now | Watch this File

File Information
Description

Add an X-axis on top (additional to the one on bottom) of the figure, with its own ticks labels and axis label (allow double scale).
Ticks, minor ticks positions and x limits are set to be identical for top and bottom axis. Moreover, they are linked, i.e. a modification of one of them, even after execution of this function, will result in modification of the other one.

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
addtxaxis
This submission has inspired the following:
LinkTopAxisData

MATLAB release MATLAB 7.1.0 (R14SP3)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (9)
18 Nov 2005 John D'Errico

I don't forsee a need a secondary x-axis much, but when I
want one, this is a good, simple tool for that purpose.

My only (minor) beef is with the property/value pair
interface. Its nice if properties can be shortened, as long as that shortening is unambiguous. Thus, the 'expression'
property should be properly used even if we supplied its
name as 'exp'. Since this takes only a couple of lines of
code to implement, its a very nice feature.

29 Nov 2005 Emmanuel Dinnat

Reply to John D'Errico
1st, thank you for the return.
The change has been done in the new version.
Also changed the way of evaluating the 'expression'. That should allow more complexe and easier implementation of these 'expressions'.

28 Dec 2005 Stian Ingebrigtsen

Why bother to use two manipulated Subplots when you can use the axec( ) function to generate a new set of opposite axis on your graph??? Your code will be a lot simpler and it is still possible to link axis properties...

07 Feb 2007 YI xu

For a general user, I wonder if somebody can give an example statement, it's easier for users to understand. Thanks

21 Nov 2008 Lars Olav Vestland

I agree with YI xu. (Somehow I cannot make it to function, has the evalin function been changed in MATLAB?)

Stian: axec() function? Did you mistype? Does not seem to be in MATLAB nor in 'fileexchange'.

19 Feb 2009 Pacome Delva

Hello, thank you for your contribution.
I have a problem. I want to add a top log axis to a loglog plot. My problem is that I don't know how to obtain a nice formatting, with the power in super script, as for the down x axis. I have only access to the fprinf option for the formatting.
Thank you

19 Feb 2009 Pacome Delva

the script doesn't work for a loglog plot...

06 Aug 2009 Itamar

Hi,
First, thank you for your submission. Well documanted and written. It took me some time to figure it out, but it works like magic and as in the example.
You had really helped me here.
Thanks

10 Nov 2009 Chiao  
Please login to add a comment or rating.
Updates
28 Nov 2005

Now evaluates expression in the 'base' workspace (allow for more complex expressions), use case insensitive and simplified property names.

29 Nov 2005

Now evaluates expression in the 'base' workspace (allow for more complex expressions), use case insensitive and simplified property names.

Tag Activity for this File
Tag Applied By Date/Time
annotation Emmanuel Dinnat 22 Oct 2008 08:06:29
customization Emmanuel Dinnat 22 Oct 2008 08:06:29
xaxis Emmanuel Dinnat 22 Oct 2008 08:06:29
double Emmanuel Dinnat 22 Oct 2008 08:06:29
scale Emmanuel Dinnat 22 Oct 2008 08:06:29
top Emmanuel Dinnat 22 Oct 2008 08:06:29
bottom Emmanuel Dinnat 22 Oct 2008 08:06:29
figure Emmanuel Dinnat 22 Oct 2008 08:06:29
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com