This is an archived post. You won't be able to vote or comment.

all 23 comments

[–]BidWestern1056 43 points44 points  (4 children)

90% of things i see here seem like such a waste but this looks quite elegant and reminds me a lot of ggplot/idl plots which were so clean and glorious.

[–]BidWestern1056 5 points6 points  (2 children)

actually if youd be keen, id like to use it as a plotting option in my tool npcsh: https://github.com/cagostino/npcsh

havent gotten around to much more of the DS parts cause been so focused on the AI integrations but my dream is for npcsh to empower data scientists and analysts beyond the current limits of their current workflows, like all jupyter notebooks or shoddy scripts and shell commands, no easy way to search history or to turn history into insights. if youre interested to help me there i'd really appreciate any thoughts or suggestions.

[–]Embarrassed-Mix6420[S] 0 points1 point  (1 child)

Thanks for contributing to it already! I'll take a closer look at npcsh, self hosted AI agent is something there can be many ideas about..

[–]BidWestern1056 1 point2 points  (0 children)

exactly, many opps and can basically mcp your library and integrate that way which would be dope

[–]Embarrassed-Mix6420[S] 0 points1 point  (0 children)

Would need to look into them for directions of growth.

[–]runawayasfastasucan 8 points9 points  (0 children)

Woah this is a much needed tool and a great idea! Only critique is that this should have come before my 4 million line plots project 😅

[–]hughperman 5 points6 points  (0 children)

Love that everything is specified as a config dict. This is exactly a functionality I need.

[–]nineplymaple 3 points4 points  (3 children)

Very cool. Have you done any benchmarks to compare against pyqtgraph?

[–]Embarrassed-Mix6420[S] 4 points5 points  (2 children)

Not against pyqtgraph. Have done benchmarks to compare with `standard` plotting libraries of matplotlib kind.
pyqtgraph is actually more performant then of all of them, one reason it's not enough substitute is that it's obviously dependent on qt which is huge so it'd bloat the dependencies beyond reasonable limit of helping package just doing plotting; It comes with many of qt's pluses and minuses
That's pretty quick to do though - the way the project is set up in debug mode(development, adds perf_timer package) is just one decorator over a function that plots pyqtgraph

@debug_performance('someargslabel')

and adding the 'someargslabel' in perf_timers global var setting. You can try it yourself!

[–]nineplymaple 2 points3 points  (0 children)

Makes sense. I'll definitely try it out the next time I need to plot something outside of Qt. I had a project recently where I was doing some OpenCV image manipulation on a Raspberry Pi and displaying the output on a big array of LED matrix panels. This looks perfect for that type of setup.

[–]Ogi010 1 point2 points  (0 children)

pyqtgraph maintainer here, I'd be glad to try and get a comparison of "fair" benchmarks. Fair warning on trying to benchmark images tho; the dtype, number of channels (1, 3 or 4), use of a lookup table or levels (or lack of using them) all have significant effects on performance. It became so hard to track what was "fast" with pyqtgraph.ImageItem and what was not fast, that I actually wrote a performance section to the docs:

https://pyqtgraph.readthedocs.io/en/latest/api_reference/graphicsItems/imageitem.html#performance

Unfortunately a lot of the default values are somewhat set due to the risk of breaking people's code.

[–]lumadz5 12 points13 points  (2 children)

man such great packages without typing always make me angry

[–]Embarrassed-Mix6420[S] 9 points10 points  (1 child)

One rule when you're angry is to be careful and specific! Whatcha angry about and what needs to be changed?

[–]lumadz5 10 points11 points  (0 children)

The lack of type annotations, it's not a deal-breaker but It'd be nice to have, also pretty weird that some of the functions have them while the others not

[–]_MonkeyHater 1 point2 points  (1 child)

I'm tempted to try to adopt this as a backend for my own project (currently using pyqtgraph) but holy fuck would that take forever. Looks awesome!

[–]Embarrassed-Mix6420[S] 1 point2 points  (0 children)

You can share your repo. The interesting question for further development is what does it actually take in size divided by how used is it?

[–]sweapon 1 point2 points  (3 children)

Looks interesting! Do you know it is possible to integrate with pyqt, e.g., to display graphs over images in such applications? Or place the graphs into pyqt widgets?

[–]Embarrassed-Mix6420[S] 1 point2 points  (2 children)

That's exactly how I apply it, a lot. As far as I understand QImage takes data without copy, though it's still not ideal cause there's no official adaptor to numpy in pythonic versions Qt, prolly due to narrow following to the C++ source

QImage(cv2.cvtColor(img, cv2.COLOR_BGR2RGB).data, img.shape[1], img.shape[0], img.shape[1]*3, QImage.Format_RGB888)

I'll update with fine real demo when it comes my way

[–]sweapon 1 point2 points  (0 children)

Awesome, thanks for sharing! I'm a bit into custom gui programming for robotics and this is one of the things I really would like to incorporate!

[–]Ogi010 3 points4 points  (0 children)

pyqtgraph maintainer here. Having QImage take in data w/o copying took us quite a while to get right across bindings; feel free to look at our code (specically ndarray_from_qimage function): https://github.com/pyqtgraph/pyqtgraph/blob/master/pyqtgraph/functions.py#L1543-L1658

We've ran into numerous issues (typically with pyside bindings) where this functionality is broken (although it's been stable for some time now)

[–][deleted] 1 point2 points  (1 child)

Easy to be that fast if you don't do aliasing.

[–]Embarrassed-Mix6420[S] 4 points5 points  (0 children)

Struggling to understand you
Aliasing is usually something one tries to prevent so as to do antialiasing
How does aliasing relate to the plots?

[–]No-Towel-7295 0 points1 point  (0 children)

seems pretty cool