[matplotlib-devel] Spine.set_position unexpectedly clears axis
I'm setting up an axes in which I configure the axis objects with my desired tick locators and formatters and later configure the spines, setting their bounds, visibility, and positions. I was surprised that setting the spine position wiped my axis formatting by calling axis.cla(). Is it necessary that the spine must clear the registered axis when its position is changed? (The same clearing occurs in Spine.register_axis(), but in my case that occurs at axes creation and doesn't cause me any trouble.) -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev___ Matplotlib-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
[matplotlib-devel] Turning off the frame/border
Hello again,
I am not sure if this is a matplotlib question, or a basemap one. The
sample code I found on Google for this either broke my script or
didn't change the end result.
I am attempting to turn the border (frame?) off altogether. Here is
the script, with some sections kept out for brevity:
import sys
import matplotlib
matplotlib.use('agg')
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
fig = plt.figure(figsize=(2.56,2.56),dpi=70,frameon=False,linewidth=0)
fig.set_frameon(False)
# as you can see, above are some of attempts at turning the border off
plt.subplots_adjust(left=0, bottom=0, right=1, top=1, wspace=None, hspace=None)
m = Basemap()
m.drawcoastlines()
fig.savefig("test.png")
-
Thank you in advance once again!
~ Jeremy
--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Turning off the frame/border
On Sep 29, 2010, at 1:06 PM, Jeremy Lounds wrote: > Hello again, > > I am not sure if this is a matplotlib question, or a basemap one. The > sample code I found on Google for this either broke my script or > didn't change the end result. > > I am attempting to turn the border (frame?) off altogether. Here is > the script, with some sections kept out for brevity: I'm assuming you're talking about turning off the frame around each axes (but maybe you're talking about something else?). The "frameon" attribute in your example code alters the background of the figure canvas, not the borders surrounding each axes. There's probably a shorter way, but I have a small function that I use to turn off the frame or border around an axes. def clear_frame(ax=None): if ax is None: ax = plt.gca() ax.xaxis.set_visible(False) ax.yaxis.set_visible(False) for spine in ax.spines.itervalues(): spine.set_visible(False) Best, -T -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Turning off the frame/border
On Wed, Sep 29, 2010 at 1:21 PM, Tony S Yu wrote: > > On Sep 29, 2010, at 1:06 PM, Jeremy Lounds wrote: > >> I am attempting to turn the border (frame?) off altogether. Here is >> the script, with some sections kept out for brevity: > > > I'm assuming you're talking about turning off the frame around each axes (but > maybe you're talking about something else?). The "frameon" attribute in your > example code alters the background of the figure canvas, not the borders > surrounding each axes. > > There's probably a shorter way, but I have a small function that I use to > turn off the frame or border around an axes. > > def clear_frame(ax=None): > if ax is None: > ax = plt.gca() > ax.xaxis.set_visible(False) > ax.yaxis.set_visible(False) > for spine in ax.spines.itervalues(): > spine.set_visible(False) > > Best, > -T Hi Tony, Thanks, that works pretty good! However... it seems that "drawcoastlines" creates a border if I am not "zoomed out" far enough. (i.e., the coastline is out of bounds). Do you know how I could turn that off? Thanks again! ~ Jeremy -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Turning off the frame/border
On Sep 29, 2010, at 2:00 PM, Jeremy Lounds wrote: > On Wed, Sep 29, 2010 at 1:21 PM, Tony S Yu wrote: >> >> On Sep 29, 2010, at 1:06 PM, Jeremy Lounds wrote: >> >>> I am attempting to turn the border (frame?) off altogether. Here is >>> the script, with some sections kept out for brevity: >> >> >> I'm assuming you're talking about turning off the frame around each axes >> (but maybe you're talking about something else?). The "frameon" attribute in >> your example code alters the background of the figure canvas, not the >> borders surrounding each axes. >> >> There's probably a shorter way, but I have a small function that I use to >> turn off the frame or border around an axes. >> >> def clear_frame(ax=None): >>if ax is None: >>ax = plt.gca() >>ax.xaxis.set_visible(False) >>ax.yaxis.set_visible(False) >>for spine in ax.spines.itervalues(): >>spine.set_visible(False) >> >> Best, >> -T > > Hi Tony, > > Thanks, that works pretty good! > > However... it seems that "drawcoastlines" creates a border if I am not > "zoomed out" far enough. (i.e., the coastline is out of bounds). > > Do you know how I could turn that off? > > Thanks again! > > ~ Jeremy I'm glad that worked for you. Unfortunately, I don't use basemap, so I can't really help with this additional complication. I'm sure someone else on the list will be able to help you out, though. Best, -Tony -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
