aestrivex
aestrivex

Reputation: 5280

Turn off axis border for polar matplotlib plot

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

Upvotes: 26

Views: 11578

Answers (2)

Youjun Hu
Youjun Hu

Reputation: 1324

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

axes.axis("off")

Upvotes: 3

CT Zhu
CT Zhu

Reputation: 54340

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

eewh, all the anatomy terms.

Upvotes: 35

Related Questions