[英]how to increase the size of Jupyter notebook plot
使用calmap包我創建了一個熱圖日歷,但我想知道如何增加字體或圖的大小。
import numpy as np; np.random.seed(sum(map(ord, 'calmap')))
import pandas as pd
import calmap
all_days = pd.date_range('1/15/2014', periods=700, freq='D')
days = np.random.choice(all_days, 500)
events = pd.Series(np.random.randn(len(days)), index=days)
calmap.yearplot(events, year=2015)
這應該可以解決您的問題
import matplotlib.pyplot as plt
plt.rcParams["figure.figsize"]=20,20
根據文檔 :
def yearplot(data, year=None, how='sum', vmin=None, vmax=None, cmap='Reds',
fillcolor='whitesmoke', linewidth=1, linecolor=None,
daylabels=calendar.day_abbr[:], dayticks=True,
monthlabels=calendar.month_abbr[1:], monthticks=True, ax=None,
**kwargs):
有一個ax
參數。 它對應於必須繪制圖形的軸。 首先創建一個具有所需大小的軸。
from matplotlib import pyplot as plt
f, ax = plt.subplots(1, 1, figsize = (15, 10))
calmap.yearplot(events, year=2015, ax=ax)
編輯:對於字體大小,在軸上工作。 像這樣的東西:
for item in ([ax.title, ax.xaxis.label, ax.yaxis.label] +
ax.get_xticklabels() + ax.get_yticklabels()):
item.set_fontsize(20)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.