Questions tagged [plotly-python]

Use this tag for questions about the interactive graphing library for Python.

References:

2059 questions
4
votes
0 answers

ignore traces for autoscale button in plotly

import numpy as np import plotly.graph_objects as go …
gizzmole
  • 1,437
  • 18
  • 26
4
votes
0 answers

Plot vertical lines on a facetted histogram with plotly express

I have the following pandas dataframe: import random import pandas as pd random.seed(42) so = pd.DataFrame({'x': random.sample(range(1, 100), 40), 'group': ['a']*10+['b']*10+['c']*10+['d']*10}) from so I calculate the…
quant
  • 4,062
  • 5
  • 29
  • 70
4
votes
1 answer

Setting the size of the plotting area

Let's take a simple example: import plotly.express as px x = ['A', 'B'] y = [10, 20] fig = px.bar(x=x, y=y, color=x) fig.update_layout(autosize=False, width=300, height=300, showlegend=True) fig.show() I set the width ad height to the same value,…
soungalo
  • 1,106
  • 2
  • 19
  • 34
4
votes
1 answer

plot a sankey diagram from timeserie dataframe

I have a dataframeA date Cluster count Users 01/01/2021 ClusterA 10 01/01/2021 ClusterB 10 01/01/2021 ClusterB 9 02/01/2021 ClusterA 14 02/01/2021 ClusterB 10 02/01/2021 ClusterB 5 i want to visualize the…
4
votes
3 answers

Plotly: How to increase the number of colors to assure unique colors for all lines?

I'd to plot a simple line plot but if I have more than 10 variables, plolty use the same color twice, how can I avoid it and always have a new color for a new variable ? import pandas as pd import numpy as np pd.set_option("plotting.backend",…
PJP
  • 51
  • 4
4
votes
1 answer

How to use a boolean switch to update a graph in Dash?

I'm new in Dash. I'm trying to use a daq.BooleanSwitch() like an input to callback a graph. I can display a message but I have troubles with the graph. Does anyone have any advice that can help me? import dash from dash.dependencies import Input,…
ChemaChiles
  • 75
  • 1
  • 4
4
votes
1 answer

Remove color to the right of custom hovercard in Plotly Express

When creating custom hovercards in plotly express via the custom_data/hovertemplate paradigm, the color is shown to the right of it. For example, here shows "blue" just to the right of "a=1". How can I remove the "blue"? import pandas as pd import…
Max Ghenis
  • 14,783
  • 16
  • 84
  • 132
4
votes
1 answer

Plotly/Dash: is it possible to hide tick labels of a secondary y axis?

I'd like to remove the tick labels from my secondary y-axis, while leaving the tick labels from the primary y-axis. fig.add_trace(go.Scatter(x=df.index, y=df['A'], line=dict(color='rgba(255, 255, 0, 0.25)',…
pepe
  • 9,799
  • 25
  • 110
  • 188
4
votes
2 answers

How to plot multiple traces with trendlines?

I'm trying to plot trendlines on multiple traces on scatters in plotly. I'm kind of stumped on how to do it. fig = go.Figure() fig.add_trace(go.Scatter(x=df_df['Circumference (meters)'], y=df_df['Height (meters)'], …
David 54321
  • 568
  • 1
  • 9
  • 23
4
votes
1 answer

Plotly bar chart with dotted or dashed border - How to implement?

I’m trying to create a bar chart like the image below: And I'm almost there, but I'm not finding any reference about setting a border style dashed or dotted; Below is a picture of the chart created by me: I will add a minimal reproducible code…
Leonardo Ferreira
  • 673
  • 1
  • 6
  • 22
4
votes
1 answer

Use button to filter different data in plotly python

I followed the answer from @PythononToast How can I add a button or dropdown in a plot created using Plotly in Python? The plot first generated is correct, but values changed after clicking the drop-down filter. As we can see from the plot he…
Hongyi Chen
  • 43
  • 1
  • 6
4
votes
1 answer

B (billions) instead of G (giga) in python plotly customdata [SI prefix d3]

I have gone through this, this and some other similar posts. They all give the solution in javascript which I am unable to port to python. Help would be appreciated. When I pass a value to customdata which is big enough to be a billion, it shows the…
4
votes
1 answer

Plotly: Show value in hoverlabel instead of percentage in stacked area chart `groupnorm='percent'`

In the image below, the hoverlabel shows the percent proportionate values. I would rather it show the actual value of each continent on that particular date. I am not sure how to make it happen. For clarity, Asia would be 9 instead of 37.5, North…
callmeanythingyouwant
  • 1,789
  • 4
  • 15
  • 40
4
votes
2 answers

Plotly: Turn off modebar for the session

I can turn off the modebar in plotly by passing displayModeBar: False as the value of config in fig.show(), like this- import plotly.express as px df = px.data.stocks() fig = px.line(df, x='date',…
callmeanythingyouwant
  • 1,789
  • 4
  • 15
  • 40
4
votes
1 answer

Plotly How to move x-axis to top and y-axis to the right?

Is there a way to move the Plotly-plot's xtick labels to "top" of the plot and ytick labels to the "right" of the plot? In the above plot, I basically want to move the xtick labels to top, and ytick labels to the right. I know this is not the…
Aman Singh
  • 1,111
  • 3
  • 17
  • 31