matplotlib에서 사용되는 여러 가지 방법으로 길을 잃고 있습니다.컬러 막대 및 날짜/시간 축 틱이있는 분산 형 플롯
측면에 색상 막대가 있고 x 축에 날짜 시간이있는 색상으로 구분 된 산점도를 만들고 싶습니다.
그러나 내 ax
을 정의하는 방법에 따라 다른 오류가 발생합니다. 다음은 내 코드의 핵심입니다 : 내가 지정하는 경우
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
import matplotlib.cm as cm
import matplotlib.dates as mdates
#.....loading files etc.
norm = mcolors.Normalize(vmin=0,vmax=1000)
timerange = pd.date_range(start='2015-01-01', end='2016-01-01', freq='30D')
### PLOTTING
fig = plt.figure(figsize=(6.,5))
ax = fig.add_subplot(111)
for Af in Afiles:
for index, row in Af.iterrows():
time = pd.to_datetime(row['date'], format="%Y-%m-%d")
plt.scatter(time, row['A'], c=row['z'], norm=norm, cmap=colormap,edgecolor='k', lw=0.8, s=80)
plt.xticks(timerange, rotation=90)
ax.xaxis.set_major_formatter(mdates.DateFormatter("%d/%m/%Y"))
plt.xlabel('Time', fontsize=11, color='k')
clb = fig.colorbar(ax)
clb.ax.set_title('Value', y=-0.125, fontsize=11)
clb.ax.invert_yaxis()
fig.tight_layout()
이 AttributeError: 'AxesSubplot' object has no attribute 'autoscale_None'
을 생산하지만 내 ax
내 컬러 코딩 작업을 얻을 수 있도록 산포도, 나는 다음에 문제를 가지고 축 포맷터. 대신 ax = plt.scatter
을 쓰면 AttributeError: 'PathCollection' object has no attribute 'xaxis'
가 생성됩니다.
어떻게 색 막대와 서식 지정된 축 눈금을 모두 가질 수 있습니까?
물론! 어리석은 나, 고마워. 이건 창피해. – durbachit