增加海洋标题的字体尺寸
我使用以下功能创建了一个散点图:
def plot_all_seaborn(x,y,types,x_axis, y_axis, title):
tuples = only_floats(x,y,types)
x,y,types_new = zip(*tuples)
frame = pd.DataFrame({x_axis:x,y_axis:y,'Model':types_new})
sns.relplot(data=frame,
x=x_axis,
y=y_axis,
hue="Model",
style="Model",
s=500
).set(title=title)
对于此图,我想增加表的字体大小。我尝试在set> set
方法中添加font_size
参数,但这不起作用。我该如何放大标题?
基于此链接(对海出块的字体大小的良好控制),我尝试过:
def plot_all_seaborn(x,y,types,x_axis, y_axis, title):
tuples = only_floats(x,y,types)
x,y,types_new = zip(*tuples)
frame = pd.DataFrame({x_axis:x,y_axis:y,'Model':types_new})
b = sns.relplot(data=frame,
x=x_axis,
y=y_axis,
hue="Model",
style="Model",
s=500
)
b.set_title("Title",fontsize=20)
plt.show()
但是,这返回以下错误:
attributeError:'facetGrid'对象没有属性'set_title'
I have created a scatterplot using the following function:
def plot_all_seaborn(x,y,types,x_axis, y_axis, title):
tuples = only_floats(x,y,types)
x,y,types_new = zip(*tuples)
frame = pd.DataFrame({x_axis:x,y_axis:y,'Model':types_new})
sns.relplot(data=frame,
x=x_axis,
y=y_axis,
hue="Model",
style="Model",
s=500
).set(title=title)
For this plot, I want to increase the font size of the table. I have tried adding a font_size
parameter in the set
method, but this does not work. How can I enlarge the title?
Based on this link (Fine control over the font size in Seaborn plots), I tried:
def plot_all_seaborn(x,y,types,x_axis, y_axis, title):
tuples = only_floats(x,y,types)
x,y,types_new = zip(*tuples)
frame = pd.DataFrame({x_axis:x,y_axis:y,'Model':types_new})
b = sns.relplot(data=frame,
x=x_axis,
y=y_axis,
hue="Model",
style="Model",
s=500
)
b.set_title("Title",fontsize=20)
plt.show()
However, this returns the following error:
AttributeError: 'FacetGrid' object has no attribute 'set_title'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是可行的,但是您必须将其他参数作为一个指定传递。
This is doable, but you have to pass in the additional parameters as a dict.
我认为您可以这样取得成果;
I think you can achieve your results like so;