3.66667

3.7 | 3 ratings Rate this file 26 downloads (last 30 days) File Size: 3.93 KB File ID: #12131

LinkTopAxisData

by Tim Richards

 

01 Sep 2006 (Updated 13 Sep 2006)

No BSD License  

Adds a linked second x axis to a plot

Download Now | Watch this File

File Information
Description

This function will add a second x axis to a plot with the top ticks at arbitrary positions (you are not limited to the bottom tick positions). The new axis is created behind the original axis, and the two axes are linked together. This gives a much more intuitive behaviour, for example clicking in the figure window will select the original axis. It also alows you to drag the plot around, resize the limits and change between a log/linear scale without having to update the dummy axis manually.

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
Add top X-axis with different scale

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 (5)
06 Sep 2006 F Moisy

1. The example does not work (??? Undefined function or variable 'T')
2. This kind of submission typically requires a screenshot!

15 Sep 2006 Tim Richards

Many thanks for your comment. I have changed the example and added a screenshot.

30 Nov 2006 Frederic Moisy

Works well, very useful for me. Thanks!

09 Nov 2007 Thierry Dalon

small bug:
line temp=temp(diff(temp(:,1))>0,:);
will always remove on tick label.

14 Aug 2009 K R

Thank you so much for this submission! It took me 15 minutes of playing around with it to figure it out (it wasn't immediately clear to me that TopTickPositions were the positions on the original axis and that TopTickLabels were the associated values on the new axis). But it works great! I really appreciate it - thanks!!

Please login to add a comment or rating.
Updates
13 Sep 2006

I have changed the example to define T and E before they are used.

I have also added a screenshot.

Tag Activity for this File
Tag Applied By Date/Time
annotation Tim Richards 22 Oct 2008 08:37:11
customization Tim Richards 22 Oct 2008 08:37:11
plotxx Tim Richards 22 Oct 2008 08:37:11
xaxis Tim Richards 22 Oct 2008 08:37:11
double Tim Richards 22 Oct 2008 08:37:11
figure Tim Richards 22 Oct 2008 08:37:11
top Tim Richards 22 Oct 2008 08:37:11
bottom Tim Richards 22 Oct 2008 08:37:11
scale Tim Richards 22 Oct 2008 08:37:11
plotxx Gerd 04 Aug 2009 02:48:54
 

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