2016-07-13 5 views
0

그래프/캔버스의 일부와 PNG 이미지의 날짜를 피하기 위해 내 코드에 무엇이 없습니까? 너무 많은 공간을 사용하지 않도록 180도 또는 수직으로 작성된 날짜를 사용할 수 있습니까?선형 그래프를 수행하는 팬더와 matplotlib

15/03/16 3000 300 200 
12/04/16 3000 300 300 
10/05/16 500 500 400 
12/06/16 1000 600 500 
14/07/16 1250 300 500 
21/07/16 2000 300 50 
15/08/16 3000 300 200 
12/09/16 3000 300 300 
10/10/16 500 500 400 
12/11/16 1000 600 500 
15/11/16 1250 300 500 
21/12/16 1000 500 50 

파이썬 코드는 다음과 같습니다 :

import pandas 
import matplotlib.pyplot as plt 

df = pandas.read_csv('data.csv', delimiter=';', 
        index_col=0, 
        parse_dates=[0], dayfirst=True, 
        names=['date','a','b','c']) 
df.plot() 
df.plot(subplots=True, figsize=(6, 6)) 

plt.savefig('sampledata1.png') 

및 PNG는 (누락 된 데이터)과 같습니다

내 데이터 세트는

enter image description here

감사합니다!

답변

0

데이터가 있습니다. 단지 플롯의 가장자리에 그려져 있습니다.

df.plot(ylim=(0,3500)) 
df.plot(subplots=True, figsize=(6, 6), ylim=(0,3500)) 

각 플롯에 대한 y- 제한을 변경하려면 커브를 개별적으로 플롯해야한다고 생각합니다.

내가 일반적으로 (엄청나게 많은 방법이 그것을 할 수있다) 같은 것을 할, 개별적으로 수행합니다

축 레이블

fig, axes = plt.subplots(3,1) 
axes[0].set_ylim([df.a.min()*0.9, df.a.max()*1.1]) 
axes[0].set_xticklabels([]) 
axes[1].set_ylim([df.b.min()*0.9, df.b.max()*1.1]) 
axes[1].set_xticklabels([]) 
axes[2].set_ylim([df.c.min()*0.9, df.c.max()*1.1]) 
axes[0].plot(df.a) 
axes[1].plot(df.b) 
axes[2].plot(df.c) 

jupyter screenshot

가 등을 읽을 수 있도록 조정할 수는 - checkout matplotlib.org에 많은 예제가 있습니다.

+0

답변 해 주셔서 감사합니다. 그렇다면 각 플롯마다 개별적으로 어떻게 할 수 있습니까? 다시 한 번 감사드립니다. – Gonzalo

관련 문제