python - 将 Seaborn 轴转换为对数
问题描述
我正在使用 seaborn 将 pandas 数据框中的一些数据绘制为简单的箱线图。我想在 y 轴上使用对数刻度。有没有好的方法来做到这一点?
from matplotlib import style, pyplot as plt
import seaborn as sns
import pandas as pd
plt.figure()
sns.boxplot(x='Sample', y='Variants', data=plot_data)
plt.tick_params(labelbottom=True, bottom=False)
sns.despine(offset=10, trim=True, bottom=True)
我确实尝试过plt.set_yscale('log')
,但我得到了这个错误:'module' object has no attribute 'set_yscale'
并plt.yscale('log')
给了我一个非常大的情节。
解决方案
推荐阅读
- java - 禁用级别日志 log4j
- c# - 如何将列表中的特定项目序列化为 JSON?
- python - 使用python使用来自Com端口的数据流写入文件后无法关闭文件
- node.js - node.js:gm 在传递太多数据时抛出 spawn E2BIG 错误
- css - CSS属性“包含:布局”使固定页脚不起作用
- javascript - 无法获取内容的画布 toDataURL
- amazon-web-services - S3 存储桶策略仅使某些文件类型公开可读
- java - 多级继承,试图访问超类
- matlab - 具有相同变量“速度”的 3 个条件的 MATLAB for 循环
- abap - 即使在导入 TR 之后,旧的 ABAP 代码仍然对 PyRFC 有效。为什么?