-
Notifications
You must be signed in to change notification settings - Fork 249
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
SVG output should preserve vertex/edge attributes #608
Comments
Which interface of igraph are you using? The core igraph C library does not have an SVG writer. High-level interfaces have differing and independent ways to produce graphics. |
As in bindings? Almost always Python. I've tinkered with R stuff once in a while, but although I don't particularly think I could speak for the R community, I can't see why it would have different expectations. This is exclusively about what gets written into the .svg output file. |
As I said, the plotting systems of high-level interfaces are entirely separate and unrelated, so this would need to be a separate request for each. I am transferring this to the python-igraph issue tracker. @iosonofabio Is this feasible for python-igraph? Does matplotlib support metadata that gets preserved upon export to SVG? I know that in Mathematica this is not currently possible. While the graphics system supports annotations, Mathematica's own SVG exporter does not preserve those annotations. |
SVG is actually sort of a special case in the plotting subsystem. Both the Cairo backend and the Matplotlib backend can export figures in SVG format, but at that point all references to igraph itself are lost; you only have a generic "figure" that you can save into SVG. However, igraph also has a |
Well, when I was writing my reply, it just said "what interface of igraph are you using". Certainly not objecting to the move; I merely don't want to be the one that the pitchfork-wielding Rillagers come after if the feature-sets drift apart.... Back to the main point, if I can clarify this:
(a) The (b) Secondarily, I would also say that other "valid SVG tags" ought to be preservable. Clearly (c) Personally, I would make a case that the "other, random/arbitrary attributes" in a Like I said, |
Neither method supports preserving attributes, @iosonofabio. This is not something I'm "trying" and failing to use; it's behavior that is not currently supported. Hence the feature request. |
Ok no immediate need, that's good to know. I recommend you also ask matplotlib whether they can include custom attributes in their SVG, that'd be the preferred route AFAIAC. |
Apparently there is some support for this in matplotlib: https://stackoverflow.com/a/46040257/695132 |
Great to hear! @n8willis why don't you look up or ask the mpl folks about class and once we have an answer we see how to best implement it? |
What is the feature or improvement you would like to see?
Graphs can currently support arbitrary attributes on each vertex and edge. Furthermore, graphs written to some external file formats (such as GraphViz .dot) support attaching
id
andclass
and other SVG attributes. But iGraph's SVG writer drops these attributes.Preserving attributes, primarily,
class
, in SVG output would allow users to export their network plots with metadata that allows interactive styling in browsers (or perhaps other applications). Just preserving theclass
and related attributes opens up the possibility of CSS and JavaScript manipulation of vertices and edges without requiring additional work within the iGraph library itself.Use cases for the feature
One of the major benefits of SVG output is that it permits on-the-fly styling of network elements via CSS. Such as highlighting edges with a particular attribute in their
class
.Notably, GraphViz already supports this, and GraphViz-exported SVGs can be controlled in-browser with styling tools. E.g., "bolding" the edges connecting some subset of vertices or changing the color of some vertex, just by using CSS rules and a
.class
selectorReferences
This is standard CSS; nothing out of the ordinary.
The text was updated successfully, but these errors were encountered: