增加Seaborn的刻度标签字体大小 [英] Increase tick label font size in seaborn

查看:70
本文介绍了增加Seaborn的刻度标签字体大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的seaborn图有一个大问题.由于某些原因,沿轴的数字以非常小的字体打印,这使它们不可读.我试图用

缩放它们

with plt.rc_context(dict(sns.axes_style("whitegrid"),** sns.plotting_context(font_scale = 5))):b = sns.violinplot(y="Draughts", data=dr)

毫无帮助,这只会使轴文本变大,而不会使沿轴的数字变大.

解决方案

来自

I have a huge problem with my seaborn plots. For some reason, the numbers along the axis are printed with a really small font, which makes them unreadable. I've tried to scale them with

with plt.rc_context(dict(sns.axes_style("whitegrid"),
                     **sns.plotting_context(font_scale=5))):
    b = sns.violinplot(y="Draughts", data=dr)

To no help, this only makes the axis text larger, but not the number along the axis.

解决方案

The answer from here makes fonts larger in seaborn ...

import pandas as pd, numpy as np, seaborn as sns
from matplotlib import pyplot as plt

# Generate data
df = pd.DataFrame({"Draughts": np.random.randn(100)})

# Plot using seaborn
sns.set(font_scale = 2)
b = sns.violinplot(y = "Draughts", data = df)
plt.show()

这篇关于增加Seaborn的刻度标签字体大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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