Questions tagged [plotly-python]

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

References:

2059 questions
30
votes
3 answers

Change transparency of fillcolor

I'm trying to change the default color of a fillcolor in Plotly to another transparent one, but when I change the fillcolor it is not transparent anymore. trace = (go.Scatter(x=[30,45],y=[3000,3000], fill='tozeroy', # …
Hans Bambel
  • 806
  • 1
  • 10
  • 20
29
votes
3 answers

How to manually set the color of points in plotly express scatter plots

https://plotly.com/python/line-and-scatter/ has many scatter plot examples, but not a single one showing you how to set all the points' colours within px.scatter: # x and y given as DataFrame columns import plotly.express as px df = px.data.iris() #…
RNs_Ghost
  • 1,687
  • 5
  • 25
  • 39
29
votes
5 answers

Plot multiple figures as subplots

These resources show how to take data from a single Pandas DataFrame and plot different columns subplots on a Plotly graph. I'm interested in creating figures from separate DataFrames and plotting them to the same graph as subplots. Is this possible…
sparrow
  • 10,794
  • 12
  • 54
  • 74
29
votes
2 answers

How to display charts in Spyder

Since November 2015, plotly is Open-Source and available for python. https://plot.ly/javascript/open-source-announcement/ When trying to do some plots offline, these work in iPython Notebook (version 4.0.4) But if I try to run them in Spyder…
Gabriel
  • 3,737
  • 11
  • 30
  • 48
28
votes
4 answers

How to combine scatter and line plots using Plotly Express

Plotly Express has an intuitive way to provide pre-formatted plotly plots with minimal lines of code; sort of how Seaborn does it for matplotlib. It is possible to add traces of plots on Plotly to get a scatter plot on an existing line plot.…
Ébe Isaac
  • 11,563
  • 17
  • 64
  • 97
22
votes
5 answers

Title for colorbar in Plotly Heatmap

This is my code: fig = go.Figure( data=go.Heatmap(z=z_values, y=[str(x) for x in params_1], x=[str(x) for x in params_2]), layout=go.Layout( title="Analysis results", xaxis=dict(title='Diameter'), …
TestGuest
  • 593
  • 1
  • 4
  • 16
22
votes
2 answers

How to add points or markers to line chart using plotly express?

plotly.express is very convenient to produce nice interactive plots. The code below generates a line chart colored by country. Now what I need is to add points to the plot. Does anyone know how I can add points to the line chart? import…
zesla
  • 11,155
  • 16
  • 82
  • 147
22
votes
3 answers

How to add caption & subtitle using plotly method in python

I'm trying to plot a bar chart using plotly and I wanted to add a caption and subtitle.(Here you can take any example of your choice to add caption and subtitle) My code for plotting the bar chart: import plotly.graph_objects as go fig =…
Maddy6
  • 367
  • 1
  • 3
  • 14
20
votes
2 answers

How to change the x-axis and y-axis labels in plotly?

How can I change the x and y-axis labels in plotly because in matplotlib, I can simply use plt.xlabel but I am unable to do that in plotly. By using this code in a dataframe: Date = df[df.Country=="India"].Date New_cases =…
19
votes
5 answers

Plotly: How to add a horizontal line to a line graph?

I made a line graph with the code below and I'm trying to add a horizontal line at y=1. I tried following the instructions on the plotly site but it is still not showing. Does anyone know why? date = can_tot_df.date growth_factor =…
gboge
  • 373
  • 1
  • 2
  • 6
18
votes
1 answer

Set all markers to the same fixed size in Plotly Express scatterplot

I'm looking for a way to set all markers in a Plotly Express scatter plot to the same size. I want to specify that fixed size myself. I know you can use a variable to set as size of the markers (with px.scatter(size='column_name'), but then they…
Sander van den Oord
  • 10,986
  • 5
  • 51
  • 96
18
votes
2 answers

How to give space between two dcc components in Python Dash?

What is the HTML equivalent for   (space) in Dash? html.Div( [ dcc.Input(), dcc.Input() ] )
jsonbourne
  • 915
  • 2
  • 10
  • 17
15
votes
1 answer

How to easily share a sample dataframe using df.to_dict()

Despite the clear guidance on How do I ask a good question? and How to create a Minimal, Reproducible Example, many just seem to ignore to include a reproducible data sample in their question. So what is a practical and easy way to reproduce a data…
vestland
  • 55,229
  • 37
  • 187
  • 305
15
votes
4 answers

Is there a way to start a plot already zoomed on a specific area using plotly?

I have a scatter plot made with plotly (specifically offline plotly with the Python API on a Jupyter Notebook) and as you know, plotly makes it easy for the user to zoom and frame specific areas, but I'd like the plot to start already focussed on a…
theberzi
  • 2,142
  • 3
  • 20
  • 34
14
votes
4 answers

Plotly: How to get the trace color attribute in order to plot selected marker with same color?

I am trying to plot a selected marker for each of my traces in plotly. I would like to assign the same color to marker and line. Is there a way how to get the color attribute of my traces? fig = go.Figure() fig.add_trace(go.Scatter( x=[0, 1, 2,…
Christian
  • 991
  • 2
  • 13
  • 25