Löschen Sie die redundante Achse in der Farbleiste

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Löschen Sie die redundante Achse in der Farbleiste

by Anonymous » 16 Apr 2025, 09:10

Dieser Teil des Code stammt aus dem Code meines Lehrers: < /p>

Code: Select all

fig, ax = plt.subplots(
1,
4,
figsize=[18, 4],
sharex=True,
sharey=True,
)

for i in range(4):
ax[i].imshow(np.random.rand(200, 800), cmap="viridis_r", origin="lower")

divider = make_axes_locatable(ax[-1])
cax = divider.new_horizontal(size="4%", pad="2%")
fig.add_axes(cax)
fig.colorbar(mpl.cm.ScalarMappable(cmap=mpl.cm.viridis_r, norm=norm), cax=cax)

plt.show()
ok, dieser ColorBar ist normal, aber in einem anderen Teil des Codes:

Warum hat hier die ColorBar eine weitere x -Achse mit sehr dichten Zecken? Ich will sie nicht! < /P>

Code: Select all

cax.set_xticks([])
funktioniert nicht

Top