10000 Trouble saving svg file when plot contains special characters · Issue #8280 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Trouble saving svg file when plot contains special characters #8280

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
reaganch opened this issue Mar 13, 2017 · 3 comments
Closed

Trouble saving svg file when plot contains special characters #8280

reaganch opened this issue Mar 13, 2017 · 3 comments

Comments

@reaganch
Copy link

Bug report

Bug summary

While trying to save a plot containing special characters as an SVG image, I get an error message saying the glyph cannot be converted with the encoding and may be wrong. In the produced SVG file, the special character is displayed as a rectangle with a cross. I searched a bit online and found the solution to this problem was to set svg.fonttype to 'none' in matplotlibrc. When I do this, however, it appears that matplotlibrc cannot handle the single quotes around 'none', although the default (commented out) option 'path' is in quotes. If I write just none without quotes, I continue to get the same error message.

Code for reproduction

import matplotlib.pyplot as plt
plt.rcParams['text.usetex'] = True
plt.rcParams['text.latex.preamble'] = '\usepackage{siunitx},\usepackage{libertine}'
plt.xlabel(r'$\si{\degree}$')
plt.tight_layout()
plt.savefig('plot.svg')
plt.show()

Actual outcome

plot

/usr/local/lib/python2.7/dist-packages/matplotlib/textpath.py:385: UserWarning: The glyph (176) of font (/usr/share/texmf/fonts/type1/public/cm-super/sfrm3583.pfb) cannot be converted with the encoding. Glyph may be wrong

Expected outcome

Ideally, the SVG file should contain a plot with the x-axis labeled with a degree sign.

Matplotlib version

  • Matplotlib version 2.0.0
  • Python version 2.7.12
  • Platform Linux Mint 18.1
  • Python installed from Linux Mint repos
  • Matplotlib installed using pip
@reaganch reaganch changed the title Trouble saving svg file Trouble saving svg file when plot contains special characters Mar 13, 2017
@tacaswell tacaswell added this to the 2.1 (next point release) milestone Mar 13, 2017
tacaswell added a commit to tacaswell/matplotlib that referenced this issue Mar 13, 2017
This will allow a wider range of glyphs to be exported.

Closes matplotlib#8280
@tacaswell
Copy link
Member

I have a fix, but not sure of other consequences of it.

@tacaswell tacaswell modified the milestones: 2.2 (next next feature release), 2.1 (next point release), 2.1.1 (next bug fix release) Aug 13, 2017
@tacaswell tacaswell modified the milestones: 2.1.1 (next bug fix release), 2.2 (next feature release) Oct 9, 2017
@anntzer anntzer mentioned this issue Dec 3, 2018
6 tasks
@github-actions
Copy link
github-actions bot commented Apr 9, 2023

This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!

@github-actions github-actions bot added the status: inactive Marked by the “Stale” Github Action label Apr 9, 2023
@ksunden
Copy link
Member
ksunden commented Apr 9, 2023

I do not seem to be able to recreate on current matplotlib,

Likely resolved by some combination of #12928 + #14156. similar to #8068

@ksunden ksunden closed this as completed Apr 9, 2023
@ksunden ksunden modified the milestones: future releases, v3.1.0 Apr 9, 2023
@QuLogic QuLogic removed the status: inactive Marked by the “Stale” Github Action label Apr 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants
0