如何更改 seaborn 轴或图形级别图的图形大小 [英] How to change the figure size of a seaborn axes or figure level plot
本文介绍了如何更改 seaborn 轴或图形级别图的图形大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何更改图像的大小以使其适合打印?
How do I change the size of my image so it's suitable for printing?
例如,我想使用 A4 纸,横向尺寸为 11.7 英寸 x 8.27 英寸.
For example, I'd like to use to A4 paper, whose dimensions are 11.7 inches by 8.27 inches in landscape orientation.
推荐答案
需要提前创建 matplotlib Figure 和 Axes 对象,指定图形有多大:
You need to create the matplotlib Figure and Axes objects ahead of time, specifying how big the figure is:
from matplotlib import pyplot
import seaborn
import mylib
a4_dims = (11.7, 8.27)
df = mylib.load_data()
fig, ax = pyplot.subplots(figsize=a4_dims)
seaborn.violinplot(ax=ax, data=df, **violin_options)
这篇关于如何更改 seaborn 轴或图形级别图的图形大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文