Closed
Description
Bug summary
When saving certain outputs using Latex rendering as an SVG, it produces wrong outputs. Using plt.show() it renders correctly, and it works for saving as a PDF, but saving the output as a SVG math environment characters can render in the wrong size (see attached screenshots.)
Code for reproduction
from pathlib import Path
import pandas as pd
import matplotlib.pyplot as plt
import scienceplots
BASE_PATH = Path(__file__).parent
DATA_PATH = BASE_PATH / "ion_ranges.csv"
plt.style.use(['science', 'latex-siunitx'])
dat = pd.read_csv(DATA_PATH)
plt.plot(dat["energy"], dat["projected_range_um"], marker="o", linestyle="-")
plt.xlabel("Energy (keV)")
plt.ylabel(r"Projected Range (\si{\um})")
plt.tight_layout()
plt.savefig(BASE_PATH / "ion_ranges_plot.pdf")
Actual outcome
Expected outcome
Additional information
No response
Operating system
No response
Matplotlib Version
3.10.1
Matplotlib Backend
No response
Python version
No response
Jupyter version
No response
Installation
None