← 输入框|github.com|刷新
Skip to content

Add metadata saving support to SVG. - #17221

Merged
tacaswell merged 3 commits into
matplotlib:masterfrom
QuLogic:svg-metadata
Jun 10, 2020
Merged

tacaswell merged 3 commits into
matplotlib:masterfrom
QuLogic:svg-metadata

Conversation

@QuLogic

@QuLogic QuLogic commented Apr 23, 2020

Copy link
Copy Markdown
Member

PR Summary

Reading RDF specifications is a pain, so this is somewhat reverse-engineered from what Inkscape does, and confirmed that the Matplotlib svg loads metadata in Inkscape.

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • [N/A] Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@QuLogic QuLogic mentioned this pull request Apr 23, 2020
1 of 6 tasks
@QuLogic
QuLogic force-pushed the svg-metadata branch 2 times, most recently from dba191e to df57609 Compare April 23, 2020 21:07
@QuLogic QuLogic added this to the v3.3.0 milestone Apr 23, 2020
@efiring

efiring commented May 8, 2020

Copy link
Copy Markdown
Member

Scanning, it looks reasonable, but I know zip about svg. Do we have an svg expert we can call on for a review?

@anntzer

anntzer commented May 29, 2020

Copy link
Copy Markdown
Contributor

Do you want to add a test-only dependency on something like https://en.wikipedia.org/wiki/RDFLib to check that the metadata is correct? Otherwise it feels a bit hard to actually check that the implementation is correct, as I don't really want to read the RDF/Dublin Core specs either :)

PS: Looks like rdflib (which I just found from a quick goole search) may be one of the few python libs that is both older than matplotlib (it dates back to 2002) and still actively developed :) (I guess the winner there maybe PIL(low), which dates back to 1995, dunno if there's anything else?)

@QuLogic

QuLogic commented Jun 3, 2020

Copy link
Copy Markdown
Member Author

I tried this, but rdflib won't even read the RDF from Inkscape.

@anntzer

anntzer commented Jun 7, 2020

Copy link
Copy Markdown
Contributor

Let's perhaps consider another approach to testing to move this forward: if you write xpath queries (https://docs.python.org/3.8/library/xml.etree.elementtree.html#elementtree-xpath) testing that you can retrieve the correct metadata entries, I guess that I could be willing to believe you that the xpath queries themselves correspond to what the specs say.

@tacaswell
tacaswell merged commit 5a01c86 into matplotlib:master Jun 10, 2020
@QuLogic
QuLogic deleted the svg-metadata branch June 10, 2020 19:14
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.

4 participants