Questions tagged [plotly-python]

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

References:

2059 questions
9
votes
1 answer

Plotly: How to show legend in single-trace scatterplot with plotly express?

Sorry beforehand for the long post. I'm new to python and to plotly, so please bear with me. I'm trying to make a scatterplot with a trendline to show me the legend of the plot including the regression parameters but for some reason I can't…
9
votes
1 answer

Plotly: How to set node positions in a Sankey Diagram?

The sample data is as follows: unique_list = ['home0', 'page_a0', 'page_b0', 'page_a1', 'page_b1', 'page_c1', 'page_b2', 'page_a2', 'page_c2', 'page_c3'] sources = [0, 0, 1, 2, 2, 3, 3, 4, 4, 7, 6] targets = [3, 4, 4, 3, 5, 6, 8, 7,…
bbd108
  • 958
  • 2
  • 10
  • 26
9
votes
2 answers

Plotly: How to add elements to hover_data using plotly.express piechart?

I am playing with examples from plotly.express piechart help page and trying to add an extra element iso_num to the hover_data property (iso_num is an int64 column in the gapminder dataframe) import plotly.express as px df =…
ambushed
  • 533
  • 1
  • 5
  • 14
9
votes
2 answers

order bars in bar chart by value in descending order with plotly-express

I need to make a plotly bar chart with bars ordered by value in descending order. I first order the dataframe by value in descending order. Then I use plotly.express to generate interactive bar chart. However, I found the bars are still in ascending…
zesla
  • 11,155
  • 16
  • 82
  • 147
8
votes
1 answer

Can I save a high resolution image of my plotly scatter plot?

Can I set a parameter for plotly.graph_objs.go.Scatter3d to either make the graph full screen or to set the save resolution higher? The current resolution that is being saved when using the built in save plot function is 983x525. I would like to at…
rzaratx
  • 756
  • 3
  • 9
  • 29
8
votes
1 answer

Plotly: How to display graph after clicking a button?

I want to use plotly to display a graph only after a button is clicked but am not sure how to make this work. My figure is stored in the following code bit fig1 = go.Figure(data=plot_data, layout=plot_layout) I then define my app layout with…
Denise
  • 153
  • 3
  • 15
8
votes
1 answer

How to create a title with a newline for a chart in plotly

I need to create a plot on plotly with a newline. Preferably the text on the top is larger than the second line, but not necessary. fig.update_layout( title=go.layout.Title( text=title, xref="paper", x=0.5, ), For…
8
votes
1 answer

How to update plotly express treemap to have both label as well as the value inside the plot?

Currently, plotly express treemap shows only label inside treemap. How to include the value alongside the label?
imdevskp
  • 2,103
  • 2
  • 9
  • 23
8
votes
1 answer

How to style/format point markers in Plotly 3D scatterplot?

I am unsure how to customize scatterplot marker styles in Plotly scatterplots. Specifically, I have a column predictions that is 0 or 1 (1 represents an unexpected value) and even though I used the symbol parameter in px.scatter_3d to indicate the…
Jane Sully
  • 3,137
  • 10
  • 48
  • 87
7
votes
3 answers

Plotly imshow reversing y labels reverses the image

I'd like to visualize a 20x20 matrix, where top left point is (-10, 9) and lower right point is (9, -10). So the x is increasing from left to right and y is decreasing from top to bottom. So my idea was to pass x labels as a list: [-10, -9 ... 9, 9]…
Ebrin
  • 179
  • 8
7
votes
1 answer

Plotly Sunburst chart with percentages

I would like to create a Sunburst chart, corresponding to the following: Where: B is 70% of A C is 20% of B D is 50% of B I looked at the plotly documentation but the examples provided only used either use a dataset or a values argument which I…
Eccsx
  • 185
  • 2
  • 13
7
votes
0 answers

How to create sankey diagram with gradient color links in Plotly?

Is there a way to make the links in a Plotly Sankey diagram have a color gradient between the source node color and the end node color? This image is taken from a page linked by the Plotly documentation. I have seen some discussion on GitHub about…
Nick_2440
  • 75
  • 1
  • 13
7
votes
6 answers

Unable to export plotly images to png with Kaleido

I have never used plotly before, and I have been trying to export a sample image code to png. I have installed plotly and kaleido and ran the code on python 3, but nothing happens. #Here is the code: import plotly.express as px import numpy as np …
Karol Duarte
  • 123
  • 1
  • 1
  • 8
7
votes
2 answers

How to create discrete colormap with n colors using Plotly

I would like to create a colormap with n colors for a plotly express plot in Python, which should fade from one color into another. All the default colormaps only have 10 discrete values, but I am looking for a colormap with n > 10 discrete…
N8_Coder
  • 713
  • 3
  • 10
  • 20
7
votes
1 answer

Plotly: Remove `trace0` by default

This is not a duplicate of this. Adding the makes sure the trace# is removed from the graph. But is there a way I could make that the default setting? I am creating a custom plotly theme and would like it to be the default setting,…
callmeanythingyouwant
  • 1,789
  • 4
  • 15
  • 40