Questions tagged [plotly-python]

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

References:

2059 questions
4
votes
1 answer

Import error in plotly while using FigureWidget

I am trying to use run the following commands in Jupyter notebook : import ipywidgets import plotly.graph_objs as go print(ipywidgets.__version__) f = go.FigureWidget() f I am getting the following error ImportError: Please install…
4
votes
1 answer

Plotly: How to specify categorical x-axis elements in a plotly express animation?

I have the following data. I am using a slider, so that I can slide through the different dates (please see the picture below to see what a slider is in case). Now, as my category may change between the dates I want to initialize my x-axis range…
colla
  • 717
  • 1
  • 10
  • 22
4
votes
2 answers

How to enlarge geographic map in Python/Plotly choropleth plot?

I am making a choropleth plot with Plotly. But, the geographic map looking to small. like that: My code is here: fig = px.choropleth(df, geojson=geojson, locations="Capitalize", …
ryilkici
  • 83
  • 2
  • 6
4
votes
1 answer

Animated plot with `plotly`

I'd like to plot a convergence process of the MLE algorithm with the plotly library. Requirements: the points have to be colored colored in the colors of the clusters, and change accordingly each iteration the centroids of the clusters should be…
Michael
  • 2,167
  • 5
  • 23
  • 38
4
votes
1 answer

Plotly mpl_to_plotly error: 'Spine' object has no attribute 'is_frame_like'

I have a matplotlib figure that I want to convert to plotly import matplotlib.pyplot as plt from plotly.tools import mpl_to_plotly fig = plt.figure() ## Lots of code to create my figure ## plotly_fig = mpl_to_plotly(fig) The error I get is…
4
votes
2 answers

figure text label not working in line chart plotly python

I am trying to create a line charts with text labels on the chart itself but it is not working. It is working perfectly fine in scatter plot with the text parameter which you can see below. code - import plotly.express as px fig =…
bhola prasad
  • 675
  • 7
  • 22
4
votes
1 answer

plotly treemap element with “href” not working with local relative html paths

I have simple table with href inside the text. The href points to relative path of local html file. But clicking on it doesn't open the page. is there any way to do that/ good workaround? The folder structure is following. As the root will be…
Oli
  • 1,313
  • 14
  • 31
4
votes
1 answer

plotly: List of valid country names from ISO-3 code

In Python, I'm plotting a choropleth with some data for some countries in Africa: countries = ['BDI', 'BEN', 'BFA', 'BWA', 'CIV', 'CMR', 'COD', 'CPV', 'ETH', 'GHA', 'GIN', 'GMB', 'KEN', 'LBR', 'LSO', 'MDG', 'MLI', 'MOZ', 'MUS', 'MWI', 'NER', 'NGA',…
Chris Browne
  • 449
  • 5
  • 14
4
votes
0 answers

Plotly Chart-Studio config question to change Modebar in Python

I've created a simple Plotly chart in Python, and I can change the Modebar options quite easily. However, when I'm trying to publish the same chart to Chart-Studio, not all the Modebar configurations are working. Any ideas? Here is the code: import…
fazistinho_
  • 195
  • 1
  • 11
4
votes
1 answer

Update plotly chart in jupyter notebook

I'm creating a plotly chart in jupyter notebook. Because I'm testing some algorithm I want to add data after the initial fig2.show(). But when I update the data and call fig2.show again a new chart is being rendered. How can I update the chart…
Matthias Herrmann
  • 2,650
  • 5
  • 32
  • 66
4
votes
1 answer

How to fix: The children property of a component is a list of lists, instead of just a list with Plotly-dash in Python

I am trying to build a simple web dashboard with plotly and dash. Here is the structure I am trying to get: app = dash.Dash(__name__) def Build_home_page(): """ build_welcome_banner [summary] [extended_summary] Returns …
JA-pythonista
  • 1,225
  • 1
  • 21
  • 44
4
votes
1 answer

Enable wheel zoom on embedded plotly chart

I would like to embed a chart exported to chart studio, and be able to use mouse wheel to zoom in the chart (which is the most convenient way when it comes to maps). However, no matter which option I use when I export my chart (iframe, html), once…
Hugolmn
  • 1,530
  • 1
  • 7
  • 20
4
votes
2 answers

Explicitly set colours of the boxplot in ploltly

I am using plotly express to plot boxplot as shown below: px.box(data_frame=df, y="price", x="products", points="all") However, the boxpots of the products shown up with the same colours. They are four products. I would like…
JA-pythonista
  • 1,225
  • 1
  • 21
  • 44
4
votes
3 answers

Plotly Express: How to add comma separators for thousands on data labels

I'm using the px.bar() function in Plotly Express to create some simple bar charts. My code is as follows: import plotly.express as px import pandas as pd test_df = pd.DataFrame({'Manufacturer':['Ford', 'Ford', 'Mercedes', 'BMW', 'Ford',…
equanimity
  • 2,371
  • 3
  • 29
  • 53
4
votes
1 answer

Python plotly - add horizontal line to legend

I would like to add a horizontal line to the below charts so it will appear in the legend as well. The goal is to allow to make the line appear\disappear per user choice by clicking on the legend. Any ideas? import plotly.graph_objects as go tips…
user9185511
  • 724
  • 1
  • 8
  • 18