24

I have a polar axes in matplotlib that has text which extends outside of the range of the axes. I would like to remove the border for the axis -- or set it to the color of the background so that the text is more legible. How can I do this?

Simply increasing the size of the axes is not an acceptable solution (because the figure is embeddable in a GUI and it becomes too small if this is done). Changing the color of the background to be black so that the border is not visible is also not an acceptable solution.

enter image description here

A considerable amount of code that does various parts of plotting things is omitted, but here is the generation of the figure and axes itself:

import pylab as pl
fig = pl.figure(figsize=(5,5), facecolor='white')
axes = pl.subplot(111, polar=True, axisbg='white')

pl.xticks([])
pl.yticks([])
pl.ylim(0,10)

# ... draw lots of things
Roger Vadim
  • 373
  • 2
  • 12
aestrivex
  • 5,170
  • 2
  • 27
  • 44
  • Great plot! Did you make the circular relationship graph using `NME` package? https://martinos.org/mne/stable/auto_examples/connectivity/plot_mne_inverse_label_connectivity.html – CT Zhu Apr 04 '14 at 00:30
  • Not exactly. It is from my integrated visualization program (https://github.com/aestrivex/cvu) but I originally forked this section of code from MNE. There are small differences in the circle plot's behavior in MNE and in my program (the only thing visible in this particular image is the choice of color for the nodes) – aestrivex Apr 04 '14 at 03:20

2 Answers2

33

Just add this line: axes.spines['polar'].set_visible(False) and it should go away!

eewh, all the anatomy terms.

CT Zhu
  • 52,648
  • 17
  • 120
  • 133
0

A more general way (independent of coordinate systems) is:

axes.axis("off")
Youjun Hu
  • 991
  • 6
  • 18