plotly-express

Using plotly express px.bar causes a shift in output

Using plotly express px.bar causes a shift in output Question: I am trying to print a bar chart using plotly express (px.bar). It is a yearly set of data from 2015 to 2022 but gets plotted from 2016 to 2023. Not sure why… Code to plot yearly returns. # plotting the yearly % returns fig …

Total answers: 2

How can I combine a scatter plot with a density heatmap?

How can I combine a scatter plot with a density heatmap? Question: I have a series of scatterplots (one example below), but I want to modify it so that the colors of the points in the plot become more red (or "hot") when they are clustered more closely with other points, while points that are …

Total answers: 1

variable with spaces in plotly

variable with spaces in plotly Question: I know it is not ideal to have variable names with spaces. But I am curious if there is a way to do this for plotly in python easily. So this worked for variables without spaces: fig_gender = px.bar( df_gender_grp, y="gender", x="index", color="gender", labels=dict(gender="gender", index="count"), but the same approach …

Total answers: 2

Adding a secondary y axis on heatmap in plotly express python

Adding a secondary y axis on heatmap in plotly express python Question: i would like to add a second y axis to my plotly express heatmap, but unfortunately i can’t do it and just can’t find any infos. already tried stuff like that: Plotly: How to plot on secondary y-Axis with plotly express short code …

Total answers: 1

Python/Plotly: px bar customize hover

Python/Plotly: px bar customize hover Question: Having this dataframe: df_grafico2 = pd.DataFrame(data = { "Usos" : [‘Total’,’BK’,’BI’,’CyL’,’PyA’,’BC’,’VA’,’Resto’,’Total’,’BK’,’BI’,’CyL’,’PyA’,’BC’,’VA’,’Resto’], "Periodo" : [‘Octubre 2021*’,’Octubre 2021*’,’Octubre 2021*’,’Octubre 2021*’,’Octubre 2021*’,’Octubre 2021*’,’Octubre 2021*’,’Octubre 2021*’,’Octubre 2022*’,’Octubre 2022*’,’Octubre 2022*’,’Octubre 2022*’,’Octubre 2022*’,’Octubre 2022*’,’Octubre 2022*’,’Octubre 2022*’], "Dolares" : [5247,869,2227,393,991,606,104,57,6074,996,2334,601,1231,676,202,33] }) I’ve tried this plot: plot_impo_usos = px.histogram(df_grafico2[df_grafico2.Usos != "Total"], x = "Usos", y = "Dolares",color="Periodo", …

Total answers: 2

Why is plotly express so much more performant than plotly graph_objects?

Why is plotly express so much more performant than plotly graph_objects? Question: I’m visualizing a scatterplots with between 400K and 2.5M points. I expectected to need to downsample before visualizing but to see just how much I ran a pilot test with a 400k dataset in plotly express, and the plot popped up quickly, beautifully, …

Total answers: 1

Why is my plotly offline not being embedded in a dominate page?

Why is my plotly offline not being embedded in a dominate page? Question: I am creating a map with plotly.express and creating a html page with dominate I have not had any problem with the dominate part and I can create a separate html page with the map part. My problem is that when I …

Total answers: 1

Continuous Color Scales in Plotly — plotly.express as px, and plotly.graph_objects as go

Continuous Color Scales in Plotly — plotly.express as px, and plotly.graph_objects as go Question: I am trying to control color scale in the px.scatter using color_continuous_scale=’Reds’ using the following code. sca = px.scatter(df_centroid_Coord, x="x", y="y", title="Southern Region Centroids", color=’Ambulance_Treatment_Time’, #hover_name="KnNamn", #hover_data= [‘Ambulance_Treatment_Time’, "TotPop"], log_x=True, size_max=60, color_continuous_scale=’Reds’, range_color=(0.5,2), ) sca.update_traces(marker={‘size’: 4, ‘symbol’: 1}) Output: Then, I …

Total answers: 1

Plotly express colorscale map by absolute value instead of 0-1

Plotly express colorscale map by absolute value instead of 0-1 Question: I have a map of the US and am plotting winning margin in Presidential elections in Plotly Express. I want a winning margin of 0 to be displayed as white and the scale to diverge into red/blue. However, the color_continuous_scale keyword argument takes a …

Total answers: 1

Plotly, mixed px.timeline chart with go.Figure to generate one visual and html file

Plotly, mixed px.timeline chart with go.Figure to generate one visual and html file Question: I hope to create a visual (subplots) with a px.timeline chart and go.Table, basically put the two figures on the same page and generate a html file. Here is the sample data & unfinished code: from plotly.subplots import make_subplots import pandas …

Total answers: 1