Python 使图表更大

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/38294852/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 20:37:04  来源:igfitidea点击:

Making a chart bigger in size

pythonpandasmatplotlib

提问by vsoler

I'm trying to get a bigger chart. However, the figure method from matplotlib does not seem to be working properly.

我正在尝试获得更大的图表。但是,matplotlib 中的图形方法似乎无法正常工作。

I get a message, which is not an error:

我收到一条消息,这不是错误:

import pandas.io.data as web
import pandas as pd
import matplotlib.pyplot as plt

%matplotlib inline
...
plt.figure(figsize=(20,10))
df2['media']= df2['SPY']*.6 + df2['TLT']*.4
df2.plot()
plt.show()

What's wrong with my code?

我的代码有什么问题?

回答by Stefan

You can skip the first plt.figure()and just use the argument figsize:

您可以跳过第一个plt.figure(),只使用参数 figsize:

df2.plot(figsize=(20,10))

See docs.

请参阅文档