plt.plot(x_data, x_data**3, label ='$x^3$') plt.legend() plt.show() REF https://stackoverflow.com/questions/53781815/superscript-format-in-matplotlib-plot-legend https://stackoverflow.com/questions/21226868/superscript-in-python-plots...
importmatplotlib.pyplotaspltimportnumpyasnp# 创建一个 2x2 的子图网格fig,axs=plt.subplots(2,2,figsize=(12,10))# 生成示例数据x=np.linspace(0,10,100)y1=np.sin(x)y2=np.cos(x)y3=np.tan(x)y4=x**2# 自定义每个子图的标题axs[0,0].plot(x,y1)axs[0,0].set_title('Sin Function - ...
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,...
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...
但有个问题是,如果只是使用公式来做上下标,出来的字体是斜着的。...(非公式),在markdown里面可以使用html的一些标签,例如和: [P] [OK] 使用的效果是这样的:[P]这是一个下标,[OK]...\textsuperscript{P} \textsubscript{OK} LaTex的结果就不在这里演示了,这就是相关的使用上下标的方法。...总结概要...
예를 들어 Matplotlib를 사용하여 플롯을 만들고 달러 기호를 사용하여 위 첨자를 추가해 보겠습니다. 아래 코드를 참조하십시오. import matplotlib.pyplot as plt fig, ax = plt.subplots() ax.set(title=r"$e^{-...
harder for the plot directive and the *.py files are not so large. - JDH2008-12-15 Fix \$ in non-math text with usetex off. Document differences between usetex on/off - MGD2008-12-15 Fix anti-aliasing when auto-snapping - MGD2008...