Amit V
Amit V

Reputation: 301

Add x-tick marks in figure

When I plot a dendrogram enter image description hereusing the following code, t-ticks are shown while x-ticks are hidden. I'd like to add y-tick marks as well. How can I do that?

from scipy.cluster import hierarchy
import matplotlib.pyplot as plt

ytdist = np.array([662., 877., 255., 412., 996., 295., 468., 268.,
                   400., 754., 564., 138., 219., 869., 669.])
Z = hierarchy.linkage(ytdist, 'single')
plt.figure()
dn = hierarchy.dendrogram(Z)

Upvotes: 1

Views: 592

Answers (1)

jylls
jylls

Reputation: 4695

If you want to add the tick marks on the x axis you can add the line plt.tick_params(bottom='on')

from scipy.cluster import hierarchy
import matplotlib.pyplot as plt
import numpy as np

ytdist = np.array([662., 877., 255., 412., 996., 295., 468., 268.,
                   400., 754., 564., 138., 219., 869., 669.])
Z = hierarchy.linkage(ytdist, 'single')
plt.figure()

dn=hierarchy.dendrogram(Z)
plt.tick_params(bottom='on')

The output gives me the plot below with the tick marks on the x-axisenter image description here

Upvotes: 2

Related Questions