0

I've searched all over and can't find a strait forward answer to this question. I tried ax.text as well instead of annotate and still couldn't get it to work. I simply want to print my string EXACTLY as I typed it in the code, but matplotlib keeps dropping the dollar signs. HELP!

import matplotlib.pyplot as plt
import numpy as np

x = np.random.rand(10)
y = np.random.rand(10)*2

fig, ax = plt.subplots(figsize = (10,6))

ax.scatter(x,y)
ax.annotate(f'Test dollar signs : $90 - $93\nMore tests : $54.00 - $60.00',
            xy = (.5, 1))

Example plot

TER
  • 107
  • 6

0 Answers0