이 함수를 설명서에서 사용하여 matplotlib로 멋진 플롯을 만듭니다.ImageGrid의 colobar label matplotlib
def demo_grid_with_single_cbar(fig):
"""
A grid of 2x2 images with a single colorbar
"""
grid = AxesGrid(fig, 132, # similar to subplot(132)
nrows_ncols = (2, 2),
axes_pad = 0.0,
share_all=True,
label_mode = "L",
cbar_location = "top",
cbar_mode="single",
)
Z, extent = get_demo_image()
for i in range(4):
im = grid[i].imshow(Z, extent=extent, interpolation="nearest")
#plt.colorbar(im, cax = grid.cbar_axes[0])
grid.cbar_axes[0].colorbar(im)
for cax in grid.cbar_axes:
cax.toggle_label(False)
# This affects all axes as share_all = True.
grid.axes_llc.set_xticks([-2, 0, 2])
grid.axes_llc.set_yticks([-2, 0, 2])
나는 년 Colorbar이 '권리'위치 위 또는 경우, 년 Colorbar에 레이블을 추가 변경하려면, 다음 라벨은 aswell 측면으로 이동한다.
그냥 일을합니까
cbar = grid.cbar_axes[0].colorbar(im)
cbar.ax.set_label_text("$[a.u.]$")
을 변경!
답변으로 자유롭게 게시하십시오. 여기 주위에 자신의 질문에 대답해도 괜찮습니다. 또한이 질문에 미래 방문객을위한 폐쇄를 제공하는 데 도움이 될 것입니다. – mgilson
곧 완료 될 것입니다. – elcojon