1
をpyplot 。軸が表示されていないとラベルが表示されないので、軸ラベルで試したすべてが失敗します。matplotlibのは、カラーコード化された点で、この緯度/経度の散布図で2D散乱ない軸、追加共有軸ラベル
これらのエラーのない作業コードを以下に示します。軸の境界線、ラベル、目盛りとticklabels:plt.axis("off")
を使用して
import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv("_test.csv")
power = df['n']
lat = df['latitude']
lon = df['longitude']
df = pd.read_csv("shifted3.csv")
power = df['n']
lat = df['latitude']
lon = df['longitude']
plt.subplot(121)
plt.scatter(lon, lat, c=power,s=65, vmin=0, vmax=3700)
# c= sets how the points are coloured, s= point size, vmin/max colour lims
plt.title('a) AGW')
plt.ylim(ymin=51.44,ymax=51.73)
plt.xlim(xmin=1.42, xmax=1.63)
plt.axis('off')
cbar = plt.colorbar()
cbar.ax.set_yticklabels(['0','','','','','','','','','3600'])
plt.subplot(122)
#plt.figure(figsize=(5,10))
plt.scatter(lon, lat, c=power,s=65, vmin=0, vmax=3700)
# c= sets how the points are coloured, s= point size, vmin/max colour lims
plt.title('b) no event')
plt.xlim(xmin=2.23, xmax=2.45)
plt.ylim(ymax=52.09)
plt.axis('off')
# #
cbar = plt.colorbar()
cbar.ax.set_yticklabels(['0','','800','','1600','','2400','','','3600'])
cbar.set_label('Power (kW)', rotation=270, labelpad=+12)
#labelpad + moves legend to right, - to left
plt.show()
を与え、すべて一緒にこれを置きますか? http://stackoverflow.com/questions/29041326/3d-plot-with-matplotlib-hide-axes-but-keep-axis-labels – periphreal
あなたが本当に達成しようとしていることを理解するのは難しいです。 "私は軸を持たない" - あなたが示すプロットには軸がありません。 "... x軸とy軸の共有ラベルがあります" xとyはどのようにラベルを共有できますか?そのラベルはどこにありますか? – ImportanceOfBeingErnest
謝罪@ImportanceOfBeingErnest、私は、サブプロットの下に共有されたxラベルと、2つのプロットの左側の単一のy軸を意味しました。 –