Reputation: 409
This way I created my heatmap
:
fig = plt.figure(figsize = (8.27, 13.69), dpi = 100)
fig, ax = plt.subplots(1,1,figsize = (8.27, 13.69))
fig = plt.gcf()
heatplot = ax.imshow(c, cmap='rainbow', aspect='auto',\
norm=MidpointNormalize(midpoint=0.90))
c
is the array with the heatmap
values, normalised to one.
With ax.set_xticklabels()
, ax.set_xticks()
, ax.set_yticklabels()
and ax.set_yticks()
, I've added the axis to its heatmap
. Now I would like to add a second y
-axis. The orientation of the colorbar
is horizontal.
EDIT:
With the Help of Bazingaa i´ve got a second y-axis, but there is an offset:
ax1.set_yticks(np.arange(len(TITLES)), minor=False)
centers the ticks.
Upvotes: 2
Views: 1263
Reputation: 409
Solved the EDITED PART of my question this way:
ax2.set_ylim(ax1.get_ylim()) <-- This solvs the "Offset" between both scales
ax2.set_yticks(np.arange(len(ELEMENT[1])), minor=False)
ax2.set_yticklabels(ELEMENT[1])
Where did i find it?: How do I align gridlines for two y-axis scales using Matplotlib?
Answered by: Hugo Alain Oliva
Upvotes: 1