关闭极坐标matplotlib图的轴边界 [英] turn off axis border for polar matplotlib plot

查看:74
本文介绍了关闭极坐标matplotlib图的轴边界的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在matplotlib中有一个极轴,该极轴的文本超出了轴的范围.我想删除轴的边框 - 或将其设置为背景颜色,以便文本更清晰.我该怎么办?

仅增加轴的尺寸是不可接受的解决方案(因为该图形可嵌入到GUI中,并且这样做会变得太小).将背景颜色更改为黑色以使边框不可见也是不可接受的解决方案.

省略了大量用于绘制事物各个部分的代码,但这是图形和轴本身的生成:

导入pylab为pl无花果= pl.figure(figsize =(5,5),facecolor ='white')axes = pl.subplot(111,polar = True,axisbg ='white')pl.xticks([])pl.yticks([])pl.ylim(0,10)#...画很多东西

解决方案

只需添加这一行:axes.spines['polar'].set_visible(False) 并且它应该消失!>

eewh,所有的解剖学术语.

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.

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

解决方案

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

eewh, all the anatomy terms.

这篇关于关闭极坐标matplotlib图的轴边界的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆