79271985

Date: 2024-12-11 14:05:18
Score: 1
Natty:
Report link

You can change the tick display with plt.xticks() and use the format r'$...$' to use latex:

import matplotlib.pyplot as plt
plt.figure(figsize=(3, 3)) 

plt.plot(range(10, 1000), range(10, 1000))
plt.xticks([0, 200, 600, 1000],
           [r'$0$', r'$2 \cdot 10^{2}$', r'$6 \cdot 10^{2}$', r'$1 \cdot 10^{3}$'])
plt.tick_params(axis='x', labelsize=8)
plt.tick_params(axis='y', labelsize=8)
plt.show()

res

Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: rehaqds