我正在尝试更改极坐标图例中现有标题的字体大小。大部分代码是由其他人编写的,而这个人不在场。我已经添加了:
ax.legend(title=legend_title)
setp(l.get_title(), fontsize=8)
为了添加标题“legend_title”,用户在另一个使用此代码的函数中输入字符串作为变量。这段代码的第二行没有返回错误,但是似乎也没有做任何事情。完整的代码如下。“Rose”和“RoseAxes”是由某人编写的模块/函数。有人知道如何更改图例标题字体大小吗?我已经找到了一些普通绘图的示例,但是找不到任何用于玫瑰图/极坐标图的示例。
from Rose.RoseAxes import RoseAxes
from pylab import figure, title, setp, close, clf
from PlotGeneration import color_map_xml
fig = figure(1)
rect = [0.02, 0.1, 0.8, 0.8]
ax = RoseAxes(fig, rect, axisbg='w')
fig.add_axes(ax)
if cmap == None:
(XMLcmap,colors) = color_map_xml.get_cmap('D:/HRW/VET/HrwPyLibs/ColorMapLibrary/paired.xml',255)
else:
XMLcmap = cmap
bqs = kwargs.pop('CTfigname', None)
ax.box(Dir, U, bins = rose_binX, units = unit, nsector = nsector, cmap = XMLcmap, lw = 0, **kwargs )
l = ax.legend()
ax.legend(title=legend_title)
setp(l.get_texts(), fontsize=8)
setp(l.get_title(), fontsize=8)
感谢任何帮助