Code covered by the BSD License  

Highlights from


3.0 | 9 ratings Rate this file 144 Downloads (last 30 days) File Size: 1.47 KB File ID: #10473
image thumbnail




21 Mar 2006 (Updated )

This is a 2D vresion of Plot3AxisAtOrigin, which may be used to plot axis at origin.

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

| Watch this File

File Information

PlotAxisAtOrigin Plot 2D axes through the origin. It is a 2D version of Plot3AxisAtOrigin written by Michael Robbins. Have fun!


Plot3axisatorigin inspired this file.

This file inspired Axescenter.

MATLAB release MATLAB 7.1.0 (R14SP3)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (12)
27 Jun 2014 Jan


- Hide in comment line containing set(gcf,'color','w')

@Markus Buehren:
- It doesn't work because "Axes in origin" are actually lines in regular axes, which are hidden.

I'm thinking of writing function AxesToOrigin based on this function...

04 Apr 2014 Anael

Great function!
2 comments though:
-I don't like that it changes the background color.
-I wish it wouldn't need to take any arguments.

19 May 2013 Bob  
07 Apr 2013 Sam

Hello, I can not understand how to apply this to my code. I want to shift the current origin to (0,0) from (-0.3, 0) but the -y axis should not appear. My code is:

% Plot for lambda = 0.5

n = 30;

dc1 = 1/30*(0.5*66+0.5*62);
dc2 = 1/30*(0.5*57+0.5*55);

dn1 = 1/30*(0.5*40+0.5*30);
dn2 = 1/30*(0.5*35+0.5*20);
dn3 = 1/30*(0.5*20+0.5*27);

e = -0.3:0.01:0.3;

bc1 = 30*dc1*(1+(dc1./(10+e)));
bc2 = 30*dc2*(1+(dc2./(10+e)));

bn1 = 30*dn1*(1+(dn1./(2+e)));
bn2 = 30*dn2*(1+(dn2./(2+e)));
bn3 = 30*dn3*(1+(dn3./(2+e)));

plot(e, bc1, 'g')
hold all
plot(e, bc2, 'r')
hold all
plot(e, bn1, 'b')
hold all
plot(e, bn2, 'y')
hold all
plot(e, bn3, 'black')


set(gca,'XTickLabel',{'-0.3','-0.2','-0.1','0','0.1', '0.2', '0.3'})

ylim([0 90]);
xlim([-0.3 0.3]);

title('BED Plots for Organs');
xlabel('Epsilon range of alpha/beta');

%Thank you very much!

14 Jun 2012 David Polcari

Hi this is great but what do I do if I want to add axis labels?

06 Jun 2012 zhang yanyu  
24 Nov 2011 chen Jian  
15 Apr 2010 Charles

I tried it. Works fine for me. Exactly what I wanted. Thanks for sharing

30 Mar 2009 Christian  
09 Feb 2009 Markus Buehren

Sorry, but I think this package is not very useful. On the first view it looks nice, but the axis will not change when zooming in etc.


16 Nov 2006 guillaume mille  
13 Oct 2006 Jinwei Gu  

Contact us