Questions tagged [plotly-python]

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

References:

2059 questions
7
votes
2 answers

Plotly: how to write a text over my Sankey diagram columns?

I've build a Sankey diagram using plotly. I want to name the columns giving each one a column title, like the text in red below: How can I write these column titles?
neves
  • 33,186
  • 27
  • 159
  • 192
7
votes
5 answers

Plotly Express timeline for Gantt Chart with integer xaxis?

I'm using plotly express timeline to produce a Gantt chart following this example: https://medium.com/dev-genius/gantt-charts-in-python-with-plotly-e7213f932f1e It automatically sets the x-axis to use dates but I'd actually like to just use integers…
Rob
  • 1,336
  • 1
  • 15
  • 24
7
votes
2 answers

Plotly: How to assign specific colors for categories?

I have a pandas dataframe of electricity generation mix. So it consists of electricity generation by different fuels. I want to assign a specific color to a specific fuel. In Matplotlib, it is convenient to assign a specific color to a specific…
hbstha123
  • 1,260
  • 11
  • 23
7
votes
1 answer

How to add more contour lines into contourplot using plotly in python?

I drew two contour plots, one by matplotlib and the other by plotly. I want to add more contour lines to the plot. In the case of matplotlib, there was no poblem. But regarding to plotly, I have no idea how to change the number of contour lines.…
Kimshine
  • 79
  • 3
7
votes
1 answer

Plotly: How to create an odd number of subplots?

I want the 5th subplot to be in the centre of the two columns in the third row. (I have tried doing that by adding the domain argument). Here is the code to reproduce it- import pandas as pd import plotly.graph_objects as go from plotly.subplots…
callmeanythingyouwant
  • 1,789
  • 4
  • 15
  • 40
7
votes
1 answer

Plotly: How to show both a normal distribution and a kernel density estimation in a histogram?

For a plotly figure factory distribution plot, the default distribution is kde (kernel density estimation): You can override the default by setting curve = 'normal' to get: But how can you show both kde and the normal curve in the same plot?…
vestland
  • 55,229
  • 37
  • 187
  • 305
7
votes
1 answer

How to create a vertical scroll bar with Plotly?

I would like to create a vertical scroll for a line chart in Plotly. For visualisation, the vertical scroll is something depicted in the figure below. Assume, we have 6 line chart as below, then how can we create a vertical scroll bar on the…
mpx
  • 3,081
  • 2
  • 26
  • 56
7
votes
2 answers

Set dpi with plotly

I know that savefig has an option dpi. but if I make plots with plotly and write image I don't have an option to set dpi. How can I set dpi with plotly? TypeError: write_image() got an unexpected keyword argument 'dpi'
Noob Programmer
  • 698
  • 2
  • 6
  • 22
7
votes
1 answer

Dropdown menu for Plotly Choropleth Map Plots

I am trying to create choropleth maps. Below is an example that works: df = px.data.gapminder().query("year==2007") fig = go.Figure(data=go.Choropleth( locations=happy['iso'], # Spatial coordinates z = happy['Happiness'].astype(float), #…
TYL
  • 1,577
  • 20
  • 33
7
votes
3 answers

Plotly: How to specify colors for a group using go.Bar?

How to use plotly.graph_objs to plot pandas data in a similar way to plotly.express - specifically to color various data types? The plotly express functionality to group data types based on a value in a pandas column is really useful. Unfortunately…
ceharep
  • 419
  • 1
  • 5
  • 12
7
votes
1 answer

Plotly: How to create sunburst subplot using graph_objects?

my dataframe looks something like this: user age gender 0 23 12 male 1 24 13 male 2 25 15 female 3 26 20 male 4 27 21 male and using px.sunburst(df, path=["gender", "age"]) gives me…
haneulkim
  • 4,406
  • 9
  • 38
  • 80
7
votes
2 answers

Plotly: How to plot rectangle with gradient color in Plotly?

Can a shape such as a rectangle have a smooth color gradient in Plotly? I define the shape with a solid fill color as: shapes=[dict( type='rect', xref='x', yref='paper', x0=box_from, x1=box_to, y0=0, y1=1, fillcolor='Green', …
David Parks
  • 30,789
  • 47
  • 185
  • 328
7
votes
1 answer

Plotly.io doesn't see the psutil package even though it's installed

I'm trying to execute the following code: import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib %matplotlib inline import seaborn as sns import plotly.graph_objects as go from plotly.offline import…
Gigikalo
  • 191
  • 2
  • 6
7
votes
0 answers

Is there a way to change the text alignment in Plotly Sankey diagram?

I am trying to change the orientation of the node label to be left of the node and in the white space for better readability, similar to how the 'C' labels are aligned. import plotly.graph_objects as go fig = go.Figure(data=[go.Sankey( node…
7
votes
1 answer

prevent camera resetting after plotting with Plotly-python

I am trying to plot some data for a 3d Quiver or Cone using dash and plotly and I want to update the Graph periodically through an interval Input! So I managed to animate the graph but the problem is that the camera angle and zoom keep resetting…
Iheb Saidani
  • 81
  • 1
  • 4