Skip to content

utils.draw.use_tex

Function ยท Source

mdnc.utils.draw.use_tex(
    flag=False
)

Switch the maplotlib font backend to \(\LaTeX\).

This function is not recommended, because it would take effects globally. Please use mdnc.utils.draw.setFigure as a safer way.

Arguments

Requries

Argument Type Description
flag bool A flag, indicating whether to use the \(\LaTeX\) backend for rendering figure fonts.

Examples

Example
1
2
3
4
5
6
7
8
9
import numpy as np
import matplotlib.pyplot as plt
import mdnc

mdnc.utils.draw.use_tex(True)
t = np.linspace(-10, 10, 100)
plt.plot(t, 1 / (1 + np.exp(-t)))
plt.title(r'Use latex: $\frac{1}{1 + \exp (-t)}$.')
plt.show()


Last update: March 14, 2021

Comments