Questions tagged [plotly-python]

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

References:

2059 questions
5
votes
1 answer

Plotly: How to highlight certain periods in a pandas time series with rectangle shapes using a For Loop?

I am trying to highlight timeperiods in Plotly. I seems like the best way is to use Shapes, like this, but in the real world you do not want to add each shape manually like in the example url. I am thinking a for loop is the best solution, but open…
NRVA
  • 507
  • 3
  • 20
5
votes
1 answer

Plotly: How to add quivers to an existing plot?

I'd like to add quivers to an existing figure with plotly (python). But the only peace of documentation I could find either create only one quiver (here) or a brand new figure (there). Here's the example on plotly doc : import plotly.figure_factory…
hulyce
  • 438
  • 3
  • 15
5
votes
1 answer

Plotly: Dodge overlapping points on scatterplot categorical axis

I am trying to use plotly to compare the coefficents of regression models using error bars for the confidence intervals. I used the following code to plot it, using the variable as a categorical y axis in a scatter plot. The problem is that the…
Daniel R
  • 1,954
  • 1
  • 14
  • 21
5
votes
2 answers

add a trace to every facet of a plotly figure

I'd like to add a trace to all facets of a plotly plot. For example, I'd like to add a reference line to each daily facet of a scatterplot of the "tips" dataset showing a 15% tip. However, my attempt below only adds the line to the first…
C8H10N4O2
  • 18,312
  • 8
  • 98
  • 134
5
votes
1 answer

Reverse legend order without changing bar order in plotly express bar plot

I'd like to change the order of the items in the legend of a plotly.express bar plot. For example, I'd like to show Dinner before Lunch on this plot (the current behavior is especially awkward with horizontal bar plots, since the order of the bars…
Max Ghenis
  • 14,783
  • 16
  • 84
  • 132
5
votes
1 answer

Plotly: How to modify hovertemplate of a histogram?

I would like to modify the hovertemplate of a plotly histogram. So far, couldn't find a way to: Round the values given Remove the name of the histograms (here: '2012', '2013') Add a name to indicate what the values represent Desired…
Dana_Miles
  • 399
  • 3
  • 17
5
votes
1 answer

Plotly: How to edit text output based on value retrieved by hovering?

I am using the below code to display x and y values on plotly dash. But then i want to be be able to add a another text field below the "value" textfield. The text field would be called "Category" so that if the y value displayed is: 5k then…
lanny kayz
  • 59
  • 9
5
votes
1 answer

Name or service not known when running a Dash app

My setup is quite straightforward, but it fails to run. I suspect it has to do with the server address (I think it should be https://127.0.0.1:8050) but have no idea how to change that. Any suggestions highly appreciated. - Setup an virtual…
René
  • 4,594
  • 5
  • 23
  • 52
5
votes
1 answer

When does data-dash-is-loading trigger a callback function?

I am trying to show a spinner when a Dash figure is updated using the CSS attribute data-dash-is-loading. I found a working solution but would like to know why my previous approach does not work to get more insight. The structure of the document is…
Joe
  • 6,758
  • 2
  • 26
  • 47
5
votes
2 answers

How to create subplots from each column in a pandas dataframe

I have a dataframe 'df' with 36 columns, these columns are plotted onto a single plotly chart and displayed in html format using the code below. import plotly.offline as py import plotly.io as pio pio.write_html(py.offline.plot([{ 'x':…
Iceberg_Slim
  • 422
  • 6
  • 16
5
votes
1 answer

How to make a copy of a plotly figure object?

How do you copy a plotly figure object in order to make a few changes but keep the same basic structure for other plots? The following raises an Attribute error: Code: fig2=fig1.copy() Error: AttributeError: 'Figure' object has no attribute…
vestland
  • 55,229
  • 37
  • 187
  • 305
5
votes
3 answers

How to assign colors for scatterplot by group?

I'm trying to assign color for each class in my dataframe in plotly, here is my code: X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.33, random_state=42) knn = KNeighborsClassifier(n_neighbors=7) # fitting the…
Alex T
  • 3,529
  • 12
  • 56
  • 105
5
votes
1 answer

Plotly - how to make boxplot without boxes?

I am trying to use plotly in python to create box plots, but I just want the points, not the box, whiskers or anything else. Something like this: Couldn't find a way to do that. The best I could do is set boxpoints='all', but that only displays the…
soungalo
  • 1,106
  • 2
  • 19
  • 34
4
votes
0 answers

Plotly graph is collapsed in Jupyter Lab unless I specify the height

When I try to plot a Plotly graph, the height is set to near 0 or something, because the graph renders collapsed. What I'm seeing: However, if I manually set the graph's height, it renders correctly. How can I get the graphs to render correctly…
oxuser
  • 1,257
  • 2
  • 16
  • 23
4
votes
1 answer

Displaying Dash plot without using Web

I have a large dataset of around 500 parquet files with about 42 million samples. In order to read those files I'm using Dask which does a great job. In order to display them, I downsampled the Dask DataFrame in the most basic way (something like…
Ben
  • 1,737
  • 2
  • 30
  • 61