![](/img/trans.png)
[英]I can't make the size of my graph bigger using matplotlib.pyplot and using plt.figure(figsize = (10, 12))
[英]figure size does not respond to my figsize setting in plt.figure() with matplotlib in my jupyter notebook
我試圖用matplotlib改變我的情節的數字大小。 但是我得到的實際數字大小並沒有改變為plt.figure()中不同的figsize設置。 我完全不知道為什么會這樣。 有人可以幫我嗎? 下面是示例代碼。 我正在使用jupyter筆記本。 非常感謝。
import matplotlib.pyplot as plt
%matplotlib inline
x = np.arange(1,5,1)
fig = plt.figure(figsize=(10,5))
fig, ax = plt.subplots(nrows=1, ncols=2)
ax = ax.flatten()
ax[0].plot(x, x+2, 'k-')
ax[1].plot(x, 2*x+5, 'k-');
你正在創造兩個數字。 一個的大小設置為(10,5)
,另一個是你繪制的。 刪除線fig = plt.figure(figsize=(10,5))
並將figsize=(10,5)
添加到要顯示的圖形中。
fig, ax = plt.subplots(nrows=1, ncols=2, figsize=(10,5))
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.