Code covered by the BSD License  

Highlights from
plotxx.m

3.83333

3.8 | 12 ratings Rate this file 108 Downloads (last 30 days) File Size: 2.04 KB File ID: #317
image thumbnail

plotxx.m

by Denis Gilbert

 

25 Jan 1999 (Updated 19 Feb 2002)

PLOTXX Create graphs with x axes on both top and bottom

| Watch this File

File Information
Description

PLOTXX Create graphs with x axes on both top and bottom
 
Similar to PLOTYY, but ... the independent variable is on the y-axis, and both dependent variables are on the x-axis.
 
For example, you may wish to plot temperature and salinity as a function of depth in the ocean. In the atmosphere, plot temperature and relative humidity as a function of altitude, etc.

MATLAB release MATLAB 5.2 (R10)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (16)
16 Mar 2003 Lina Chang

Very helpful for creating nomographs. Thanks.

18 Jun 2003 Sachin Chandra

Very useful. I often why mathworks didnt have a function similar to plotyy..
 I think additional parameters like passing colors,line width can be helpful too..

21 Apr 2004 yang ying

useful programme

02 Feb 2005 Izru Garner

Well done Dennis by your scripts, I agree with Lina Chang.

23 Oct 2005 Sacit Cetiner

Thanks, saved me a lot of programming

30 Nov 2005 Sloane Wiktorowicz

Useful as a corollary to plotyy. Would be useful to have two inversely proportional axes for one plot (e.g., wavelength on bottom and energy on top). Though this isn't too hard to do from plotxx. Thanks!

24 Oct 2006 Peter Burns

To avoid inconsistent axes ranges, I suggest calling
> axis tight
after plotxx. You might consider adding this to the function as a precausion.

06 Nov 2006 James Housley

Is it just me, or does this not work with subplots?

08 Nov 2006 Dave Sproson

To use with subplot, you need to comment out

set(ax(1),'Position',[0.12 0.12 0.75 0.70])

on line 65.

05 Dec 2007 Leo B

add
set(ax(1),'Box','on','ActivePositionProperty','position')
to get the position right
add
set(ax(2),'YAxisLocation','right','Color','none', ...
          'XGrid','off','YGrid','off','Box','off');

04 May 2008 abdur rahman

very useful thanks

02 Oct 2008 Guyennon Nicolas

thanks a lot for this solution ! (very usefull for vertical profiles)

add
set(ax(1),'XLim',[min(x1) max(x1)]);
set(ax(2),'XLim',[min(x2) max(x2)]);

to get autoscale on both x axis

or you may prefer to use :
[low,high,ticks] = bestscale(ylim1(1),ylim1(2),ylim2(1),ylim2(2),islog1 | islog2);
 with
set(ax(1),'XLim',[low(1) high(1)],'XTick',xticks1);
    set(ax(2),'XLim',[low(2) high(2)],'XTick',xticks2);

if you want to get a better ticks layout

(see open plotyy to copy bestscale sub function)

07 Oct 2008 Simon Vassant

Good stuff. How can I make it work for inversely proportionnal axes : i.e. wavelength (in microns) and wavenumbers (in cm^-1) ?

25 Apr 2009 Jayne

Is it possible to make a bar graph and a line graph with different x axes on the same figure using this program? Thanks.

31 Mar 2010 David Verrelli

% This works at least:

set(findobj('Type','line'), 'LineWidth',lw)

% From web('jar:file:///C:/Program Files/MATLAB/R2009b/help/techdoc/help.jar!/ref/set.html', '-helpbrowser')

02 Aug 2011 Joffray Guillory  
Please login to add a comment or rating.
Updates

modifying description

02 Nov 2001

Two new input arguments have been added to ease the task of labeling the axes.

Tag Activity for this File
Tag Applied By Date/Time
specialized Denis Gilbert 22 Oct 2008 06:36:23
plotting Denis Gilbert 22 Oct 2008 06:36:24
multiple Denis Gilbert 22 Oct 2008 06:36:24
x Denis Gilbert 22 Oct 2008 06:36:24
axis Denis Gilbert 22 Oct 2008 06:36:24
plotyy Denis Gilbert 22 Oct 2008 06:36:24
axes Denis Gilbert 22 Oct 2008 06:36:24
multiple Phillip 13 Oct 2009 09:39:15
axis Phillip 13 Oct 2009 09:40:01
plotyy Tobias 05 Jun 2011 04:11:03

Contact us at files@mathworks.com