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?
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…
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…
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.…
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…
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?…
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…
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'
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), #…
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…
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…
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',
…
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…
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…
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…