Box Off on Axis

Hi All,

    I am helping my girlfriend in doing some plots for her thesis (!).
Normally, matplotlib puts the graph in a box, left y axis, bottom x
axis, right y axis, top x axis. What she would like to do is to remove
the right y axis and the top x axis, akin the matlab command "box off"
(if I remember correctly), leaving just the 2 principal axis in the
plot.
I remember seeing something like that done with matplotlib, but
tonight my google-fu is really bad...
Is there a way to do what she is asking me to do? :wink:

Thank you in advance for all suggestions.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

Hi All,

   I am helping my girlfriend in doing some plots for her thesis (!).
Normally, matplotlib puts the graph in a box, left y axis, bottom x
axis, right y axis, top x axis. What she would like to do is to remove
the right y axis and the top x axis, akin the matlab command "box off"
(if I remember correctly), leaving just the 2 principal axis in the
plot.
I remember seeing something like that done with matplotlib, but
tonight my google-fu is really bad...
Is there a way to do what she is asking me to do? :wink:

Hi Andrea,

Here's a class I wrote (see attached) to draw custom frames for matplotlib. It defaults to the plot style you describe above. To use the frame class, try:

>>> import pyplot as plt
>>> from frame import FrameAxes

>>> plt.subplot(111, projection='frameaxes')

And then plot as you normally would. If you want an example, just run the file directly (instead of importing).

I'm playing around with a more flexible implementation where the axes can be placed arbitrarily (i.e. not just on the edges of the plot), but progress has been slow because of design considerations.

Best,

-Tony

PS: note this requires Matplotlib 0.98

frame.py (6.39 KB)

···

On Jul 15, 2008, at 6:17 PM, Andrea Gavana wrote: