CoCalc Shared Files10. Sagetex / Matplotlib2tikz.ipynbOpen in CoCalc with one click!
Author: Ivica Nakić
In [5]:
import numpy as np import matplotlib.pyplot as plt %matplotlib inline def f(t): return np.exp(-t) * np.cos(2*np.pi*t) t1 = np.arange(0.0, 5.0, 0.1) t2 = np.arange(0.0, 5.0, 0.02) fig = plt.figure(); fig, ax = plt.subplots(); ax.plot(t1, f(t1), 'bo', t2, f(t2), 'k');
<matplotlib.figure.Figure at 0x7f952806db50>
In [6]:
from matplotlib2tikz import save as tikz_save
In [7]:
tikz_save('graf.tikz', figure=fig)
file encoding: None ========================================================= Please add the following line to your LaTeX preamble: \usepackage{pgfplots} \usepgfplotslibrary{plotmarks} =========================================================