- class pyqtgraph.exporters.SVGExporter(item)#
- pyqtgraph.exporters.SVGExporter.generateSvg(item, options=None)#
- pyqtgraph.exporters.SVGExporter._generateItemSvg(item, nodes=None, root=None, options=None)#
This function is intended to work around some issues with Qt’s SVG generator and SVG in general.
This function, while documented, is not considered part of the public API. The reason for its documentation is for ease of referencing by
generateSvg(). There should be no need to call this function explicitly.
1. Qt SVG does not implement clipping paths. This is absurd. The solution is to let Qt generate SVG for each item independently, then glue them together manually with clipping. The format Qt generates for all items looks like this:
<g> <g transform="matrix(...)"> one or more of: <path/> or <polyline/> or <text/> </g> <g transform="matrix(...)"> one or more of: <path/> or <polyline/> or <text/> </g> . . . </g>
2. There seems to be wide disagreement over whether path strokes should be scaled anisotropically. Given that both inkscape and illustrator seem to prefer isotropic scaling, we will optimize for those cases.
3. Qt generates paths using non-scaling-stroke from SVG 1.2, but inkscape only supports 1.1.
Both 2 and 3 can be addressed by drawing all items in world coordinates.
GraphicsItem) – GraphicsItem to generate SVG of
GraphicsItem, optional) – root GraphicsItem, if none, assigns to item, by default None
tuple where first element is XML element, second element is a list of child GraphicItems XML elements
- Return type: