Problems when exporting to svg

67 views
Skip to first unread message

Andrea Manghi

unread,
Dec 16, 2021, 4:57:24 AM12/16/21
to pyqtgraph
Hello everyone,
I'm trying to export a simple graph to svg format, but I'm facing some issues.
My graph should contain a series of points and three infinitelines.
The problem is that when I export the plot to svg the infinitelines are exported as lines long just 1 unit and the axis labels overlap with the axes itself, as you can see in the picture attached to this message.
The version of pyqtgraph I'm currently using is 0.12.3
test_code.py
test.svg

Andrea Manghi

unread,
Dec 16, 2021, 5:00:02 AM12/16/21
to pyqtgraph
I forgot to mention that the code I'm using is attached to the previous message as well as the output picture

Andrea Manghi

unread,
Dec 16, 2021, 6:54:43 AM12/16/21
to pyqtgraph
In the meantime, I tried to start from Pyqtgraph example "InfiniteLines".
I made some moifications to the example trying to make it fit my requirements, until I encountered again the same issue.
What i discovered is that if I change:

Immagine 2021-12-16 124203.png

making "show" False like this:

Immagine 2021-12-16 124305.png

and comment out the following lines:

Immagine 2021-12-16 124402.png

if i try to remove the labels from the InfiniteLines changing the code from this:

Immagine 2021-12-16 123910.png

to this:

Immagine 2021-12-16 124004.png

the InfiniteLines lenght becomes 1 unit, as seen in the previous picture.
You can see the output in the attached file test.svg

The only workaround I found was setting label parameter as an empty string, like this:

Immagine 2021-12-16 125017.png

after this modification the svg obtained is test2.svg, that youn can find attached to this message, and is exactly as expected.
test_code_2.py
test2.svg
test.svg

Andrea Manghi

unread,
Dec 16, 2021, 6:57:05 AM12/16/21
to pyqtgraph
I forgot again to mention that I'm currently trying to export from the api and to do that i added a little function to make the image export.
You can find the code I used attached to the prevous message
Reply all
Reply to author
Forward
0 new messages