You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Name: plotly
Version: 5.24.1
Summary: An open-source, interactive data visualization library for Python
Home-page: https://plotly.com/python/
Author: Chris P
Author-email: [email protected]
License: MIT
Location: c:\users\benno\appdata\local\programs\python\python39\lib\site-package
s
Requires: packaging, tenacity
Required-by: dash
---
Name: dash
Version: 2.18.2
Summary: A Python framework for building reactive web-apps. Developed by Plotly.
Home-page: https://plotly.com/dash
Author: Chris Parmer
Author-email: [email protected]
License: MIT
Location: c:\users\benno\appdata\local\programs\python\python39\lib\site-package
s
Requires: dash-core-components, dash-html-components, dash-table, Flask, importl
ib-metadata, nest-asyncio, plotly, requests, retrying, setuptools, typing-extens
ions, Werkzeug
Required-by: dash-bootstrap-components, dash_mantine_components
---
Name: dash-core-components
Version: 2.0.0
Summary: Core component suite for Dash
Home-page: UNKNOWN
Author: Chris Parmer <[email protected]>
Author-email: [email protected]
License: MIT
Location: c:\users\benno\appdata\local\programs\python\python39\lib\site-package
s
Requires:
Required-by: dash
---
Name: dash_mantine_components
Version: 0.15.0
Summary: Plotly Dash Components based on Mantine
Home-page: https://github.com/snehilvj/dash-mantine-components
Author: Snehil Vijay <[email protected]>
Author-email: [email protected]
License: MIT
Location: c:\users\benno\appdata\local\programs\python\python39\lib\site-package
s
Requires: dash
Required-by:
Describe the bug
I create a group of histograms with px.histogram() with facet parameter set. I want to display the average so set the histfunc parameter to avg. Specific line copied here.
px.histogram( ... histfunc="avg" ... )
Although I clearly specify the avg parameter, the resulting graph shows count. This can be seen both in the initial graph (below) and with the fact that when histfunc is changed to count, the graph refreshes with identical content.
Full MRE:
import pandas as pd
import numpy as np
repo = "s3://mre-examples/_ab_cleaned.csv"
_ab_ = pd.read_csv(repo)
import plotly.express as px
from plotly.offline import *
metrics_lst = ["converted", "user_journey_flag", "time_on_site", "bounce_rate", "pages_per_sesion"]
colors_lst = ["lightblue", "lightgreen"]
def histogram_facets(metric, nbins=2):
return px.histogram(
_ab_.sort_values(by="group", ascending=False), x=metric, color="group", nbins=nbins, facet_col="hour_segment", facet_col_wrap=3,
category_orders={"hour_segment": ["Middle of night", "Morning", "Lunch", "Afternoon", "Evening", "Night"] },
barmode="group",
histfunc="avg", # this is the finnicky param
color_discrete_sequence=colors_lst,
facet_row_spacing=0.2, facet_col_spacing=0.08
)
histogram_facets(metrics_lst[0])
let me know if this is user error (first time submitting a bug) or if the above code replicates the issue in other environment as well.
The text was updated successfully, but these errors were encountered:
ua-chjb
changed the title
[BUG]
[BUG] px.histogram does not show average when histfunc=avgDec 28, 2024
With environment as follow:
Describe the bug
I create a group of histograms with
px.histogram()
withfacet
parameter set. I want to display the average so set thehistfunc
parameter toavg
. Specific line copied here.px.histogram( ... histfunc="avg" ... )
Although I clearly specify the
avg
parameter, the resulting graph showscount
. This can be seen both in the initial graph (below) and with the fact that whenhistfunc
is changed tocount
, the graph refreshes with identical content.Full MRE:
let me know if this is user error (first time submitting a bug) or if the above code replicates the issue in other environment as well.
The text was updated successfully, but these errors were encountered: