Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
[svg] Add rcParam["svg.id"] to add a top-level id attribute to <svg>#28536
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thank you for opening your first PR into Matplotlib!
If you have not heard from us in a week or so, please leave a new comment below and that should bring it to our attention. Most of our reviewers are volunteers and sometimes things fall through the cracks.
You can also join uson gitter for real-time discussion.
For details on testing, writing docs, and our review process, please seethe developer guide
We strive to be a welcoming and open project. Please follow ourCode of Conduct.
Thank you for this work. I agree that this is useful and worth doing, but have some questions about the implementation. I am a bit concerned about using a hard-coded value, would in be better to allow this to be threaded through |
timhoffm commentedJul 11, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I share the concern of a hard-coded value. Configuration can be
I also believe, the default should be no attribute, as it is now. Setting the attribute should be opt-in. |
Fair enough, I went the hardcoded route because there was indeed no straightforward path to pass it through If you agree on an approach I'd be happy to draft an implementation! |
timhoffm commentedJul 11, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
If the application is fairly niche, I'd go with an rcParam |
I also support going the rcparam route with default behavior being |
If not None, the `svg.id` rcParam value will be used for settingthe `id` attribute of the top `<svg>` tag.
3a66481
toa46dfdd
CompareI've added an implementation using rcparams. |
``svg.id`` rcParam | ||
~~~~~~~~~~~~~~~~~~ | ||
The value of this new rcParam controls whether the top-level ``<svg>`` tag | ||
contains an ``id`` attribute and what its value is. When set to ``None`` (the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
contains an``id`` attribute and what its value is. When set to ``None`` (the | |
contains an:rc:`svg.id` attribute and what its value is. When set to ``None`` (the |
to use our custom role.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
No. Here,id
is the attibute ins<svg>
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I took the liberty of rephrasing to make it more concise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
conditional on the docs change to use the rc role goes in
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
c56027b
intomatplotlib:mainUh oh!
There was an error while loading.Please reload this page.
Thanks@willemsk and congratulations on your first contribution to Matplotlib! We'd welcome to see you back. |
PR summary
Exported SVGs now contain a fixed
id="svg1"
attribute in the top level<svg>
tag.This is useful if you would like to link the entire matplotlib SVG file within another SVG file with the
<use>
tag.Where the
#svg1
indicator will now refer to the top level<svg>
tag, and will hence result in the inclusion of the entire file.Closes issue#28535
PR checklist