To answer my own question, in case someone else has the same one: it is 
actually quite easy to use a svg as a background image: you can simply load 
the svg into a QGraphicsSVGItem and then use it in the same way you would a 
pg.ImageItem. Some of the interfaces (such as for setting the 
size/position) are slightly different, but the PlotItem addItem() function 
will happily accept the QGraphicsSVGItem and draw it properly! End result 
is much lower memory usage (by about 2GB over the high-resolution images I 
was using), and a background image that looks good at ANY zoom level.

On Thursday, June 13, 2019 at 12:18:24 PM UTC-8, Israel Brewster wrote:
>
> I was wondering if there was any way to use a SVG image as a background in 
> pyqtgraph? I’m using pyqtgraph for an interactive mapping application, and 
> using PNG’s I have to make a choice between slow loading and high memory 
> usage, but good resolution when zooming in, vs quick loading and low memory 
> usage, but pixelated images when zooming in. Since my “maps” are just 
> coastlines, it seems like this would be an ideal use of the scalability of 
> an SVG (assuming I can come up with an appropriate SVG, of course)
>
> ---
> Israel Brewster
> Software Engineer
> Alaska Volcano Observatory 
> Geophysical Institute - UAF 
> 2156 Koyukuk Drive 
> Fairbanks AK 99775-7320
> Work: 907-474-5172
> cell:  907-328-9145
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyqtgraph/a67f5f42-067c-4720-8d31-776aa31ec83d%40googlegroups.com.

Reply via email to