René's URL Explorer Experiment


Title: Unable to save figure as pdf while using latex package concmath · Issue #20469 · matplotlib/matplotlib · GitHub

Open Graph Title: Unable to save figure as pdf while using latex package concmath · Issue #20469 · matplotlib/matplotlib

X Title: Unable to save figure as pdf while using latex package concmath · Issue #20469 · matplotlib/matplotlib

Description: Hello all, I seem to run into a problem when I use the (latex) package concmath, and try saving the resultant plot as a pdf (png and jpeg work fine). As suggested in #10272, I've tried installing the "cm-super" package, but this does not...

Open Graph Description: Hello all, I seem to run into a problem when I use the (latex) package concmath, and try saving the resultant plot as a pdf (png and jpeg work fine). As suggested in #10272, I've tried installing t...

X Description: Hello all, I seem to run into a problem when I use the (latex) package concmath, and try saving the resultant plot as a pdf (png and jpeg work fine). As suggested in #10272, I've tried installi...

Opengraph URL: https://github.com/matplotlib/matplotlib/issues/20469

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Unable to save figure as pdf while using latex package concmath","articleBody":"Hello all,\r\n\r\nI seem to run into a problem when I use the (latex) package `concmath`, and try saving the resultant plot as a pdf (png and jpeg work fine). As suggested in #10272, I've tried installing the \"cm-super\" package, but this does not solve the issue. I've also played around with the backends, but the problem still persists. A short code that generates this issue:\r\n\r\n```\r\nfig = plt.figure(figsize=(4, 4))\r\nax = fig.add_axes([0, 0, 1, 1])\r\n\r\nplt.rcParams['font.family'] = 'monospace'\r\nplt.rcParams['text.usetex'] = True\r\nrc('text.latex', preamble=r'\\usepackage[OT1]{fontenc}\\usepackage{concmath}')\r\n\r\nplt.plot([10**1,10**9], [1,10], label='Test M$_\\star$')\r\nplt.scatter([10**1,10**9], [1,10], label='Test1 M$_\\star$ = 10M$_\\odot$')\r\nplt.xscale('log')\r\nplt.yscale('log')\r\n\r\nplt.xlabel('Test')\r\nplt.ylabel('Test')\r\n\r\nplt.xlim(10, 10**9)\r\n\r\nplt.legend()\r\n\r\nplt.savefig('test.pdf', bbox_inches='tight')\r\n```\r\n\r\nwith the following traceback:\r\n\r\n```\r\nKeyError                                  Traceback (most recent call last)\r\n\u003cipython-input-3-de7a1b0d622a\u003e in \u003cmodule\u003e\r\n     14 plt.legend()\r\n     15 \r\n---\u003e 16 plt.savefig('test_sm.pdf', bbox_inches='tight')\r\n\r\n~/opt/anaconda3/lib/python3.8/site-packages/matplotlib/pyplot.py in savefig(*args, **kwargs)\r\n    964 def savefig(*args, **kwargs):\r\n    965     fig = gcf()\r\n--\u003e 966     res = fig.savefig(*args, **kwargs)\r\n    967     fig.canvas.draw_idle()   # need this if 'transparent=True' to reset colors\r\n    968     return res\r\n\r\n~/opt/anaconda3/lib/python3.8/site-packages/matplotlib/figure.py in savefig(self, fname, transparent, **kwargs)\r\n   3003                 patch.set_edgecolor('none')\r\n   3004 \r\n-\u003e 3005         self.canvas.print_figure(fname, **kwargs)\r\n   3006 \r\n   3007         if transparent:\r\n\r\n~/opt/anaconda3/lib/python3.8/site-packages/matplotlib/backend_bases.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, bbox_inches, pad_inches, bbox_extra_artists, backend, **kwargs)\r\n   2253                 # force the figure dpi to 72), so we need to set it again here.\r\n   2254                 with cbook._setattr_cm(self.figure, dpi=dpi):\r\n-\u003e 2255                     result = print_method(\r\n   2256                         filename,\r\n   2257                         facecolor=facecolor,\r\n\r\n~/opt/anaconda3/lib/python3.8/site-packages/matplotlib/backend_bases.py in wrapper(*args, **kwargs)\r\n   1667             kwargs.pop(arg)\r\n   1668 \r\n-\u003e 1669         return func(*args, **kwargs)\r\n   1670 \r\n   1671     return wrapper\r\n\r\n~/opt/anaconda3/lib/python3.8/site-packages/matplotlib/_api/deprecation.py in wrapper(*inner_args, **inner_kwargs)\r\n    429                          else deprecation_addendum,\r\n    430                 **kwargs)\r\n--\u003e 431         return func(*inner_args, **inner_kwargs)\r\n    432 \r\n    433     return wrapper\r\n\r\n~/opt/anaconda3/lib/python3.8/site-packages/matplotlib/backends/backend_pdf.py in print_pdf(self, filename, dpi, bbox_inches_restore, metadata)\r\n   2723                 RendererPdf(file, dpi, height, width),\r\n   2724                 bbox_inches_restore=bbox_inches_restore)\r\n-\u003e 2725             self.figure.draw(renderer)\r\n   2726             renderer.finalize()\r\n   2727             if not isinstance(filename, PdfPages):\r\n\r\n~/opt/anaconda3/lib/python3.8/site-packages/matplotlib/artist.py in draw_wrapper(artist, renderer, *args, **kwargs)\r\n     72     @wraps(draw)\r\n     73     def draw_wrapper(artist, renderer, *args, **kwargs):\r\n---\u003e 74         result = draw(artist, renderer, *args, **kwargs)\r\n     75         if renderer._rasterizing:\r\n     76             renderer.stop_rasterizing()\r\n\r\n~/opt/anaconda3/lib/python3.8/site-packages/matplotlib/artist.py in draw_wrapper(artist, renderer, *args, **kwargs)\r\n     49                 renderer.start_filter()\r\n     50 \r\n---\u003e 51             return draw(artist, renderer, *args, **kwargs)\r\n     52         finally:\r\n     53             if artist.get_agg_filter() is not None:\r\n\r\n~/opt/anaconda3/lib/python3.8/site-packages/matplotlib/figure.py in draw(self, renderer)\r\n   2778 \r\n   2779             self.patch.draw(renderer)\r\n-\u003e 2780             mimage._draw_list_compositing_images(\r\n   2781                 renderer, self, artists, self.suppressComposite)\r\n   2782 \r\n\r\n~/opt/anaconda3/lib/python3.8/site-packages/matplotlib/image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)\r\n    130     if not_composite or not has_images:\r\n    131         for a in artists:\r\n--\u003e 132             a.draw(renderer)\r\n    133     else:\r\n    134         # Composite any adjacent images together\r\n\r\n~/opt/anaconda3/lib/python3.8/site-packages/matplotlib/artist.py in draw_wrapper(artist, renderer, *args, **kwargs)\r\n     49                 renderer.start_filter()\r\n     50 \r\n---\u003e 51             return draw(artist, renderer, *args, **kwargs)\r\n     52         finally:\r\n     53             if artist.get_agg_filter() is not None:\r\n\r\n~/opt/anaconda3/lib/python3.8/site-packages/matplotlib/_api/deprecation.py in wrapper(*inner_args, **inner_kwargs)\r\n    429                          else deprecation_addendum,\r\n    430                 **kwargs)\r\n--\u003e 431         return func(*inner_args, **inner_kwargs)\r\n    432 \r\n    433     return wrapper\r\n\r\n~/opt/anaconda3/lib/python3.8/site-packages/matplotlib/axes/_base.py in draw(self, renderer, inframe)\r\n   2919             renderer.stop_rasterizing()\r\n   2920 \r\n-\u003e 2921         mimage._draw_list_compositing_images(renderer, self, artists)\r\n   2922 \r\n   2923         renderer.close_group('axes')\r\n\r\n~/opt/anaconda3/lib/python3.8/site-packages/matplotlib/image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)\r\n    130     if not_composite or not has_images:\r\n    131         for a in artists:\r\n--\u003e 132             a.draw(renderer)\r\n    133     else:\r\n    134         # Composite any adjacent images together\r\n\r\n~/opt/anaconda3/lib/python3.8/site-packages/matplotlib/artist.py in draw_wrapper(artist, renderer, *args, **kwargs)\r\n     49                 renderer.start_filter()\r\n     50 \r\n---\u003e 51             return draw(artist, renderer, *args, **kwargs)\r\n     52         finally:\r\n     53             if artist.get_agg_filter() is not None:\r\n\r\n~/opt/anaconda3/lib/python3.8/site-packages/matplotlib/axis.py in draw(self, renderer, *args, **kwargs)\r\n   1139 \r\n   1140         for tick in ticks_to_draw:\r\n-\u003e 1141             tick.draw(renderer)\r\n   1142 \r\n   1143         # scale up the axis label box to also find the neighbors, not\r\n\r\n~/opt/anaconda3/lib/python3.8/site-packages/matplotlib/artist.py in draw_wrapper(artist, renderer, *args, **kwargs)\r\n     49                 renderer.start_filter()\r\n     50 \r\n---\u003e 51             return draw(artist, renderer, *args, **kwargs)\r\n     52         finally:\r\n     53             if artist.get_agg_filter() is not None:\r\n\r\n~/opt/anaconda3/lib/python3.8/site-packages/matplotlib/axis.py in draw(self, renderer)\r\n    300         for artist in [self.gridline, self.tick1line, self.tick2line,\r\n    301                        self.label1, self.label2]:\r\n--\u003e 302             artist.draw(renderer)\r\n    303         renderer.close_group(self.__name__)\r\n    304         self.stale = False\r\n\r\n~/opt/anaconda3/lib/python3.8/site-packages/matplotlib/artist.py in draw_wrapper(artist, renderer, *args, **kwargs)\r\n     49                 renderer.start_filter()\r\n     50 \r\n---\u003e 51             return draw(artist, renderer, *args, **kwargs)\r\n     52         finally:\r\n     53             if artist.get_agg_filter() is not None:\r\n\r\n~/opt/anaconda3/lib/python3.8/site-packages/matplotlib/text.py in draw(self, renderer)\r\n    721 \r\n    722                 if textobj.get_usetex():\r\n--\u003e 723                     textrenderer.draw_tex(gc, x, y, clean_line,\r\n    724                                           textobj._fontproperties, angle,\r\n    725                                           mtext=mtext)\r\n\r\n~/opt/anaconda3/lib/python3.8/site-packages/matplotlib/_api/deprecation.py in wrapper(*inner_args, **inner_kwargs)\r\n    429                          else deprecation_addendum,\r\n    430                 **kwargs)\r\n--\u003e 431         return func(*inner_args, **inner_kwargs)\r\n    432 \r\n    433     return wrapper\r\n\r\n~/opt/anaconda3/lib/python3.8/site-packages/matplotlib/backends/backend_pdf.py in draw_tex(self, gc, x, y, s, prop, angle, ismath, mtext)\r\n   2190         for x1, y1, dvifont, glyph, width in page.text:\r\n   2191             if dvifont != oldfont:\r\n-\u003e 2192                 pdfname = self.file.dviFontName(dvifont)\r\n   2193                 seq += [['font', pdfname, dvifont.size]]\r\n   2194                 oldfont = dvifont\r\n\r\n~/opt/anaconda3/lib/python3.8/site-packages/matplotlib/backends/backend_pdf.py in dviFontName(self, dvifont)\r\n    863 \r\n    864         tex_font_map = dviread.PsfontsMap(dviread.find_tex_file('pdftex.map'))\r\n--\u003e 865         psfont = tex_font_map[dvifont.texname]\r\n    866         if psfont.filename is None:\r\n    867             raise ValueError(\r\n\r\n~/opt/anaconda3/lib/python3.8/site-packages/matplotlib/dviread.py in __getitem__(self, texname)\r\n    856         assert isinstance(texname, bytes)\r\n    857         try:\r\n--\u003e 858             result = self._font[texname]\r\n    859         except KeyError:\r\n    860             fmt = ('A PostScript file for the font whose TeX name is \"{0}\" '\r\n\r\nKeyError: b'ccr10'\r\n```\r\n\r\nPlease let me know if there's a way to circumvent this issue. Thank you all in advance!\r\n\r\n  * Operating system: macOS Big Sur 11.2.3\r\n  * Matplotlib version: 3.4.2\r\n  * Matplotlib backend: module://ipykernel.pylab.backend_inline\r\n  * Python version: 3.8.8\r\n\r\n  * Matploblib came pre-installed with anaconda, but upgraded through pip.\r\n\r\n\r\n\r\n","author":{"url":"https://github.com/oorc06","@type":"Person","name":"oorc06"},"datePublished":"2021-06-19T14:09:58.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/20469/matplotlib/issues/20469"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:a5890112-ee12-5f3c-f18d-c1f49246ad85
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD072:343816:27A3E9:35AA95:6A52412D
html-safe-nonce3b0a375f49c6493ca3f8bf91dc8490eaf1794fb506d8e6384eb7a438db2e6896
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMDcyOjM0MzgxNjoyN0EzRTk6MzVBQTk1OjZBNTI0MTJEIiwidmlzaXRvcl9pZCI6IjkwNDcxNzE5MDI5NjgzMTYyMDUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacaa303c499f2027447522faa066614de755f8313d331dd2259b8646a98e5113f0
hovercard-subject-tagissue:925402010
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/20469/issue_layout
twitter:imagehttps://opengraph.githubassets.com/a5f4d0847d49e206a83f950f76cd7a5407df7c9ae8e63a48b90c81767979ee73/matplotlib/matplotlib/issues/20469
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/a5f4d0847d49e206a83f950f76cd7a5407df7c9ae8e63a48b90c81767979ee73/matplotlib/matplotlib/issues/20469
og:image:altHello all, I seem to run into a problem when I use the (latex) package concmath, and try saving the resultant plot as a pdf (png and jpeg work fine). As suggested in #10272, I've tried installing t...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameoorc06
hostnamegithub.com
expected-hostnamegithub.com
Noneb9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb
turbo-cache-controlno-preview
go-importgithub.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git
octolytics-dimension-user_id215947
octolytics-dimension-user_loginmatplotlib
octolytics-dimension-repository_id1385122
octolytics-dimension-repository_nwomatplotlib/matplotlib
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1385122
octolytics-dimension-repository_network_root_nwomatplotlib/matplotlib
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release7aed05249554b889eb33d002851a973eebcc7e91
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/matplotlib/matplotlib/issues/20469#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmatplotlib%2Fmatplotlib%2Fissues%2F20469
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmatplotlib%2Fmatplotlib%2Fissues%2F20469
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=matplotlib%2Fmatplotlib
Reloadhttps://github.com/matplotlib/matplotlib/issues/20469
Reloadhttps://github.com/matplotlib/matplotlib/issues/20469
Reloadhttps://github.com/matplotlib/matplotlib/issues/20469
Please reload this pagehttps://github.com/matplotlib/matplotlib/issues/20469
matplotlib https://github.com/matplotlib
matplotlibhttps://github.com/matplotlib/matplotlib
Please reload this pagehttps://github.com/matplotlib/matplotlib/issues/20469
Notifications https://github.com/login?return_to=%2Fmatplotlib%2Fmatplotlib
Fork 8.4k https://github.com/login?return_to=%2Fmatplotlib%2Fmatplotlib
Star 23k https://github.com/login?return_to=%2Fmatplotlib%2Fmatplotlib
Code https://github.com/matplotlib/matplotlib
Issues 1.1k https://github.com/matplotlib/matplotlib/issues
Pull requests 409 https://github.com/matplotlib/matplotlib/pulls
Actions https://github.com/matplotlib/matplotlib/actions
Projects https://github.com/matplotlib/matplotlib/projects
Wiki https://github.com/matplotlib/matplotlib/wiki
Security and quality 0 https://github.com/matplotlib/matplotlib/security
Insights https://github.com/matplotlib/matplotlib/pulse
Code https://github.com/matplotlib/matplotlib
Issues https://github.com/matplotlib/matplotlib/issues
Pull requests https://github.com/matplotlib/matplotlib/pulls
Actions https://github.com/matplotlib/matplotlib/actions
Projects https://github.com/matplotlib/matplotlib/projects
Wiki https://github.com/matplotlib/matplotlib/wiki
Security and quality https://github.com/matplotlib/matplotlib/security
Insights https://github.com/matplotlib/matplotlib/pulse
Unable to save figure as pdf while using latex package concmathhttps://github.com/matplotlib/matplotlib/issues/20469#top
Difficulty: Hardhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issueshttps://github.com/matplotlib/matplotlib/issues?q=state%3Aopen%20label%3A%22Difficulty%3A%20Hard%22
status: upstream fix requiredhttps://github.com/matplotlib/matplotlib/issues?q=state%3Aopen%20label%3A%22status%3A%20upstream%20fix%20required%22
topic: text/fontshttps://github.com/matplotlib/matplotlib/issues?q=state%3Aopen%20label%3A%22topic%3A%20text%2Ffonts%22
topic: text/usetexhttps://github.com/matplotlib/matplotlib/issues?q=state%3Aopen%20label%3A%22topic%3A%20text%2Fusetex%22
https://github.com/oorc06
oorc06https://github.com/oorc06
on Jun 19, 2021https://github.com/matplotlib/matplotlib/issues/20469#issue-925402010
#10272https://github.com/matplotlib/matplotlib/issues/10272
Difficulty: Hardhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issueshttps://github.com/matplotlib/matplotlib/issues?q=state%3Aopen%20label%3A%22Difficulty%3A%20Hard%22
status: upstream fix requiredhttps://github.com/matplotlib/matplotlib/issues?q=state%3Aopen%20label%3A%22status%3A%20upstream%20fix%20required%22
topic: text/fontshttps://github.com/matplotlib/matplotlib/issues?q=state%3Aopen%20label%3A%22topic%3A%20text%2Ffonts%22
topic: text/usetexhttps://github.com/matplotlib/matplotlib/issues?q=state%3Aopen%20label%3A%22topic%3A%20text%2Fusetex%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.