0

How do I change text color from black to red in the following table produced by matplotlib? Code example is taken from here

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

fig, ax = plt.subplots()

# hide axes
fig.patch.set_visible(False)
ax.axis('off')
ax.axis('tight')

df = pd.DataFrame(np.random.randn(10, 4), columns=list('ABCD'))

ax.table(cellText=df.values, colLabels=df.columns, loc='center')

fig.tight_layout()

plt.show()

Alexander Borochkin
  • 4,249
  • 7
  • 38
  • 53
  • 1
    Check this answer here https://stackoverflow.com/questions/37554606/matplotlib-table-row-label-font-color-and-size Setting font properties iteratively should do it. – Adi Dec 10 '20 at 14:46
  • 1
    Does this answer your question? [Changing text color in cells for a table generated with matplotlib](https://stackoverflow.com/questions/64610994/changing-text-color-in-cells-for-a-table-generated-with-matplotlib) – etch_45 Dec 10 '20 at 14:50

0 Answers0