Questions tagged [plotly-python]

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

References:

2059 questions
4
votes
1 answer

Consistent and Reproducable Axes Spacing

I am trying to create a gif made out of plotly graphs. And this works surprisingly well! The only problem I’m having, is that I haven’t found the correct setting for fixing the stretching of the axes. So far, I was able to create this gif (I cannot…
d3lt4_papa
  • 43
  • 4
4
votes
1 answer

How to adjust Plotly Express lowess trendline parameters?

The Plotly express lowess trendline is providing a very poor fit. In some situations, it works well but with this particular data, it is does not. When I make the lowess trendline using statsmodels.nonparametric.smoothers_lowess.lowess() I get a…
GitHunter0
  • 424
  • 6
  • 10
4
votes
2 answers

Plotly: Markers disappear when (n) points are plotted

Okay, so my initial idea is to make a line plot in plotly and color the line with one color after certain threshold t, and another color before the threshold. It works for a 23 or less points, but it works with no more, using this method: import…
Petar
  • 195
  • 2
  • 14
4
votes
3 answers

How to change titles (facet_col )in imshow (plotly)

I want to plot several images with imshow from plotly and give each image a title. My code is fig = px.imshow(numpy.array(img1,img2), color_continuous_scale='gray', facet_col=0, labels={'facet_col' :…
DerJFK
  • 311
  • 2
  • 15
4
votes
1 answer

Plotly: How to change the colour scheme of a 3D surface plot?

I want to change the colour scheme of the 3D surface plot in the plotly python. Plotly assigns the colour scheme by default as shown in figure below. Here is my code import import plotly.graph_objects as go import pandas as pd data =…
Asif Marazi
  • 127
  • 2
  • 11
4
votes
1 answer

How to change x-tick labels to custom labels, in plotly figure

Using Plotly I want to change the xticks labels to custom labels. (Something like 'Area1', 'Area2', 'Area3'....) Where and how I need to add the code? Currently, it is taking the xtick labels directly from the dataframe. Following is the code for…
4
votes
1 answer

Blank 3D Plotly Scatter Plot

import plotly.graph_objects as go import numpy as np import numpy # Download data set from plotly repo pts = np.loadtxt(np.DataSource().open('https://raw.githubusercontent.com/plotly/datasets/master/mesh_dataset.txt')) x, y, z = pts.T US = [(1970,…
4
votes
2 answers

Adding percentage of count to a stacked bar chart in plotly

Given the following chart created in plotly. I want to add the percentage values of each count for M and F categories inside each block. The code used to generate this plot. arr = np.array([ ['Dog', 'M'], ['Dog', 'M'], ['Dog', 'F'], ['Dog',…
4
votes
1 answer

Plotly: How to find and annotate the intersection point between two lines?

I am trying to find and annotate the intersection point of two-line using Plotly. I know we can use (plt.plot(*intersection.xy,'ko')) to get the intersection point in Mathplotlib, but how can do it in plotly or if it can be done. import numpy as…
4
votes
3 answers

Retain original bar order in Plotly Python when also passing color

Using Plotly for a bar plot preserves the dataset's order when not using color: import pandas as pd import plotly.express as px df = pd.DataFrame({'val': [1, 2, 3], 'type': ['b', 'a', 'b']}, index=['obs1',…
Max Ghenis
  • 14,783
  • 16
  • 84
  • 132
4
votes
2 answers

Unable to plot Plotly - saying value of 'x' is not the name of a column

I am trying to plot this time-series chart (a RSI chart of a few stock tickers). However, I cannot seem to get Plotly to chart at all! And it throws me the error below: Value of 'x' is not the name of a column in 'data_frame'. Expected one of…
themarsguy
  • 47
  • 1
  • 1
  • 3
4
votes
1 answer

Plotly: How to plot a range with a line in the center using a datetime index?

I would like to plot a line with a range around it, like on this photo: I posted an original question, but didn't specify the index being a datetime index. I thought it wouldn't be important, but I was wrong. There is an answer that covers it with…
Thomas
  • 10,933
  • 14
  • 65
  • 136
4
votes
1 answer

How can I change the python plotly figure id?

Is there a way to change the id of a plotly figure in python? For example if I run this code taken from the plotly webpage: import plotly.graph_objects as go fig = go.Figure() config = dict({'scrollZoom': True}) fig.add_trace( go.Scatter( …
drcrisp
  • 193
  • 6
4
votes
1 answer

Python Plotly - how to add multiple colors to each trace from a unique Scattergeo object?

I'm developing a dashboard application using dash/plotly in Python. I need to build a map with more than 1000 traces. Because of performance issues, I'm trying to use one single Scattergeo object, but, ordinarily, it does not provide a way to plot…
rmmariano
  • 896
  • 1
  • 18
  • 32
4
votes
1 answer

How to persist state of plotly graph in Dash App

I have a multi-tab, subtabs dash application. I'd like to be able to save/persist the state of the components in different subtabs when switching between them. These components are dropdown, input, graph, slider, daterange etc. I use the persistence…
kms
  • 1,810
  • 1
  • 41
  • 92