I have a heatmap that looks like this (from: Plotting a 2D heatmap with Matplotlib).
I am trying to create a heatmap that don't have the ticklabels for each value, but group by ranges. For example, the first three tick marks have not been signed but have been signed with one joint signed 'Apples'.
It seems easy to disable the ticklabels at all with the use of:
plt.tick_params(
axis='x',
which='both',
bottom=False,
top=False,
labelbottom=False)
or to choose only selected ticks:
for (i,l) in enumerate(ax.xaxis.get_ticklabels()):
if i == 0 or i == 4 or i == 5:
l.set_visible(True)
else:
l.set_visible(False)
but could it be done as below?
An example code for a heatmap:
corr = np.corrcoef(np.random.randn(10, 200))
mask = np.zeros_like(corr)
mask[np.triu_indices_from(mask)] = True
with sns.axes_style("white"):
ax = sns.heatmap(corr, mask=mask, vmax=.3, square=True, cmap="YlGnBu")
plt.show()