Answers for "left-align the y-tick labels | remove the current labels"

0

left-align the y-tick labels | remove the current labels

Axes.set_yticklabels() method.

#code
fig, ax = plt.subplots(figsize=(4.5, 6))
ax.barh(top20_deathtoll['Country_Other'],
        top20_deathtoll['Total_Deaths'],
        height=0.45, color='#af0b1e')

ax.set_yticklabels([]) #an empty list removes the labels

#remove the current labels  using for loop
country_names = top20_deathtoll['Country_Other']
for i, country in zip(range(20), country_names):
    ax.text(x=-80000, y=i-0.15, s=country)
Posted by: Guest on August-20-2021
0

left-align the y-tick labels | remove the current labels

# Assume the rest of the code is written

ax.set_yticklabels([]) # an empty list removes the labels
country_names = top20_deathtoll['Country_Other']
for i, country in zip(range(20), country_names):
    ax.text(x=-80000, y=i-0.15, s=country)
Posted by: Guest on August-20-2021
0

left-align the y-tick labels | remove the current labels

Axes.set_yticklabels() method.

#code
fig, ax = plt.subplots(figsize=(4.5, 6))
ax.barh(top20_deathtoll['Country_Other'],
        top20_deathtoll['Total_Deaths'],
        height=0.45, color='#af0b1e')

ax.set_yticklabels([]) #an empty list removes the labels

#remove the current labels  using for loop
country_names = top20_deathtoll['Country_Other']
for i, country in zip(range(20), country_names):
    ax.text(x=-80000, y=i-0.15, s=country)
Posted by: Guest on August-20-2021
0

left-align the y-tick labels | remove the current labels

# Assume the rest of the code is written

ax.set_yticklabels([]) # an empty list removes the labels
country_names = top20_deathtoll['Country_Other']
for i, country in zip(range(20), country_names):
    ax.text(x=-80000, y=i-0.15, s=country)
Posted by: Guest on August-20-2021

Code answers related to "left-align the y-tick labels | remove the current labels"

Python Answers by Framework

Browse Popular Code Answers by Language