python - seaborn set style 去掉了despine配置的边框
问题描述
考虑这个情节:
import matplotlib.pyplot as plt
import seaborn as sns
Data = sns.load_dataset("tips")
g = sns.lmplot(x="total_bill", y="tip", hue="smoker", data = Data, legend_out = False, aspect = 2)
g.set(xlabel = "independent", ylabel = "dependent")
sns.despine(fig=None, ax=None, top=False, right=False, left=False, bottom=False, offset=None, trim=False)
plt.show()
现在,如果我添加设置:
sns.set(rc={'figure.figsize':(10,5)}, font_scale=1.5)
sns.set_style({'axes.facecolor':'white', 'grid.color': '.8', 'font.family':'Times New Roman'})
它删除了我想保留的边框:
如果您能帮助我了解问题所在以及如何解决,我将不胜感激。
解决方案
也许你想忽略 seaborn 的样式,直接设置你需要的参数?
import matplotlib.pyplot as plt
import seaborn as sns
rc = {'figure.figsize':(10,5),
'axes.facecolor':'white',
'axes.grid' : True,
'grid.color': '.8',
'font.family':'Times New Roman',
'font.size' : 15}
plt.rcParams.update(rc)
Data = sns.load_dataset("tips")
g = sns.lmplot(x="total_bill", y="tip", hue="smoker", data = Data, legend_out = False, aspect = 2)
g.set(xlabel = "independent", ylabel = "dependent")
sns.despine(fig=None, ax=None, top=False, right=False, left=False, bottom=False, offset=None, trim=False)
plt.show()
推荐阅读
- wordpress - 为什么我的 wordpress 网站需要花费太多时间才能从服务器获得响应?
- django - 运行 vue 开发模式与生产时的不一致
- c# - 计算不同的摄影参数
- big-o - 大O递归关系
- python - CountVectorizer 值在分类器中单独工作,在添加其他特征时无法工作
- c++ - 如何在 C++ 预处理器定义中获取 CMake 可执行文件名
- intervals - 计算两个角度区间的重叠
- javascript - 有两个出口会增加捆绑的大小吗
- python - OpenCV:如何检查 roi 的颜色?
- docker - 我应该使用哪种架构来预初始化一台服务器中的 N 个 docker?