Daniel Fetchinson wrote: > I'm a total beginner to matplotlib so please forgive me if this is > standard stuff. I've read through the user guide, tutorial, searched > all over the place but couldn't figure it out on my own. > > Normally, matplotlib puts the graph in a box, left y axis, bottom x > axis, right y axis, top x axis. What I'd like to do is remove both y > axis and the top x axis and only keep the bottom x axis. How do I do > that?
This is an often-requested feature, and several times I have been on the verge of adding it, but I still haven't done it. I think that JDH has posted workaround code for manually making the desired axes, but I don't recall where. It really should be a simple option in mpl, though. > > I also would like to save the plot in PNG format which works great. > However, the PNG image is not only the graph but also some space > around it in all 4 directions. How do I force matplotlib to write only > the box that contains the graph to the file and no padding around it? This also comes up quite frequently. You can adjust the position of the axes in the figure by making the axes manually. The pyplot (or pylab) command for making an axes includes this in its docstring: axes(rect, axisbg='w') where rect=[left, bottom, width, height] in normalized (0,1) units. axisbg is the background color for the axis, default white So if you don't need any labels, or anything outside the axes box, you can use: ax = axes([0,0,1,1]) or change the rect argument as needed. Eric > > Cheers, > Daniel ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users