question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Interactive chart slow with large number of data points

See original GitHub issue

When I create an interactive scatter plot where some text element is displayed on mouseover, I’ve noticed that this becomes unusably slow if the data points go into the thousands. If I take the example from here, then all is nice on the 400 data points from the cars package, but if I increase the number of data points to 4000, then things get very slow, and with 20000 (the size of my data set), it becomes much worse:

cars = alt.load_dataset("cars")
cars = pd.concat([cars]*10)
cars["Horsepower"] = cars["Horsepower"].sample(frac=1).reset_index()

pointer = alt.selection_single(on='mouseover', nearest=True, empty='none')

base = alt.Chart().encode(
    x='Miles_per_Gallon', y='Horsepower'
)

chart = alt.layer(
    base.mark_point().properties(selection=pointer).encode(color='Origin'),
    base.mark_text(dx=8, dy=3, align='left').encode(
    text=alt.condition(pointer, 'Name', alt.value(''))
    ),
    data=cars
)

chart

(It does not necessarily make all that much sense to have 20k data points that can be hovered over for more information, but I’m wondering whether there’s a way to speed this up or if it will generally be a slow.)

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:17 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
jakevdpcommented, Jun 8, 2018

OK, I’ve implemented chart.display(renderer='svg') in #925

1reaction
jakevdpcommented, May 29, 2018

Not all frontends support it yet, but you can pass renderer metadata via the renderers registry… for example:

alt.renderers.enable(renderer_name, embed_options={'renderer': 'svg'})

where renderer_name is jupyterlab, notebook, colab, etc.

I plan to document this better once the next version of JupyterLab is released, because the current release ignores any metadata.

Read more comments on GitHub >

github_iconTop Results From Across the Web

excel drawing charts with large data sets is very slow
excel drawing charts with large data sets is very slow. It appears to be from the chart design trying to show a better...
Read more >
There's no hard limit, but things will slow down past ... - Plotly
There's no hard limit, but things will slow down past around 1000 points for some chart types. scatter, line, scatter_polar and line_polar ...
Read more >
slow in chart display - Highcharts official support forum
Hello, I have trouble in the efficiency of chart display. I have 8 curves with 4000 points per curve. I just made one...
Read more >
Offline plotting in python is very slow on big data sets
When generating huge amount of data (50 Hz IMU data, can be full day) I got few issues. 1. Generation time is way...
Read more >
plotly: huge number of datapoints - Stack Overflow
(2) Trying using the image API to return an image instead of a graph URL (3) Use matplotlib (4) See if you can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found