Here is another example that writes text in subscript in the axis labels and the legend.Open Compiler import numpy as np import matplotlib.pyplot as plt # Adjust figure size and autolayout plt.rcParams["figure.figsize"] = [7.00, 3.50] plt.rcParams["figure.autolayout"] = True # Generate ...
Roots and Exponents: Square root: `\sqrt{x}`, Exponent: `x^2`, Subscript: `x_1`, Superscript: `x^i` Other Notations Fractions: `\frac{numerator}{denominator}` Matrices: `bmatrix`, `pmatrix`, `vmatrix`, etc., using the `amsmath` package Special Symbols: For example, `\infty` fo...
plot(x, y, 'o-', label='Data') # Annotating a point with a subscript and a superscript plt.annotate(r'$\mathrm{Point}_{\mathrm{max}}^{(4, 10)}$', xy=(x[y.index(max(y))], max(y)), xytext=(3, 8), arrowprops=dict(facecolor='black', arrowstyle='->'), fontsize=12,...