如何减小绘图中打印的图例框中文本的字体?
我试图在一张图中绘制大约 10 个图。我还可以单独放置图例框。但是,我无法减小图例框中字体的大小。任何人都可以建议我减小图例框中字体大小的程序。
我在此给出我所使用的说明:但最终结果并没有受到影响。
# Shink current axis's height by 10% on the bottom
box = ax.get_position()
ax.set_position([box.x0, box.y0, box.width * 0.90, box.height])
# Put a legend to the right of the current axis
ax.legend(loc='center left', bbox_to_anchor=(1, 0.5), numpoints = 1)
#plt.show()
fontP = FontProperties()
fontP.set_size ('x-small')
filename1 = "DelayCellSpur"+ str(measuredFrequencyUnderTest)+"MHz.pdf"
print filename1
plt.savefig(filename1, dpi = None, facecolor = 'w', orientation = 'portrait',bbox_inches = None)
由于我是新用户,所以无法上传图片。请帮助我减小图例框中字体的大小。 谢谢你, 戈皮
I am trying to plot around 10 plots in a single figure. I also could put the legend box separately. But, I am unable to reduce the size of the font in the legend box. Can anybody suggest me the procedure to reduce the font size in the lengend box.
I am herewith giving the instructions that I have used: But it is not getting affected in the end result.
# Shink current axis's height by 10% on the bottom
box = ax.get_position()
ax.set_position([box.x0, box.y0, box.width * 0.90, box.height])
# Put a legend to the right of the current axis
ax.legend(loc='center left', bbox_to_anchor=(1, 0.5), numpoints = 1)
#plt.show()
fontP = FontProperties()
fontP.set_size ('x-small')
filename1 = "DelayCellSpur"+ str(measuredFrequencyUnderTest)+"MHz.pdf"
print filename1
plt.savefig(filename1, dpi = None, facecolor = 'w', orientation = 'portrait',bbox_inches = None)
As I am a new user, I am not able to upload the image. Pls help me in reducing the size of the font in the legend box.
Thankyou,
Gopi
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你正在使用 matplotlb,不是吗?
像这样的东西可能会有所帮助:
请参阅 http://matplotlib.sourceforge.net/ api/pyplot_api.html#matplotlib.pyplot.legend
You're using matplotlb, aren't you?
Something like this may help:
See http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.legend