Skip to content

Support quoted strings in matplotlibrc #22589

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

Merged
merged 1 commit into from
Mar 6, 2022

Conversation

timhoffm
Copy link
Member

@timhoffm timhoffm commented Mar 3, 2022

This enables using the comment character # within strings. Also it lets you write hex colors more consistently as "#FFFFFF" rather than FFFFFF (i.e. omitting the hash). We discourage the latter but keep it for backward compatibility.

Closes #19288.
Superseeds #22565.

@timhoffm timhoffm added this to the v3.6.0 milestone Mar 3, 2022
@anntzer
Copy link
Contributor

anntzer commented Mar 3, 2022

I guess it's OK to not support single quotes or backslash escapes (I'm less sure wrt double quotes in the string, which seem unsupported too?), but the difference with standard python syntax should probably be explicitly noted.

@tacaswell
Copy link
Member

I am 👍🏻 on this in principle, but something seems wrong with the rcparams parsing.

@timhoffm timhoffm force-pushed the quoted-matplotlibrc branch from 88b4a0d to fc41ba4 Compare March 4, 2022 00:24
@timhoffm
Copy link
Member Author

timhoffm commented Mar 4, 2022

Ha! Edge case when the line starts with a comment. Tests should pass now.

@timhoffm
Copy link
Member Author

timhoffm commented Mar 4, 2022

I guess it's OK to not support single quotes or backslash escapes (I'm less sure wrt double quotes in the string, which seem unsupported too?), but the difference with standard python syntax should probably be explicitly noted.

I indeed plan to supporting backslash escapes soon.

@timhoffm timhoffm marked this pull request as draft March 4, 2022 07:56
This enables using the comment character # within strings.

Closes matplotlib#19288.
Superseeds matplotlib#22565.
@timhoffm timhoffm force-pushed the quoted-matplotlibrc branch from fc41ba4 to 7c378a8 Compare March 4, 2022 13:06
@timhoffm timhoffm marked this pull request as ready for review March 4, 2022 14:57
Copy link
Member

@tacaswell tacaswell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets not hold this on other improvements (like single quotes and escaping).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Escape # character in matplotlibrc
4 participants