Questions tagged [plotly-python]

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

References:

2059 questions
10
votes
2 answers

Plotly: How to set marker symbol shapes for multiple traces using plotly express?

I have been trying to change the marker shape in plotly scatter plot but I can't seem to find the correct options. The plotly document goes over the size and opacity, but not the marker shape. Here's my sample code- import pandas as pd import…
Deepak
  • 163
  • 1
  • 1
  • 8
10
votes
4 answers

plotly automatic zooming for "Mapbox maps"

In the plotly website Map Configuration and Styling in Python is described how to automatically zoom a "Geo map": import plotly.express as px fig = px.line_geo(lat=[0,15,20,35], lon=[5,10,25,30]) # Creates a "Geo map"…
Antonio Ramírez
  • 174
  • 1
  • 2
  • 10
10
votes
1 answer

Displaying Images when hovering over point in Plotly scatter plot in python

I am trying to plot something similar to the gif below using plotly, where an image is displayed when hovering on a point in the scatter plot, but I just don't know where to start. Is it even possible to use plotly or will I have to use Bokeh?
A Merii
  • 574
  • 9
  • 21
10
votes
3 answers

Plotly shows blank graphs in AWS Sagemaker JupyterLab

Background: I am new to the Python world and am using Plotly for creating basic graphs in Python. I am using AWS Sagemaker's JupyterLab for creating the python scripts. Issue: I have been trying to run the basic codes mentioned on Plotly's website…
10
votes
0 answers

Plotly displaying sad 'fail' face instead of output

I'm using plotly==4.5.1 in a jupyter==1.0.0 notebook, python==3.7.4. The same piece of code which previous showed this: Is now showing this, without having had any modifications: Does anyone have any insights over why this might be? Is it…
Ian
  • 3,605
  • 4
  • 31
  • 66
10
votes
2 answers

Plotly: How to combine make_subplots() and ff.create_distplot()?

Creating multiple subplots using plotly is both easy and elegant. Consider the following example that plots two series from a dataframe side by side: Plot: Code: # imports from plotly.subplots import make_subplots import plotly.figure_factory as…
vestland
  • 55,229
  • 37
  • 187
  • 305
10
votes
1 answer

How to add a colorbar to an already existing plotly figure?

I have the following graph whose data (the position and the color values) come from an external source: import plotly.graph_objs as go from plotly.offline import init_notebook_mode, iplot data = go.Scatter({ 'hoverinfo': 'text', 'marker':…
Kristada673
  • 3,512
  • 6
  • 39
  • 93
10
votes
1 answer

Plotly: How to add custom legend

I've made a plot, and I want to add a legend with some text in it. Old link (now broken) https://plot.ly/~smirnod1/4/roc-curve/ Edited link to similar plot: https://plot.ly/~wonglynn2004/44/roc-plot-and-area-under-curve/#/code Here is one example -…
Dmitry Smirnov
  • 462
  • 8
  • 22
9
votes
2 answers

How to use Polars with Plotly without converting to Pandas?

I would like to replace Pandas with Polars but I was not able to find out how to use Polars with Plotly without converting to Pandas. I wonder if there is a way to completely cut Pandas out of the process. Consider the following test data: import…
fabioklr
  • 430
  • 1
  • 5
  • 13
9
votes
4 answers

Plotly: How to round display text in annotated heatmap but keep full format on hover?

I am drawing a correlation matrix of the Titanic dataset. df_corr = df.corr() Originally, the matrix looks like this: fig = ff.create_annotated_heatmap( z=df_corr.to_numpy(), x=df_corr.columns.tolist(), …
Haha TTpro
  • 5,137
  • 6
  • 45
  • 71
9
votes
1 answer

ImportError: Plotly express requires pandas to be installed

When I try to import plotly.express I get the error: ImportError: Plotly express requires pandas to be installed. The installation notes did not mention having to install anything additional. I can import plotly on its own, I only get the error…
Pzet
  • 470
  • 2
  • 4
  • 11
9
votes
1 answer

Plotly / How to change the default color pallete in Plotly?

I was able to force the default theme using import plotly.io as pio pio.templates.default = 'plotly_white' But I am struggling to set a default color palette. Any ideas how to change this? Thanks
Francisco Vigo
  • 101
  • 1
  • 3
9
votes
1 answer

plotly: How to add text to existing figure?

Is it possible to add some text on the same html file as my plotly graph? For example : This is the code that generates a graph : data = pd.read_csv('file.csv') data.columns = ['price', 'place', 'date'] fig = px.scatter(data, x = "place", y =…
lolaa
  • 181
  • 1
  • 4
  • 11
9
votes
1 answer

How to add Planes in a 3D Scatter Plot

Using Blender created this model that can be seen in A-frame in this link This model is great and it gives an overview of what I'm trying to accomplish here. Basically, instead of having the names, I'd have dots that symbolize one specific…
9
votes
6 answers

Plotly: How to remove empty dates from x axis?

I have a Dataframe Date Category Sum 0 2019-06-03 "25M" 34 1 2019-06-03 "25M" 60 2 2019-06-03 "50M" 23 3 2019-06-04 "25M" 67 4 2019-06-05 "50M" -90 5 2019-06-05 "50M" 100 6 2019-06-06…
Amit
  • 763
  • 1
  • 5
  • 14