plotly.py
plotly.py copied to clipboard
plotly doesn't render html for data with long descriptions
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