<jupyter_start><jupyter_text>Example of useFirst, we import numpy, matplotlib and the new library MPL2LATEX. We will then make some examples with different type of implementation<jupyter_code>import numpy as np
import matplotlib.pyplot as plt
import matplotlib
from mpl2latex import mpl2latex, latex_figsize<jupyter_output><empty_output><jupyter_text>We will plot some simple data, let's say a quadratic function<jupyter_code>x = np.linspace(1, 100, 1000)
fig, ax = plt.subplots(figsize=latex_figsize( wf=0.8) ) # width of an entire latex column
ax.plot(x, x**2)
ax.set_xlabel('Coordinate $x$')
ax.set_ylabel('$x^2$')
ax.set_title('Trial')
plt.show()<jupyter_output><empty_output><jupyter_text>Now, we make the same but with the parameters of Matplotlib2LaTeX, inside the context. See the docs for a complete description of the tunable parameters<jupyter_code>flag = True
with mpl2latex(flag):
    fig, ax = plt.subplots(figsize=latex_figsize( wf=0.8) ) # width of an entire latex column
    ax.plot(x, x**2)
    ax.set_xlabel('Coordinate $x$')
    ax.set_ylabel('$x^2$')
    ax.set_title('Trial')
    fig.savefig('Examples_files/Trial.pgf')<jupyter_output><empty_output><jupyter_text>Once we exit from the context we easily come back to the matplotlib default backend and parameters!<jupyter_code>fig, ax = plt.subplots(figsize=latex_figsize( wf=0.8) ) # width of an entire latex column
ax.plot(x, x**2)
ax.set_xlabel('Coordinate $x$')
ax.set_ylabel('$x^2$')
ax.set_title('Trial')
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1170699803793329, 'fraction_numerical': 0.016350555918901243, 'mean_word_length': 6.216981132075472, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '269843', 'license': 'MIT', 'n_tokens_mistral': 583, 'n_tokens_neox': 562, 'n_words': 143, 'path': 'Examples.ipynb', 'repo_name': 'mballarin97/Matplotlib2LaTeX', 'size': '1529'}