-
Notifications
You must be signed in to change notification settings - Fork 15
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
Feature request: Adding arbitrary metadata to figurefirst objects #50
Comments
Hey sorry not responding and creating a stale issue. I think this is a great idea, @florisvb I think you've been using the Actually, now that I think of it this describes most of the web... so yes, get out the crossbow! |
I guess this is pretty much us making our own spec, so it could be anything we want. Even if we put it in XML, it wouldn't be part of the SVG spec. But there are other elements of the SVG spec which allow you to stuff raw bytes in (raster images), so we could leave it up to the user - maybe there could be a content-type attribute on the containing tag. That said, I'm trying to recall exactly what my use case was - I wanted to store numbers associated with the plot (which can be regenerated and changed) so that they can be automatically inserted into e.g. the figure text. But that second parsing step would either need to use figurefirst itself to do the parsing (in which case why not just do it all at once, or the data would have to be exposed as something regex-able inside the SVG which sounds really, really gross. I think what I ended up doing, for this paper at least (which is still in prep 😅 ), was that the script which generated the figure using mpl/fifi also generated the TeX figure caption, and then the source document |
Good luck on the pape! Do you want to close this, or keep it open for future plans? |
Figures often have data which needs to be given in the caption: it would be nice to keep that data contained with the SVG itself, in a format both machine- and human-readable. As an example, in my plotting code I do some linear regression, whose parameters I would like to save to include in my text.
I saw there was the
FigureLayout.save_fifi_data
, but that pickles data to a separate file.The obvious solution is a
figurefirst:data
XML tag which contains arbitrary XML (namespaced with something likef"figurefirst:data-{user key}"
, which would be associated with the item it's annotating. That tag could go in the output layer (my only reservation about this is that when the SVG is prepared for publication, it might be nice to be able to strip this data out as easily as deleting the template layer is). There's scope for adding data directly to the template rects from inkscape (as another extension) as default data which is copied across automatically.I suppose in an ideal world the whole data hierarchy would be XML-serialised, but as a first pass there could just be one tag with a JSON payload in it, as that would play very nicely with python, and is terse, implicitly typed, and fairly human-readable.
I envision a something like this (with some kludges where I don't understand the process of going between
FFItem
and XML):This could then be subclassed by at least the FFFigure and FFAxis, if not other FFItems.
The text was updated successfully, but these errors were encountered: