我正在尝试更改玫瑰或"极地"情节中现有图例的标题字体大小.大多数代码都是由其他人写的,他们不在.我已经添加:-
ax.legend(title=legend_title)
setp(l.get_title(), fontsize=8)
Run Code Online (Sandbox Code Playgroud)
添加标题'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)
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助