11 ms·
Fastplotlib: GPU-accelerated, fast, and interactive plotting library
- gooboo 2y agoYeah, many browsers have webgpu turned off by default, So you're stuck with wasm (wasm Simd if you're lucky) Hopefully both are implemented.
- ivoflipse 2y agoThis library builds upon pygfx and wgpu-py. Unfortunately, the latter doesn't support running on WASM, pyscript or pyodide yet, but there's an issue about it: https://github.com/pygfx/wgpu-py/issues/407 https://github.com/pygfx/wgpu-py/issues/407 PRs welcome though :-)
- almarklein 2y agoThat's because WebGPU is still experimental. This will change, as it's set to replace WebGL. Fastplotlib / pygfx are primarily meant to run on desktop. When using it via the notebook the server does the rendering. As Ivo said, we have plans to support running in the browser via Pyodide, which opens some interesting things, but is not the primary purpose.
- ZeroCool2u 2y agoSeems like a nice library, but I have a hard time seeing myself using it over plotly. The plotly express API is just so simple and easy. For example, here's the docs for the histogram plot: https://plotly.com/python/histograms/ https://plotly.com/python/histograms/ This code gives you a fully interactive, and performant, histogram plot: ```python import plotly.express as px df = px.data.tips() fig = px.histogram(df, x="total_bill") fig.show() ```
- deleted 2y ago[deleted]
- kushalkolar 2y agoDifferent use cases :) Plotly doesn't give the performance and interactive tools required for many neuroscience visualizations. We also focus more on the primitive graphics and, at least not yet, on the more complex "composite" graphics built with primitives like histograms.
- asangha 2y ago>sine_wave.colors[::3] = "red" I never knew I needed this until now
- deleted 2y ago[deleted]
- kushalkolar 2y agoWe offer a lot of ways to slice colors, set cmaps and cmap transforms, they are really useful in neuroscience: https://fastplotlib.org/ver/dev/_gallery/line/line_colorslice.html#sphx-glr-gallery-line-line-colorslice-py https://fastplotlib.org/ver/dev/_gallery/line/line_colorslic... https://fastplotlib.org/ver/dev/_gallery/line/line_cmap_more.html#sphx-glr-gallery-line-line-cmap-more-py https://fastplotlib.org/ver/dev/_gallery/line/line_cmap_more... https://fastplotlib.org/ver/dev/_gallery/line/line_cmap.html#sphx-glr-gallery-line-line-cmap-py https://fastplotlib.org/ver/dev/_gallery/line/line_cmap.html... And with collections if you want to go crazy: https://fastplotlib.org/ver/dev/_gallery/line_collection/line_collection_slicing.html#sphx-glr-gallery-line-collection-line-collection-slicing-py https://fastplotlib.org/ver/dev/_gallery/line_collection/lin...
- sfpotter 2y agoVery cool effort. That said, and it's probably because of the kind of work that I do, but I have almost never found the four challenges to be any kind of a problem for me. Although I do think there is some kind of contradiction there. Plotting (exploratory data analyis ("EDA"), really) is all about distilling key insights and finding features hidden in data. But you have to some kind of intuition about where the needle in the haystack is. IME, throwing up a ton of plots and being able to scrub around in them never seems to provide much insight. It's also very fast---usually the feedback loop is like "make a plot, go away and think about it for an hour, decide what plot I need to make next, repeat". If there is too much data on the screen it defeats the point of EDA a little bit. For me, matplotlib still reigns supreme. Rather than a fancy new visualization framework, I'd love for matplotlib to just be improved (admittedly, fastplotlib covers a different set of needs than what matplotlib does... but the author named it what they named it, so they have invited comparison. ;-) ). Two things for me at least that would go a long way: 1) Better 3D plotting. It sucks, it's slow, it's basically unusable, although I do like how it looks most of the time. I mainly use PyVista now but it sure would be nice to have the power of a PyVista in a matplotlib subplot with a style consistent with the rest of matplotlib. 2) Some kind of WYSIWYG editor that will let you propagate changes back into your plot easily. It's faster and easier to adjust your plot layout visually rather than in code. I'd love to be able to make a plot, open up a WYSIWYG editor, lay things out a bit, and have those changes propagate back to code so that I can save it for all time. (If these features already exist I'll be ecstatic ;-) )
- paddy_m 2y agoI'd be curious to hear more about your EDA workflow. What I want for EDA is a tool that let's me quickly toggle between common views of the dataset. I run through the same analysis over and over again, I don't want to type the same commands repeatedly. I have my own heuristics for which views I want, and I want a platform that lets me write functions that express those heuristics. I want to build the inteligence into the tool instead of having to remember a bunch of commands to type on each dataframe. For manipulating the plot, I want a low-code UI that lets me point and click the operations I want to use to transform the dataframe. The lowcode UI should also emit python code to do the same operations (so you aren't tied to a low-code system, you just use it as a faster way to generate code then typing). I have built the start of this for my open source datatable UX called Buckaroo. But it's for tables, not for plotting. The approach could be adapted to plotting. Happy to collaborate.
- paddy_m 2y agoReally nice post introducing your library. When would you reach for a different library instead of fastplotlib? How does this deal with really large datasets? Are you doing any type of downsampling? How does this work with pandas? I didn't see it as a requirement in setup.py Does this work in Jupyter notebooks? What about marimo?
- kushalkolar 2y agoThanks! > When would you reach for a different library instead of fastplotlib? Use the best tool for your usecase, we're focused on GPU accelerated interactive visualization. Our use cases broadly are developing ML algorithms, user-end ML Ops tools, and looking live data off of live scientific instruments. > How does this deal with really large datasets? Are you doing any type of downsampling? Depends on your hardware, see https://fastplotlib.org/ver/dev/user_guide/faq.html#do-i-need-a-gpu https://fastplotlib.org/ver/dev/user_guide/faq.html#do-i-nee... > How does this work with pandas? I didn't see it as a requirement in setup.py If you pass in numpy-like types that use the buffer protocol it should work, we also want to support direct dataframe input in the future: https://github.com/fastplotlib/fastplotlib/issues/395 https://github.com/fastplotlib/fastplotlib/issues/395 There are more low-level priorities in the meantime. > Does this work in Jupyter notebooks? What about marimo? Jupyter yes via juptyer-rfb, see our repo: https://github.com/fastplotlib/fastplotlib?tab=readme-ov-file#supported-frameworks https://github.com/fastplotlib/fastplotlib?tab=readme-ov-fil...
- applied_heat 2y agoLooking forward to checking out your library, thanks for sharing it with the world. I’ve been using kst-plot for live streaming data from instruments and interactive plots. It’s fast and I haven’t found any limit for the amount of data it can plot. Development has basically stopped - the product is done, feature complete, and works perfectly! It is used by European and Canadian space agencies. Maybe it will be interesting to you to see how they have solved or approached some of the same problems you have solved or will also solve !
- carabiner 2y agoGPU all the things! GPU-accelerated Tableau would be incredible.
- pama 2y agoI know 3D is in the roadmap. Once the basic functionality is in place, it would be great to also consider integrating molecular visualization or at least provide enough fast primitives to simplify the integration of molecular visualization tools with this library.
- clewis7 2y agoWe are definitely looking forward to adding more 3D graphics in the future, and this sounds really cool. Would you mind posting an issue on the repo? I think this is something we would want to have on the roadmap or at least an open issue to plan out how we could do this. Thanks!
- theLiminator 2y agoDo you have any numbers for the rough number of datapoints that can be handled? I'm curious if this enables plotting many millions of datapoints in a scatterplot for example.
- clewis7 2y agoYes! The number of data points can range in the millions. Quite honestly, the quality of your GPU would be the limiting factor here. I will say, however, that for most use cases, an integrated GPU is sufficient. For reference, we have plotted upwards of 3 million points on a mid-range integrated GPU from 2017. I will work on adding somewhere in our docs some metrics for this kind of thing (I think it could be helpful for many).
- enriquto 2y ago>I will work on adding somewhere in our docs some metrics for this kind of thing (I think it could be helpful for many). Certainly! A comparison of performance with specialized tools for large point clouds would be very interesting (like cloudcompare and potree).
- CreRecombinase 2y agoEvery two weeks or so I peruse github looking for something like this and I have to say this looks really promising. In statistical genetics we make really big scatterplots called Manhattan plots https://en.wikipedia.org/wiki/Manhattan_plot https://en.wikipedia.org/wiki/Manhattan_plot and we have to use all this highly specialized software to visualize at different scales (for a sense of what this looks like: https://my.locuszoom.org/gwas/236887/ https://my.locuszoom.org/gwas/236887/). Excited to try this out
- clewis7 2y agoHey! This sounds like a really interesting use case. If you run into any issues or need help with the visualization, please don't hesitate to post an issue on the repo. We can also think about adding an example demo of a manhattan plot to help too!
- deleted 2y ago[deleted]
- j_bum 2y agoIf you’re working in R with ggplot2, you could also consider the `ggrastr` package, specifically, `ggrastr::geom_point_rast`
- samstave 2y agoHave you tried ManimGL? https://github.com/3b1b/manim/releases https://github.com/3b1b/manim/releases Super awesome, and you can make it into an MCP for Cursor.
- swalsh 2y agoThese really large scatterplots are also useful for visualizing claims, and finding fraud.
- abdullahkhalids 2y agoIs it possible to put the interactive plots on your website? Or is this a Jupyter notebook only tool.
- clewis7 2y agoSee here: https://www.fastplotlib.org/ver/dev/user_guide/faq.html#what-frameworks-does-fastplotlib-support https://www.fastplotlib.org/ver/dev/user_guide/faq.html#what... We are hoping for pyodide integration soon, which would allow fastplotlib to be run strictly in the browser!
- abdullahkhalids 2y agoThanks. That will be very cool.
- fpl-dev 2y agoIn the browser only jupyter for now, you can use voila to make a server based application using jupyter: https://github.com/voila-dashboards/voila https://github.com/voila-dashboards/voila As Caitlin pointed out below pyodide is a future goal.
- abdullahkhalids 2y agoThis is very nice. But thinking more along the lines of, can I embed a single interactive widget in a blog post.
- ivoflipse 2y agoNot today, it requires wgpu-py to support running on WASM / pyodide, which it doesn't yet (unfortunately)
- meisel 2y agoOne of the big bottlenecks of plotting libraries is simply the time it takes to import the library. I’ve seen matplotlib being slow to import, and in Julia they even have a “time to first plot” metric. I’d be curious to see how this library compares.
- clewis7 2y agoI think one nice thing that we have tried to do is limit super heavy dependencies and also separate optional dependencies to streamline things. The quickest install would be `pip install fastplotlib`. This would be if you were interested in just having the barebones (no imgui or notebook) for desktop viz using something like glfw. We can think about adding in our docs some kind of import time metrics.
- kushalkolar 2y agoAlmar did some work on speeding up imports a year ago: https://github.com/fastplotlib/fastplotlib/pull/431 https://github.com/fastplotlib/fastplotlib/pull/431 but we haven't benchmarked it yet
- almarklein 2y agoI have a feeling there's room for improvement for importing Pygfx as well. I think we should indeed strive that simple plots load super-quick.
- 749402826 2y ago"Fast" is a bold claim, given the complete lack of benchmarks and the fact that it's written entirely in Python...
- paddy_m 2y agoI'm certain the host heavy lifting is done by numpy which is a python wrapper around Fortran and C. The visualization heavy lifting is done by pygfx/wgpu-py. wgpu-py has C. I think wgpu-py compiles to WASM to run in the browser. More and more packages are taking this route. [1] https://github.com/pygfx/pygfx https://github.com/pygfx/pygfx [2] https://github.com/pygfx/wgpu-py https://github.com/pygfx/wgpu-py
- almarklein 2y agoAll true, except the bit that wgpu-py compiles to WASM. It's all desktop. In the plans that we do have for running the browser, Fastplotlib, Pygfx and wgpy-py will still be Python, running on CPython that is compiled to WASM (via Pyodide). But instead of wgpu-py cffi-ing into a C library, it would make JS calls to the WebGPU API.
- deleted 2y ago[deleted]
- deleted 2y ago[deleted]
- kushalkolar 2y agoIn fastplotlib at the end of the day everything is wgpu under the hood, and as the other poster correctly pointed out about numpy being fortran and C wrappers.
- Starlord2048 2y ago[flagged]
- dang 2y agoPlease stop.
- klaussilveira 2y agoVery cool to see imgui empowering so many different things.
- fpl-dev 2y agoWe love imgui! Big thanks to the imgui devs, and Pascal Thomet who maintains the python bindings for imgui-bundle, and https://github.com/panxinmiao https://github.com/panxinmiao who made an Imgui Renderer for wgpu-py!
- rossant 2y agoImgui is awesome! Thanks for mentioning imgui-bundle—I hadn’t heard of it before, but it looks great! [1] [1] https://github.com/pthom/imgui_bundle https://github.com/pthom/imgui_bundle
- rossant 2y agoShameless plug: I'm actively working on a similar project, Datoviz [1], a C/C++ library with thin Python bindings (ctypes). It supports both 2D and 3D but is currently less mature and feature-complete than fastplotlib. It is also lower level (high-level capabilities will soon be provided by VisPy 2.0 which will be built on top of Datoviz, among other possible backends). My focus is primarily on raw performance, visual quality, and scalability for large datasets—millions, tens of millions of points, or even more. [1] https://datoviz.org/ https://datoviz.org/
- deleted 2y ago[deleted]
- Spoilage4218 2y agoI have always admired your datoviz library from afar and check the vispy2/vispy2-sandbox libraries on GitHub every few months to check up on it. When do you think 'soon' is?? Really looking forward to it!
- rossant 2y agoThanks! The code is currently managed by Nicolas Rougier in a GitHub repository that will be made public next week. This repository hosts the "graphics server protocol" (GSP), an intermediate layer between Datoviz and the future high-level plotting API. For the latter, we’ll need community feedback to shape an API philosophy that aligns with VisPy users' needs—let's aim to publish a write-up this month. Implementing the API on top of GSP should be relatively straightforward, as the core graphics-related mechanisms are handled by GSP/Datoviz. We've created a Slack channel for discussions—contact me privately if you'd like to join.
- rossant 2y agoI wrote a quick draft outlining the vision here. [1] [1] https://github.com/vispy/vispy2/blob/main/ARCHITECTURE.md https://github.com/vispy/vispy2/blob/main/ARCHITECTURE.md
- cycomanic 2y ago
- qoez 2y ago[flagged]
- kushalkolar 2y agoI dunno why you'd say this, neither of us are fans of LLMs and most of this was written before LLMs were a thing :)
- janalsncm 2y agoMaybe Claude was trained on your code. You should take it as a compliment.
- dang 2y ago"Please don't post shallow dismissals, especially of other people's work. A good critical comment teaches us something." https://news.ycombinator.com/newsguidelines.html https://news.ycombinator.com/newsguidelines.html
- qoez 2y agoI appreciate the warning and if it's not by claude I apologize, but I do think we should be allowed to express scepticism if things posted are just AI slop (and if we have to fear getting banned or what-have-you as a consequence I genuinely think that's worse for HN long term than the alternative).
- 2y ago
- roter 2y agoVery interesting and promising package. I especially like that there is a PyQt interface which might provide an alternative to another great package: pyqtgraph[0]. [0] https://github.com/pyqtgraph/pyqtgraph https://github.com/pyqtgraph/pyqtgraph
- clewis7 2y agoThank you for your interest! We have taken a lot of inspiration from pyqtgraph and really like their library.
- kushalkolar 2y agoThanks! I used pyqtgraph for many years and love what can be done by it, we started off wanting to build something like it but based on WGPU and not bound to Qt.
- unit149 2y ago[dead]
- crazygringo 2y agoSounds really compelling. But it doesn't seem to answer how it works in Jupyter notebooks, or if it does at all. Is the GPU acceleration done "client-side" (JavaScript?) or "server-side" (in the kernel?) or is there an option for both? Because I've used supposedly fast visualization libraries in Google Colab before, but instead of updating at 30 fps, it takes 2 seconds to update after a click, because after the new image is rendered it has to be transmitted via the Jupyter connector and network and that can turn out to be really slow.
- ivoflipse 2y agoFastplotlib definitely works in Jupyterlab through jupyter-rfb https://github.com/vispy/jupyter_rfb https://github.com/vispy/jupyter_rfb I believe the performance is pretty decent, especially if you run the kernel locally Their docs also cover this as mentioned by @clewis7 below: https://www.fastplotlib.org/ver/dev/user_guide/faq.html#what-frameworks-does-fastplotlib-support https://www.fastplotlib.org/ver/dev/user_guide/faq.html#what...
- clewis7 2y agoThanks Ivo!
- kushalkolar 2y agoThanks Ivo! Just to add on, colab is weird and not performant, this PR outlines our attempts to get jupyter-rfb working on colab: https://github.com/vispy/jupyter_rfb/pull/77 https://github.com/vispy/jupyter_rfb/pull/77
- crazygringo 2y agoThanks. Yeah I've been baffled as to why just interactive Matplotlib with a Colab kernel is so slow. The Colab CPU is fast (enough), the network is fast, I haven't been able to figure out where the bottleneck is either.
- 2y ago
- lagrange77 2y agoNice, i'd be interested to know which method for drawing lines (which is hard [0]) it uses. [0] https://mattdesl.svbtle.com/drawing-lines-is-hard https://mattdesl.svbtle.com/drawing-lines-is-hard
- kushalkolar 2y agoAlmar made blog posts about the line shader he wrote! https://almarklein.org/triangletricks.html https://almarklein.org/triangletricks.html https://almarklein.org/line_rendering.html https://almarklein.org/line_rendering.html A big shader refactor was done in this PR: https://github.com/pygfx/pygfx/pull/628 https://github.com/pygfx/pygfx/pull/628
- lagrange77 2y agoThank you!
- juliusbk 2y agoThis looks super cool! Looking forward to trying it. I think a killer feature of these gpu-plotting libraries would be if they could take torch/jax cuda arrays directly and not require a (slow) transfer over cpu.
- kushalkolar 2y agoThanks! That is a great question and one that I've we've been battling with as well. As far as we know, this is not possible due to the way different contexts are set up on the GPU https://github.com/pygfx/pygfx/issues/510 https://github.com/pygfx/pygfx/issues/510 tinygrad which I haven't used seems torch-like and has a WGPU backend: https://github.com/tinygrad/tinygrad https://github.com/tinygrad/tinygrad
- juliusbk 2y agoYeah, I remember looking into it myself as well, and not finding any easy path. A shame.... Maybe there's a hard way to do it though :)
- rossant 2y agoI've been looking into this issue with Datoviz [1] following a user request. It turns out there may be a way to achieve it using Vulkan [2] (which Datoviz is based on) and CuPy's UnownedMemory [3]. I wrote a simple proof of concept using only Vulkan and CuPy. I'm now working on a way for users to wrap a Datoviz GPU buffer as a CuPy array that directly references the Datoviz-managed GPU memory. This should, in principle, enable efficient GPU-based array operations on GPU data without any transfers. [1] https://datoviz.org/ https://datoviz.org/ [2] https://registry.khronos.org/vulkan/specs/latest/man/html/VK_KHR_external_memory_fd.html https://registry.khronos.org/vulkan/specs/latest/man/html/VK... [3] https://docs.cupy.dev/en/latest/reference/generated/cupy.cuda.UnownedMemory.html#cupy.cuda.UnownedMemory https://docs.cupy.dev/en/latest/reference/generated/cupy.cud...
- kushalkolar 2y ago
- deleted 2y ago[deleted]
- trostaft 2y agoLooks very interesting for interactive visualization. I like the animation interface. Also love imgui, glad to see it here. I wish I had better plotting tools for publication quality images (though, honestly I'm pretty happy with matplotlib).
- kushalkolar 2y agoThanks! Yup our focus is not publication figures, matplotlib and seaborn cover that space pretty well.
- 7speter 2y agoI’m not making neuroscience visualizations. I’m working with rather line graphs and would like to animate based on ~10000 points. I’m looking to convert these visuals to video for youtube, in hd and at 60fps using the HEVC/h.265 codec. I took a quick look at the documentation to see if this is possible and I didn’t see anything. Are or will this sort of rendering be supported? I previously tried this on matplotlib and it took 20-30 minutes to make a single rendering because matplotlib only uses a single core on a cpu and doesn’t support gpu acceleration. I also tried Man im, but I couldn’t get an actual video file, and opengl seems to be a bit complicated to work with (I went and worked on other things though I should ask around about the video file output). Anyway, I’m excited about the prospect of a gpu accelerated dataviz tool that utilizes Vulkan, and I hope this library can cover my usecase.
- kushalkolar 2y agoRendering frames and saving them to disk can be done with rendercanvas but we haven't exposed this in fastplotlib yet: https://github.com/pygfx/rendercanvas/issues/49 https://github.com/pygfx/rendercanvas/issues/49
- MortyWaves 2y agoAnother tool that requires precise control over memory layout, bandwidth, performance… using Python.
- rossant 2y ago... using Python... itself leveraging NumPy, C, the GPU...
- Vipitis 2y agoI have watched recordings of your recent representation and decided to finally give it a try last week. My goal is to create some interactive network visualizations - like letting you click/box select nodes and edges to highlight subgraphs which sounds possible with the callbacks and selectors. Haven't had the time to get very far yet, but will gladly contribute an example once I figure something out. Some of the ideas I want to eventually get to is to render shadertoys(interactively?) into a fpl subplot (haven't looked at the code at all, but might be doable), eventually run those interactively in the browser and do the network layout on the GPU with compute shaders (out of scope for fpl).
- kushalkolar 2y agoHi! I've seen some of your work on wgpu-py! Definitely let us know if you need help or have ideas, if you're on the main branch we recently merged a PR that allows events to be bidirectional.
- vibranium 2y agoI’m often working with a windows desktop and a remote Linux box on which I have my data & code. I’d like to plot “locally” on my desktop workstation from the remote host. This usually either means using X11 (slow) or some sort of web-based library like plotly. Does fastplotlib offer any easy solution here?
- kushalkolar 2y agoThis is exactly why we use jupyter-rfb, I often have large datasets on a remote cluster computer and we perform remote rendering. see: https://fastplotlib.org/ver/dev/user_guide/faq.html#what-frameworks-does-fastplotlib-support https://fastplotlib.org/ver/dev/user_guide/faq.html#what-fra...
- aplzr 2y agoI'm in the same boat as the person you replied to, but have zero experience with remote plotting other that doing static plots in in a remote session in the interactive window provided by VS Code's python extension. Would this also work there, or would I have to start using jupyter notebooks?
- kushalkolar 2y agonon-jupyter notebook implementations have their quirks, eventually we hope to make a more universal jupyter-rfb kind of library, perhaps using anywidget. Anywidget is awesome: https://github.com/manzt/anywidget https://github.com/manzt/anywidget People have used fastplotlib and jupyter-rfb in vscode, but it can be troublesome and we don't currently have the resources to figure out exactly why.
- aplzr 2y agoAlright, thanks. I don't particularly like notebook, but this might a reason to give it another go.
- dan-robertson 2y ago
- enriquto 2y agoThat would be preposterous if it wasn't so hilariously false: > These days, having a GPU is practically a prerequisite to doing science, and visualization is no exception. It becomes really funny when they go on to this, as if it was a big deal: > Depicted below is an example of plotting 3 million points Anybody who has ever used C or fortran knows that a modern CPU can easily churn through "3 million points" at more than 30 frames per second, using just one thread. It's not a particularly impressive feat, three million points is the size of a mid-resolution picture, and you can zoom-in and out those trivially in real-time using a CPU (and you could do that 20 years ago, as well). Maybe the stated slowness of fastplotlib comes from the unholy mix of rust and python? Now, besides this rant, I think that fastplotlib is fantastic and, as an (unwilling) user of Python for data science, it's a godsend. It's just that the hype of that website sits wrong in me. All the demos show things that could be done much easier and just as fast when I was a teenager. The big feat, and a really big one at that, is that you can access this sort of performance from python. I love it, in a way, because it makes my life easier now; but it feels like a self-inflicted problem was solved in a very roundabout way.
- cycomanic 2y ago>> Depicted below is an example of plotting 3 million points > Anybody who has ever used C or fortran knows that a modern CPU can easily churn through "3 million points" at more than 30 frames per second, using just one thread. It's not a particularly impressive feat, three million points is the size of a mid-resolution picture, and you can zoom-in and out those trivially in real-time using a CPU (and you could do that 20 years ago, as well). Maybe the stated slowness of fastplotlib comes from the unholy mix of rust and python? That's a misrepresentation though, it's 3 million points in sine waves, e.g. something like 1000 sine waves with e.g. 3000 points in each. If you look at the zoomed in image, the sine waves are spaced significantly, so if you would represent this as an image it would be at least a factor 10 larger. In fact that is likely a significant underestimation, i.e. you need to connect the points inside the sine waves as well. The comparison case would be to take a vector graphics (e.g. svg) with 1000 sine wave lines and open it in a viewer (written in C or Fortran if you want) and try zooming in and out quickly.
- _aleph2c_ 2y agohttps://archive.md/G3wj6 https://archive.md/G3wj6
- zoogeny 2y ago> powered by WGPU, a cross-platform graphics API that targets Vulkan (Linux), Metal (Mac), and DX12 (Windows). The fact that they are using WGPU, which appears to be a Python native implementation of WebGPU, suggests there is an interesting possible extended case. As a few other comments suggest, if one knows that the data is available on a machine in a cluster rather than on the local machine of a user, it might make sense to start up a server, expose a port and pass along the data over http to be rendered in a browser. That would make it shareable across the lab. The limit would be the data bandwidth over http (e.g. for the 3 million point case) but it seems like for simpler cases it would be very useful. That would lead to an interesting exercise of defining a protocol for transferring plot points over http in such a way they could be handed over to a the browser WebGPU interface efficiently. Perhaps even a more efficient representation is possible with some pre-processing on the server side?
- mkl 2y agoWGPU is a Rust thing more than a Python thing.
- zoogeny 2y agoFair, I was looking at the wgpu-py [1] page but only skimmed it. It does indeed look like a wrapper over wgpu-native [2] which is written in Rust. 1. https://github.com/pygfx/wgpu-py https://github.com/pygfx/wgpu-py 2. https://github.com/gfx-rs/wgpu-native https://github.com/gfx-rs/wgpu-native
- almarklein 2y agoTo clarify this a bit, wgpu is a Rust implementation of WebGPU, just like Dawn is a C++ implementation of WebGPU (by Google). Both projects expose a C-api following webgpu.h. wgpu-py Should eventually be able to work with both. (Disclaimer: I'm the author of wgpu-py)
- kushalkolar 2y ago> the data is available on a machine in a cluster rather than on the local machine of a user jupyter-rfb lets you do remote rendering for this, render to a remote frame buffer and send over a jpeg byte stream. We and a number of our scientific users use it like this. https://fastplotlib.org/ver/dev/user_guide/faq.html#what-frameworks-does-fastplotlib-support https://fastplotlib.org/ver/dev/user_guide/faq.html#what-fra... > defining a protocol for transferring plot points This sounds more like GSP, which Cyrille Rossant (who's made some posts here) works on, it has a slightly different kind of use case.
- doright 2y agoSometimes I wish these plotting libraries were more portable beyond Python only. I was looking for something similar for Ruby just a while ago but the install instructions seemed out of date and unsupported on Windows.
- noosphr 2y agoAny sufficiently advanced plotting library with an api that can be called externally becomes indistinguishable from a GUI toolkit: https://www.gnu.org/software/guile/docs/guile-tut/tutorial.html https://www.gnu.org/software/guile/docs/guile-tut/tutorial.h... Not sure if that is the right tutorial, but many years ago in the guile 1.x days I wrote a local visualizer for the data from a particle physics accelerator entirely in Guile and Gnuplot. It was very MVC and used guile as the controller and Gnuplot as the viewer. Was it stupid? Yes. Did it work better than all the other tools I had at the time? Also yes.
- kushalkolar 2y agoI do not know ruby but sometimes that's an opportunity to try and make one which others will also find useful :)
- dcl 2y agoI always thought it was interesting that my modern CPU takes ages to plot 100,000 or so points in R or Python (ggplot2, seaborn, plotnine, etc) and yet somehow my 486DX 50Mhz could pump out all those pixels to play Doom interactively and smoothly.
- sieste 2y agoThis SO thread [1] analyses how much time ggplot spends on various tasks. Not sure if a better GPU integration to produce the visual output would help speed it up significantly. [1] https://stackoverflow.com/questions/73470828/ggplot2-is-slow-where-is-the-bottleneck https://stackoverflow.com/questions/73470828/ggplot2-is-slow...
- kkoncevicius 2y agoFrom R side i think this is mainly because ggplot2 is really really slow. Base R graphics would plot 100,000 points in about 100 milliseconds. x <- rnorm(100000) plot(x) A quick benchmark with writing to a file: x <- rnorm(100000) system.time({ png("file.png") plot(x) dev.off() }) user system elapsed 0.179 0.002 0.180
- stackedinserter 2y agoNobody cares about optimization for relatively big datasets like million points, maybe it's not a very popular use case. Even libraries that do able to render these datasets, do that incorrectly e.g. skip peaks, show black rectangles instead of showing internal distribution of noisy data, etc. I ended up with writing my own tool that's able to show millions of points and never looked back.
- wodenokoto 2y agoHow is it compared to HoloViz?[1] I followed one of their online workshops, and it feels really powerful, although it is a bit confusing which part of it does what (it's basically 6 or 7 projects put together under an umbrella) [1] https://holoviz.org/ https://holoviz.org/
- almarklein 2y agoOne big difference is that Fastplotlib is based on GPU tech, so its capable of rendering much larger datasets interactively.
- unnah 2y agoHow much larger? Holoviz includes the datashader library for GPU-based rendering, and here is an example with 10 million points: https://examples.holoviz.org/gallery/nyc_taxi/nyc_taxi.html https://examples.holoviz.org/gallery/nyc_taxi/nyc_taxi.html
- almarklein 2y agoI don't know Datashader that well, but from what I understand, it generates an image from a set of primitives (e.g. points), and then allows you to interactively inspect that image. It does not re-render the points on every frame like Fastplotlib/Pygfx does. Depending on your GPU, you can render say 1-50 million points smoothly. Also see e.g. https://github.com/pygfx/pygfx/discussions/819 https://github.com/pygfx/pygfx/discussions/819
- kushalkolar 2y agoFastplotlib is very different from bokeh and holoviz, and has different use cases. Bokeh and holoviz send data to a JS front end that draws (to the best of my knowledge), whereas fastplotlib does everything on the python side and uses jupyter_rfb to send a compressed frame buffer when used in jupyter. Fastplotlib also works as a native desktop application in Qt and glfw, which is very different from bokeh/holoviz. Fastplotlib also has higher raw render speed, you can scroll though a 4k video at 60Hz with thousands of extra objects on your desktop which I haven't ever been able to accomplish with bokeh (I haven't tried it in years, not sure if things have changed) The events system is also very different, we try to keep the API to simple function callbacks in fastplotlib. At the end of the day use the best tool for your use case :)
- asterix_pano 2y agoLooks very interesting. Does it allow to plot lines of varying thickness?
- vegabook 2y agoSyntax looks matplotlib-ish so we’re going back to 2003
- jampekka 2y agoI'd prefer even more matplotlib-ish. Don't fix what's not broken. A major reason why other plotting libraries don't take of is use of complicated APIs. But data analysis doesn't need Application Programming Interfaces, it needs User Interfaces.
- fransje26 2y ago> Don't fix what's not broken. I would argue that the Matplotlib syntax is horribly broken (or rather, the Matlab syntax it historically tried to emulate, and had to stick with for better or worse..)
- jampekka 2y agoWhat are your issues with the matplotlib API more specifically?
- fransje26 2y agoComplaining about the inconsistencies of the matplotlib interface is pretty much beating a dead horse by now, and has been done repeatedly and in detail by others. The problems start as soon as you try doing something more than plt.plot(), and you get your first encounter with the maddening interface differences between a single figure plot and a multi-figure plot. And then it spirals out of control from there. There is no denying that a lot of effort was put in the library over the years, with lots of documentation and examples, but my general experience over the 15 years I've been using it is that as soon as you try doing something slightly different than the defaults, it invariably turns out to be a time-consuming, frustrating endeavour, with no guarantees that you'll get the result you want.
- 2y ago
- insane_dreamer 2y agoLooks great--and meets a significant need. I see you have meshes on the roadmap--very much looking forward to testing that for real-time cortex mapping once available. Kudos.
- neomantra 2y agoI'm exploring something akin to this, but focusing on 3D views via mesh shading, also powered by DuckDB. Can you describe your cortex mapping data sources (volumetric? approx number of samples?) and is there any open data to grab? What kinds of visualizations/manipulations you would want or is there an existing product to compare to? Thanks :) EDIT: Confused WGPU with WebGPU, so deleted a sentence.
- kushalkolar 2y agoIn the meantime you can use the rendering engine pygfx to create them directly :)
- anthk 2y agoHere people using tons of GB and VRAM for tasks I just used awk and gnuplot on really underpowered machines. Such as the guys who parsed GB sized texts files ('big data', you know) containing IPs and Cloudflare hosts (due to LaLiga scandal blocking whole CF IP's because some of them they were user for soccer TV broadcasting piracy) by using CUDA and some bullshit, when the same tasks could be done with mawk in less than an hour.
- jarpineh 2y agoThis looks very promising. I'll have to think my visualization cases against new possibilities this enables. I have been intermittently following Rerun, a "robotics-style data visualization" app [1]. Their architecture bears certain similarities [2]. Wgpu in both, egui and imgui, Rust with Python. Rerun's stack does compile to WASM and works in browser. Use cases seem different, but somewhat the same. I don't do scientific nor robotic stuff at all, so no opinions on feasibility of either... [1] https://rerun.io https://rerun.io [2] https://github.com/rerun-io/rerun/blob/main/ARCHITECTURE.md https://github.com/rerun-io/rerun/blob/main/ARCHITECTURE.md