You are reading documentation for the unreleased version of Matplotlib. Try searching for the released version of this page instead?
Applications are open for the 2018 John Hunter Matplotlib Summer Fellowship. Apply now!
Version 2.2.2.post1768+g23420a4c1
matplotlib
Fork me on GitHub

Related Topics

The difference between \dfrac and \fracΒΆ

In this example, the differences between the \dfrac and \frac TeX macros are illustrated; in particular, the difference between display style and text style fractions when using Mathtex.

New in version 2.1.

Note

To use \dfrac with the LaTeX engine (text.usetex : True), you need to import the amsmath package with the text.latex.preamble rc, which is an unsupported feature; therefore, it is probably a better idea to just use the \displaystyle option before the \frac macro to get this behavior with the LaTeX engine.

../../_images/sphx_glr_dfrac_demo_001.png
import matplotlib.pyplot as plt

fig = plt.figure(figsize=(5.25, 0.75))
fig.text(0.5, 0.3, r'\dfrac: $\dfrac{a}{b}$',
         horizontalalignment='center', verticalalignment='center')
fig.text(0.5, 0.7, r'\frac: $\frac{a}{b}$',
         horizontalalignment='center', verticalalignment='center')
plt.show()

Keywords: matplotlib code example, codex, python plot, pyplot Gallery generated by Sphinx-Gallery