plotly / plotly/plotly.py

plotly doesn't render html for data with long descriptions

Open
#4,806 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P3
Dominant language
Python
Stars
18.8k
Forks
2.8k
Avg merge
16h 26m
Merged PRs (30d)
21

Description

When trying to create a scatter plot with long descriptions (~5k chars), the html file stops running. Unfortunately, the description cannot be shortened. Here's a code snipped that will help reproduce the problem:

import numpy as np
import pandas as pd
import plotly.express as px

embedding2d = # generate np.array with shape: (389000, 2)
x = embedding2d[:, 0]
y = embedding2d[:, 1]
data = pd.DataFrame({
    'x': x,
    'y': y,
    'text': # generate list of 389000 samples with 10k chars each sample
})

# Визуализация с plotly
fig = px.scatter(
    data, x='x', y='y',
    #template='plotly_dark',
    hover_data=['text'],  # Добавляем данные, которые будут отображаться при наведении
    title="2D Vector Visualization with Labels",
)

fig.update_layout(
    width=1520, height=685,
    title_x=0.5
)

fig.show()
fig.write_html('visualization.html') # open browser 

P.s. Changing browser doesn't help. I waited about 20 minutes

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure with the supplied Python snippet, including the large scatter data and long text values, then compare fig.show() with fig.write_html('visualization.html'). Investigate how the generated HTML handles the hover_data payload; done means the resulting HTML opens and renders the plot reliably with long descriptions.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, pandas, plotly, python
Domain
data-visualization, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.