将图形大小设置为大于matplotlib中的屏幕大小

时间:2019-04-08 04:19:48

标签: python matplotlib figure

我正在尝试在matplotlib中创建能够很好地在期刊文章中阅读的图形。我有一些较大的数字(带有子图),我希望以纵向模式占据几乎整个页面(特别是,对于在美国信纸上有1英寸的页边距的全页面数字,是6.5“ x9”)。我可以设置使用figsize参数可以轻松地实现图形尺寸。但是,如果将图形尺寸设置为大于屏幕尺寸(我使用的是13英寸笔记本电脑),则将压缩图形。具体来说,高度是一个问题。只要下面的height参数大于屏幕的高度,保存的图形的尺寸就不会更改:

height = 9
fig, ax = plt.subplots(3, 2, figsize=(6.5, height))
plt.savefig('test.png') # size of this figure is independent of height
                        # if height > height of my screen

即使matplotlib超出了屏幕尺寸,如何使val stepsHistoryBeforeALUCallback = ResultCallback<DataReadResult> { dataReadResult -> val stepBucketList: MutableList<DataPoint> = ArrayList() if(dataReadResult.buckets.size > 0){ dataReadResult.buckets.forEachIndexed { index, it -> val dataSets = it.dataSets dataSets.forEach { dataSet -> if(dataSet.dataPoints.size == 0) //for this day, the fit api does not gives anu dataPoints stepBucketList.add(getEmptyDataPoint(index)) else stepBucketList.add(dataSet.dataPoints[0]) } } } } 使用所要求的图形尺寸?我正在使用spyder。

1 个答案:

答案 0 :(得分:1)

这可能与您的情节生成后端有关。

您可以通过运行以下命令查看使用的后端:

import matplotlib; matplotlib.get_backend()

尝试将后端更改为其他内容,例如:

import matplotlib

matplotlib.use('Agg')

请注意,此操作必须在导入matplotlib.pyplot之前运行。

相关问题