Использование параметра dpi с df.plot - PullRequest
0 голосов
/ 18 июня 2020

Это мой код:

import matplotlib.pyplot as plt
import pandas as pd

x = ["Feb 15","Feb 16","Feb 17","Feb 18","Feb 19","Feb 20","Feb 21","Feb 22","Feb 23","Feb 24","Feb 25","Feb 26","Feb 27","Feb 28","Feb 29","Mar 01","Mar 02","Mar 03","Mar 04","Mar 05","Mar 06","Mar 07","Mar 08","Mar 09","Mar 10","Mar 11","Mar 12","Mar 13","Mar 14","Mar 15","Mar 16","Mar 17","Mar 18","Mar 19","Mar 20","Mar 21","Mar 22","Mar 23","Mar 24","Mar 25","Mar 26","Mar 27","Mar 28","Mar 29","Mar 30","Mar 31","Apr 01","Apr 02","Apr 03","Apr 04","Apr 05","Apr 06","Apr 07","Apr 08","Apr 09","Apr 10","Apr 11","Apr 12","Apr 13","Apr 14","Apr 15","Apr 16","Apr 17","Apr 18","Apr 19","Apr 20","Apr 21","Apr 22","Apr 23","Apr 24","Apr 25","Apr 26","Apr 27","Apr 28","Apr 29","Apr 30","May 01","May 02","May 03","May 04","May 05","May 06","May 07","May 08","May 09","May 10","May 11","May 12","May 13","May 14","May 15","May 16","May 17","May 18","May 19","May 20","May 21","May 22","May 23","May 24","May 25","May 26","May 27","May 28","May 29","May 30","May 31","Jun 01","Jun 02","Jun 03","Jun 04","Jun 05","Jun 06","Jun 07","Jun 08","Jun 09","Jun 10","Jun 11","Jun 12","Jun 13","Jun 14","Jun 15","Jun 16","Jun 17"] 
y = [12,12,12,12,12,10,29,29,28,48,51,54,54,57,60,65,85,106,138,200,289,401,504,663,949,1248,1581,2127,2666,3488,4439,6135,9043,13577,19139,23937,33238,43312,54196,67425,83112,100855,119156,137593,159107,181536,205744,233544,263317,293869,315184,343630,373394,401233,431559,462125,487397,511306,532330,555261,573353,592428,619309,638225,659312,683742,694998,720552,746926,760307,785353,809283,810292,829397,849660,872810,897098,912793,933424,946393,955576,965498,987974,1007801,1017122,1032443,1042886,1029254,1035582,1053328,1068666,1079489,1091412,1103109,1115026,1126920,1140216,1112349,1118555,1131322,1135885,1137011,1143967,1154815,1169531,1175796,1130531,1135993,1126124,1102948,1100618,1110082,1118964,1127682,1134368,1136949,1137100,1151775,1152357,1164785,1174320,1174801,1186227,1195734]

x = x[30:]
y = y[30:]
title = 'USA Active Cases'
df = pd.DataFrame()
df['Dates'] = x
df['Active Cases'] = y
df.plot(x ='Dates', y='Active Cases', kind = 'line', title = title)
plt.show()

Я хочу добавить параметр dpi = 300 в df.plot или установить dpi любым другим способом.

Это просто, когда я использую matplotlib напрямую, но я не знаю, как это сделать в случае df.plot

Спасибо

1 Ответ

1 голос
/ 18 июня 2020

Вы можете сохранить свою фигуру с желаемым dpi. например,

plt.savefig('path\filename.png', dpi=300, format='png')
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...