如何在matplotlib和pandas中增加图像大小? [英] How to increase image size in matplotlib and pandas?
问题描述
我正尝试增加此功能产生的图像尺寸:
I am trying to increase the size of the image resulting from this function:
plt.figure()); data_ordertotal.plot(); plt.legend(loc='best')
我尝试过,但是大小保持不变
I tried this but the size remains the same
plt.figure(figsize=(40,40)); data_ordertotal.plot(); plt.legend(loc='best')
我正在使用spyder进行编码,控制台中的输出始终保持相同大小.有什么办法吗?谢谢
I am coding using spyder and the output in the console remains always the same size. Any solution? Thanks
推荐答案
我猜您正在使用熊猫,您应该使用:
I guess you're using pandas, and you should use:
data_ordertotal.plot(figsize=(40,40))
它不适用于plt.figure(figsize=(40,40))
,因为如果不将axe
对象传递给熊猫,它将创建一个新的图形.
It doesn't work with plt.figure(figsize=(40,40))
because pandas will create a new figure if you don't pass it an axe
object.
它适用于:
fig, ax = plt.subplots(1, 1, figsize=(40,40))
data_ordertotal.plot(ax=ax)
...假设您使用的是熊猫,如果没有使用,您应该详细说明什么是data_ordertotal
...Assuming you're using pandas, if not you should detail a bit more what is data_ordertotal
HTH
这篇关于如何在matplotlib和pandas中增加图像大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!