scatter plots
See original GitHub issueuPlot.Scatter
e.g. https://academy.datawrapper.de/article/65-how-to-create-a-scatter-plot
spatial index via e.g. https://github.com/mourner/kdbush or https://github.com/mourner/flatbush
data format e.g.:
[
[x,y,v,l,x,y,v,l], // series 1
[x,y,v,l,x,y,v,l], // series 2
[x,y,v,l,x,y,v,l], // series 3
]
v
value (size of point/shape)l
label
should use a Path2D shape cache
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:21 (11 by maintainers)
Top Results From Across the Web
A Complete Guide to Scatter Plots - Chartio
A scatter plot (aka scatter chart, scatter graph) uses dots to represent values for two different numeric variables. The position of each dot...
Read more >Scatter (XY) Plots - Math is Fun
A Scatter (XY) Plot has points that show the relationship between two sets of data. In this example, each dot shows one person's...
Read more >Scatter plot - Wikipedia
A scatter plot (also called a scatterplot, scatter graph, scatter chart, scattergram, or scatter diagram) is a type of plot or mathematical diagram...
Read more >Example of direction in scatterplots (video) - Khan Academy
In accounting, scatterplots can be used to see if there is a relationship between to variables, such as money spent of advertising and...
Read more >What is a Scatter Chart? - TIBCO Software
A scatter chart, also called a scatter plot, is a chart that shows the relationship between two variables. They are an incredibly powerful...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
sneak peek
30,000 scatter points (10k per series) in 100ms:
this is without building a spatial point index, which turns out to be a fairly expensive task (~40ms for kdbush).
if the points were square (instead of circles) and pixel-aligned, this would likely run 30-50% faster since there’d be no need for anti-aliasing.
ok, so i optimized point rendering in 12b6beb23d58bfab52c8af052c6e80cd23a267f7, to use a single Path2D.
since i had no baseline for whether 75ms was slow or fast for a 30k point scatter plot. i tried the same with the next-fastest lib (Chart.js 3.0 alpha). spoiler: it’s was never actually 75ms (that’s just JS exec time):
uPlot:
Chart.js 3.0 alpha:
so about 2x as fast for init (but still without building a spatial index). and much faster for series toggle, even with rebuilding all paths. once i cache the Path2D objects, toggle will be faster still (by a lot).
another question is whether the design should accommodate multi-scale scatter plots. these are not very common, but they do exist: