Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plotly kde plot with histogram corrupted #5457

Closed
peterlee18 opened this issue Aug 29, 2023 · 0 comments · Fixed by #5464
Closed

plotly kde plot with histogram corrupted #5457

peterlee18 opened this issue Aug 29, 2023 · 0 comments · Fixed by #5464
Labels
type: bug Something isn't correct or isn't working

Comments

@peterlee18
Copy link

Windows 11
panel 1.2.1
plotly 5.16.1
Microsoft Edge - Version 116.0.1938.62 (Official build) (64-bit)

When you switch show_hist to True and then back to False the KDE plot is corrupted and does not revert back to original.

import numpy as np
import panel as pn
import plotly.figure_factory as ff

""" Example 1 """

data = np.random.randn(1000)
group_labels = ["distplot"]


def create_graph(bin_size, show_hist, show_rug, histnorm):
    # create graph
    ctsfig = ff.create_distplot(
        [data],
        group_labels,
        bin_size=bin_size,
        show_hist=show_hist,
        show_rug=show_rug,
        histnorm=histnorm,
    )
    return ctsfig

# widgets
sel_bin_size = pn.widgets.FloatInput(name="bin_size", value=0.5, step=0.1, start=0)
sel_show_hist = pn.widgets.Checkbox(name="show_hist")
sel_show_rug = pn.widgets.Checkbox(name="show_rug")
sel_histnorm = pn.widgets.Select(name="histnorm", options=["probability", "probability density"])

# dashboard
screen = pn.Row(
    pn.Column(
        sel_bin_size,
        sel_show_hist,
        sel_show_rug,
        sel_histnorm,
    ),
    pn.pane.Plotly(
        pn.bind(create_graph, sel_bin_size, sel_show_hist, sel_show_rug, sel_histnorm),
        sizing_mode="stretch_both",
    ),
    sizing_mode="stretch_both",
)

# display
pn.serve(screen)

First screen:

image

Set show_hist to True (tick on)

image

Turn show_hist off (False)

image

The graph when show_hist is off (False) seems now to be permanently corrupted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't correct or isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants