plotly-resampler
plotly-resampler copied to clipboard
[BUG]The plot disappears when I click on a Rank legend for POSIX data
Describe the bug :crayon:
The entire POSIX plot disappears when I click on an individual rank to visualize the data.
Reproducing the bug :mag:
import plotly.graph_objects as go
from dash import Dash, html, dcc
from plotly_resampler import FigureResampler, register_plotly_resampler
import pandas as pd
import numpy as np
import time
df = pd.read_csv('sample-enlarged.csv')
df['mark'] = (df['start'] + df['end']) / 2
df['mark_size'] = (df['end'] - df['start']) / 2
df['rank'] = df['rank'].astype("category")
df['color'] = '#000000'
df.loc[df['operation'] == 'write', 'color'] = 'blue'
df.loc[df['operation'] == 'read', 'color'] = 'red'
df = df.sort_values(by=['mark'])
df['mark'] = df['mark'].interpolate()
df = df[df['api'] == 'POSIX']
register_plotly_resampler(
mode="LTTB",
default_n_shown_samples=500,
)
fig = FigureResampler(go.Figure())
start_time = time.time()
for rank in df["rank"].unique():
df_rank = df[df["rank"] == rank]
df_sample = df_rank.sample(100)
fig.add_trace(
go.Scattergl(
x=df_sample["mark"],
y=df_sample["rank"],
name=f'Rank {rank}',
marker=dict(
color=df_sample["color"].iloc[0],
),
line=dict(
color=df_sample["color"].iloc[0],
),
error_x=dict(
type='data',
symmetric=True,
array=df_sample["mark_size"],
color=df_sample["color"].iloc[0],
visible=True,
thickness=6,
width=0
),
showlegend=True
),
hf_x=df_rank["mark"],
hf_y=df_rank["rank"]
)
end_time = time.time()
print(f"Script runtime: {end_time - start_time:.2f} seconds")
app = Dash(__name__)
app.layout = html.Div(children=[dcc.Graph(id="graph-id", figure=fig)])
fig.register_update_graph_callback(app, "graph-id")
if __name__ == '__main__':
app.run(debug=True)
This is the code that I am currently working with
Expected behavior :wrench:
I expected the plot to only eliminate the rank I clicked on not make the whole plot disappear.
Screenshots :camera_flash:
![]()
When I selected the rank marked in red the entire plot disappeared
Environment information: (please complete the following information)
- OS: Ubuntu 22.04.3
- Python environment:
- Python version: 3.10.12
- plotly-resampler environment: e.g.: Jupyter(lab), Dash web app (which browser): Visual Studio Code, Google Chrome (web browser)
- plotly-resampler version:0.10.0
Additional context Add any other context about the problem here.
@aparajit7, could you share a minimal csv file, similar to sample-enlarged.csv, for which this behavior occurs?
Hello Jonas, I have shared the sample-enlarged.csv here as a Google Drive link. Can you please let me know if you have received it? Thanks, Aparajit sample-enlarged.csv https://drive.google.com/file/d/1-iUpQd5vDXZQLw9ucvAtuy8g2yTyAbKw/view?usp=drive_web
On Thu, Sep 5, 2024 at 7:02 AM Jonas Van Der Donckt < @.***> wrote:
@aparajit7 https://github.com/aparajit7, could you share a minimal csv file, similar to sample-enlarged.csv, for which this behavior occurs?
— Reply to this email directly, view it on GitHub https://github.com/predict-idlab/plotly-resampler/issues/317#issuecomment-2331232124, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALVR5DM5AQFINWMRKZKNHW3ZVA23PAVCNFSM6AAAAABNTITVRCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZRGIZTEMJSGQ . You are receiving this because you were mentioned.Message ID: @.***>
@aparajit7 - The access was denied, so I sent an access request.
Hey Jonas, I have added the access. Can you check it now?
On Fri, Sep 6, 2024 at 5:20 AM Jonas Van Der Donckt < @.***> wrote:
@aparajit7 https://github.com/aparajit7 - The access was denied, so I sent an access request.
— Reply to this email directly, view it on GitHub https://github.com/predict-idlab/plotly-resampler/issues/317#issuecomment-2333631468, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALVR5DNAUJ6HBXALRXFYUQDZVFXUFAVCNFSM6AAAAABNTITVRCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZTGYZTCNBWHA . You are receiving this because you were mentioned.Message ID: @.***>
@aparajit7,
It appears to be related to the error_x attribute. If you leave this out, everything works as expected.
Plotly-Resampler does not (yet) support this attribute.
Hello Jonas, I have tried to disable the error_x attribute but its actually not giving me the required output. Is there a way to use any other attribute or function similar to it so that Plotly-Resampler works without issues while displaying the ranks?
On Mon, Sep 9, 2024 at 3:14 AM Jonas Van Der Donckt < @.***> wrote:
@aparajit7 https://github.com/aparajit7,
It appears to be related to the error_x attribute. If you leave this out, everything works as expected. Plotly-Resampler does not (yet) support this attribute.
— Reply to this email directly, view it on GitHub https://github.com/predict-idlab/plotly-resampler/issues/317#issuecomment-2337310377, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALVR5DOAKWLMQN7ZFOEAOWDZVVDF7AVCNFSM6AAAAABNTITVRCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZXGMYTAMZXG4 . You are receiving this because you were mentioned.Message ID: @.***>
Hello Jonas, I don’t know if you received my previous email but I mentioned that disabling the error_x attribute would not work as it would change the plot completely. So is there any workaround to this? I would appreciate for the help. Thanks!
On Sun, Sep 15, 2024 at 9:20 PM Aparajit Talukdar @.***> wrote:
Hello Jonas, I have tried to disable the error_x attribute but its actually not giving me the required output. Is there a way to use any other attribute or function similar to it so that Plotly-Resampler works without issues while displaying the ranks?
On Mon, Sep 9, 2024 at 3:14 AM Jonas Van Der Donckt < @.***> wrote:
@aparajit7 https://github.com/aparajit7,
It appears to be related to the error_x attribute. If you leave this out, everything works as expected. Plotly-Resampler does not (yet) support this attribute.
— Reply to this email directly, view it on GitHub https://github.com/predict-idlab/plotly-resampler/issues/317#issuecomment-2337310377, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALVR5DOAKWLMQN7ZFOEAOWDZVVDF7AVCNFSM6AAAAABNTITVRCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZXGMYTAMZXG4 . You are receiving this because you were mentioned.Message ID: @.***>