2

If I run this code

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline

fig = plt.figure()
ax = fig.add_subplot(111)

df = pd.DataFrame(np.random.randn(3, 1))
ax.barh(df.index, df[0])

I get the following plot:

enter image description here

If I add this line

ax.tick_params(axis='y', which='major', labelcolor='red')

then every tick label on the y-axis gets colored in red. However, I would only like the label '2.0' to be colored red - all the others should stay black.

ignoring_gravity
  • 6,677
  • 4
  • 32
  • 65

0 Answers0