Skip to content

plotly_events change plot theme and layout #8

@aloncohen1

Description

@aloncohen1

Once warping a plotly graph with plotly_events it's overwriting the plot's layout (both colors and proportions)

gif creation:

    import pandas as pd
    import streamlit as st
    from streamlit_plotly_events import plotly_events

    df = pd.read_csv('<path_to_file.csv>')
    fig = px.line(df, x='Date, y=f'# of Messages')
    fig['data'][0]['line']['color'] = "#24d366"
    fig.update_layout(title_text='Overall Chat Activity Over Time')
    fig.update_layout(paper_bgcolor="rgba(18,32,43)", plot_bgcolor="rgba(18,32,43)")
    fig.update_layout(hovermode="x")
    fig.update_traces(mode='markers+lines')

When running:
st.plotly_chart(fig, use_container_width=True)
I'm Getting:
image

But when running
selected_points = plotly_events(fig)
I'm Getting:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions