garrettj403 / SciencePlots

Matplotlib styles for scientific plotting
MIT License
6.96k stars 700 forks source link

Cannot show the percent sign in figure #115

Closed ShaofengZou closed 4 months ago

ShaofengZou commented 4 months ago

Environment

System: macOS-14.0-arm64-arm-64bit
Python: 3.9.6 (default, Jun 28 2021, 19:24:41) 
[Clang 12.0.5 (clang-1205.0.22.9)]
SciencePlots: 2.1.1
Matplotlib: 3.5.0
LaTeX distro:
pdfTeX 3.141592653-2.6-1.40.25 (TeX Live 2023)
kpathsea version 6.3.5
Copyright 2023 Han The Thanh (pdfTeX) et al.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.
Compiled with libpng 1.6.39; using libpng 1.6.39
Compiled with zlib 1.2.13; using zlib 1.2.13
Compiled with xpdf version 4.04

Affected styles

['science',  'grid']

Describe the issue here

Cannot show the percent sign in the figure legend.

How can we replicate it? What have you tried? Please, add a reproducible example

plt.plot(x, y, label='{:.1f}%'.format(45))

Extra info

No response

echedey-ls commented 4 months ago

See this link https://tex.stackexchange.com/questions/280924/how-to-insert-symbol-in-a-statement-without-intending-comment#280925


From: ShaofengZou @.> Sent: Thursday, April 18, 2024 6:04:52 AM To: garrettj403/SciencePlots @.> Cc: Subscribed @.***> Subject: [garrettj403/SciencePlots] Cannot show the percent sign in figure (Issue #115)

Environment

System: macOS-14.0-arm64-arm-64bit Python: 3.9.6 (default, Jun 28 2021, 19:24:41) [Clang 12.0.5 (clang-1205.0.22.9)] SciencePlots: 2.1.1 Matplotlib: 3.5.0 LaTeX distro: pdfTeX 3.141592653-2.6-1.40.25 (TeX Live 2023) kpathsea version 6.3.5 Copyright 2023 Han The Thanh (pdfTeX) et al. There is NO warranty. Redistribution of this software is covered by the terms of both the pdfTeX copyright and the Lesser GNU General Public License. For more information about these matters, see the file named COPYING and the pdfTeX source. Primary author of pdfTeX: Han The Thanh (pdfTeX) et al. Compiled with libpng 1.6.39; using libpng 1.6.39 Compiled with zlib 1.2.13; using zlib 1.2.13 Compiled with xpdf version 4.04

Affected styles

['science', 'grid']

Describe the issue here

Cannot show the percent sign in the figure legend.

How can we replicate it? What have you tried? Please, add a reproducible example

plt.plot(x, y, label='{:.1f}%'.format(45))

Extra info

No response

— Reply to this email directly, view it on GitHubhttps://github.com/garrettj403/SciencePlots/issues/115, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ATDJ6YEMRQQXQJMTG64IS2DY55A6JAVCNFSM6AAAAABGMPA6OCVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI2DSNRYHE3TONQ. You are receiving this because you are subscribed to this thread.Message ID: @.***>

echedey-ls commented 4 months ago

Just in case, you had to use \% where you wanted %.

Closing as completed due to inactivity.