GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add metadata saving support to SVG. by QuLogic · Pull Request #17221 · matplotlib/matplotlib

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@QuLogic QuLogic added backend: svg Enhancement labels Apr 23, 2020
@QuLogic QuLogic mentioned this pull request Apr 23, 2020
Warn on invalid savefig keyword arguments #17223
Merged
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?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@QuLogic QuLogic mentioned this pull request May 28, 2020
Reuse png metadata handling of imsave() in FigureCanvasAgg.print_png(). #15435
Merged
6 tasks
@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?)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@QuLogic
QuLogic force-pushed the svg-metadata branch from df57609 to eb83f6f Compare June 3, 2020 07:28
@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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@QuLogic
QuLogic force-pushed the svg-metadata branch from eb83f6f to 7bbb004 Compare June 3, 2020 21:29
@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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@QuLogic
QuLogic force-pushed the svg-metadata branch from 7bbb004 to 61ad0d3 Compare June 10, 2020 01:02
anntzer
anntzer reviewed Jun 10, 2020
View reviewed changes
Comment thread lib/matplotlib/tests/test_backend_svg.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

QuLogic added 3 commits June 9, 2020 23:22
@QuLogic
Add metadata saving support to SVG.
15e2117
@QuLogic
Simplify BytesIO usage in svg tests.
f0b133d
@QuLogic
Convert SVG metadata test to XML/XPath parsing.
207013d
@QuLogic
QuLogic force-pushed the svg-metadata branch from 61ad0d3 to 207013d Compare June 10, 2020 03:22
anntzer
anntzer approved these changes Jun 10, 2020
View reviewed changes
@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

Reviewers

@anntzer anntzer anntzer approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

backend: svg

Projects

None yet

Milestone

v3.3.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@QuLogic @efiring @anntzer @tacaswell
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.