Removing the black border around a plot?

This is driving me crazy.... I've tried setting the axes' frame's edgecolor but nothing I try lets me get rid of or
change the color of the black border around my axes. What is the recommend way of doing this, or is it even possible?

(screenshot of my current results attached.)

Thanks for any enlightenment. :slight_smile:

--PLB

bpp.png

Okay, removing the frame turns out to work like this.

` ax=gca()

setp(ax, frame_on=False)

`… but changing the complete color still stymies me… :frowning:

Setting the axes’ frame edgecolor gives me a nice halo, but the black
border is still there…

` axis_edgecolor =
‘yellow’

frame = ax.get_frame()

setp(frame, 'edgecolor', axis_edgecolor)

`Confused…

–PLB

···

At 16:58 15.3.2007, Peter Buschman wrote:

This is driving me crazy…
I’ve tried setting the axes’ frame’s edgecolor but nothing I try lets me
get rid of or

change the color of the black border around my axes. What is the
recommend way of doing this, or is it even possible?

(screenshot of my current results attached.)

Thanks for any enlightenment. :slight_smile:

–PLB


Take Surveys. Earn Cash. Influence the Future of IT

Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your

opinions on IT & business topics through brief surveys-and earn
cash


http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net


https://lists.sourceforge.net/lists/listinfo/matplotlib-users

For those who are interested in the solution, here it is… :wink:

It turns out that the axes object has an attribute, axesFrame (a 2D line
in the shape of a rectangle), in addition to frame (a Rectangle).

At the default linewidth of 1, these two are nested and appear to be a
single object. Although frame is exposed as a property that
can

be set using setp(), I couldn’t find a matching property for axesFrame,
which was driving me batty. Setting frame_on=False removed

both of them which also didn’t help if you just wanted to change the
color.

Ultimately, this did the trick:

` ax=gca()

axesframe = ax.axesFrame

setp(axesframe, 'color', frame_edgecolor)

setp(axesframe, 'antialiased', True)

setp(axesframe, 'linewidth', 0.5)

frame = getp(ax, 'frame')

frame.set_visible(False)

`In my case, I kept the outer axesFrame, set it to the color I
wanted, and set the inner frame to be invisible.

Results are attached.*

–PLB

···

At 17:54 15.3.2007, Peter Buschman wrote:

Okay, removing the frame turns
out to work like this.

` ax=gca()

setp(ax, frame_on=False)

`… but changing the complete color still stymies me… :frowning:

Setting the axes’ frame edgecolor gives me a nice halo, but the black
border is still there…

` axis_edgecolor =
‘yellow’

frame = ax.get_frame()

setp(frame, 'edgecolor', axis_edgecolor)

`Confused…

–PLB

At 16:58 15.3.2007, Peter Buschman wrote:

This is driving me crazy…
I’ve tried setting the axes’ frame’s edgecolor but nothing I try lets me
get rid of or

change the color of the black border around my axes. What is the
recommend way of doing this, or is it even possible?

(screenshot of my current results attached.)

Thanks for any enlightenment. :slight_smile:

–PLB


Take Surveys. Earn Cash. Influence the Future of IT

Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your

opinions on IT & business topics through brief surveys-and earn
cash


http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net


https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Take Surveys. Earn Cash. Influence the Future of IT

Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your

opinions on IT & business topics through brief surveys-and earn
cash


http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net


https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Peter L. Buschman wrote:

Okay, removing the frame turns out to work like this.

     ax=gca()
     setp(ax, frame_on=False)

I'm new to matplotlib, and I can't even get this to work (let alone the
other fix of changing the colors). Could you elaborate about how to
implement this? I've tried putting these lines in the __init__ of the
PlotPanel() class, but I can't get it. Any help is appreciated, thank you.

···

--
View this message in context: http://www.nabble.com/Removing-the-black-border-around-a-plot--tf3409211.html#a9785048
Sent from the matplotlib - users mailing list archive at Nabble.com.

It sounds like you're using WxMpl to embed matplotlib in something. If that's the case, you should look at the example code below. Otherwise, please send a short example script to the list.

Also, please note that disabling the frame effectively makes the figure's background transparent when using the WXAgg backend. I'm not sure if this is the intended behavior. If that's not what you want, you can probably just set the Figure's face and edge colors to the same thing using Figure.set_edgecolor() and Figure.set_facecolor().

Ken

import wxmpl
import wx

class MyPlotPanel(wxmpl.PlotPanel):
     def __init__(self, parent, id, **kwds):
         wxmpl.PlotPanel.__init__(self, parent, id, **kwds)

         fig = self.get_figure()
         fig.set_frameon(False)

if __name__ == '__main__':
     app = wx.PySimpleApp()

     frame = wx.Frame(None, -1, 'Frame Off')
     panel = MyPlotPanel(frame, -1)

     szr = wx.BoxSizer(wx.VERTICAL)
     szr.Add(panel, 1, wx.EXPAND|wx.ALL, 5)
     frame.SetSizer(szr)
     frame.Fit()

     axes = panel.get_figure().gca()
     axes.plot([0,1,2,3,4,5])

     frame.Show(True)
     app.MainLoop()

···

On Apr 1, 2007, at 11:27 PM, Chelonian wrote:

I'm new to matplotlib, and I can't even get this to work (let alone the
other fix of changing the colors). Could you elaborate about how to
implement this? I've tried putting these lines in the __init__ of the
PlotPanel() class, but I can't get it. Any help is appreciated, thank you.