1

Given an arbitrary text string abcdRef in blue color. Is there a sufferable way to turn the R into red color ?

import matplotlib.pyplot as plt

fig, ax = plt.subplots()
ax.text(0.0, 0.0, 'aaaaRaa',
        horizontalalignment='center',
        verticalalignment='center',  
        fontsize=50, 
        fontweight = 'bold',
        color='#000080'
        )
plt.axis("equal"); plt.show()

In the given example, the R should be red at the end. enter image description here

pyano
  • 1,885
  • 10
  • 28
  • 1
    There is the LaTeX approach: https://stackoverflow.com/a/9185143/8881141 – Mr. T Feb 16 '22 at 12:53
  • 1
    Thank you @Mr. T ! The LaTeX approach has resulted in system errors. But `def rainbow_text()` did work. – pyano Feb 18 '22 at 11:14

0 Answers0