Questions tagged [plotly]

Plotly.js is an open source, high-level, declarative charting library, built on top of d3.js and stack.gl. It ships with over 40 chart types, including 3D charts, statistical graphs, and SVG maps. Use [r-plotly] for the R package and [plotly-python] for the Python package.

You can use Plotly to import and analyze data, create beautiful, interactive, browser-based graphs, and then collaborate on your graphs with others. Plotly also has a Python sandbox (NumPy supported), and has APIs for Python, R, MATLAB, Arduino, Julia, Perl, and REST.

You can see more in the gallery.

enter image description here

Resources

13887 questions
94
votes
12 answers

Plotly chart not showing in Jupyter notebook

I have been trying to solve this issue for hours. I followed the steps on the Plotly website and the chart still doesn't show in the notebook. This is my code for the plot: colorway = ['#f3cec9', '#e7a4b6', '#cd7eaf', '#a262a9', '#6f4d96',…
Guillermina
  • 3,127
  • 3
  • 15
  • 24
90
votes
1 answer

Flex items not shrinking when window gets smaller

I'm trying to fit two plotly plots next to each other inside a CSS flexbox. I want them to resize when the window is resized. It works as expected when the window grows, but the plots don't shrink when the window gets smaller. var trace1 =…
Alexander Schlüter
  • 1,089
  • 1
  • 8
  • 7
85
votes
2 answers

Setting Background color to transparent in Plotly plots

My python code creates a plotly bar plot, but the background is white in color. I want to change it into transparent color. Is that doable? My Code: import plotly.plotly as py from plotly.graph_objs import * py.sign_in('username', 'api_key') data =…
The6thSense
  • 8,103
  • 8
  • 31
  • 65
75
votes
2 answers

How to set the range of the y axis

I have the following code to create the line plot with Plotly. How can I set the range of Y axis to always have it in [0; 10]? layout = go.Layout( title=go.layout.Title( text="Test", xref='paper', x=0 …
Tatik
  • 1,107
  • 1
  • 9
  • 17
75
votes
14 answers

save plotly plot to local file and insert into html

I am using python and plotly to product interactive html report. This post gives a nice framework. If I produce the plot(via plotly) online, and insert the url into the html file, it works but refreshing the charts takes a long time. I wonder if I…
cone001
  • 1,143
  • 3
  • 13
  • 15
71
votes
8 answers

ValueError: Mime type rendering requires nbformat>=4.2.0 but it is not installed

I was trying to print a plotly plot in Visual Studio Code and caught this error: --------------------------------------------------------------------------- ValueError Traceback (most recent call…
nilsinelabore
  • 4,143
  • 17
  • 65
  • 122
66
votes
2 answers

TypeError: Object of type 'DataFrame' is not JSON serializable

I'm trying to create a plotly graph with some data I've got from my PostgreSQL server, but when I try to graph I'm getting an error: "TypeError: Object of type 'DataFrame' is not JSON serializable" Here's the code so far: import dash import numpy as…
peolss
  • 663
  • 1
  • 5
  • 5
59
votes
4 answers

TypeError: load() missing 1 required positional argument: 'Loader' in Google Colab

I am trying to do a regular import in Google Colab. This import worked up until now. If I try: import plotly.express as px or import pingouin as pg I get an…
user17147261
  • 1,131
  • 1
  • 4
  • 8
58
votes
4 answers

How to choose variable to display in tooltip when using ggplotly?

I have a simple data frame: seq <- 1:10 name <- c(paste0("company",1:10)) value <- c(250,125,50,40,40,30,20,20,10,10) d <- data.frame(seq,name,value) And I want to plot it this way: require(ggplot2) ggplot(data = d,aes(x=seq,y=value))+geom_line() +…
Malta
  • 1,883
  • 3
  • 17
  • 30
57
votes
1 answer

How to change plotly figure size

I have made a scatter plot using matplotlib and Plotly. I want the height, width and the markers to be scatter as in matplotlib plot. Please see the attached plots. I used the following code in Plotly import plotly import plotly.plotly as py from…
hemanta
  • 1,405
  • 2
  • 13
  • 23
55
votes
6 answers

Interactive matplotlib figures in Google Colab

Normally in a jupyter notebook I would use %matplotlib notebook magic to display an interactive window, however this doesn't seem to work with google colab. Is there a solution, or is it not possible to display interactive windows in google colab?
skoeb
  • 805
  • 1
  • 6
  • 13
55
votes
2 answers

What are the pros and cons of Dash by Plotly vs Jupyter Dashboards?

Dash by Plotly looks like a great way for a Python developer to create interactive web apps without having to learn Javascript and Front End Web development. Another great project with similar aims and scope is Jupyter Dashboards. What are the pros…
snth
  • 5,194
  • 4
  • 39
  • 48
53
votes
7 answers

plot.ly offline mode in jupyter lab not displaying plots

According to the documentation, offline mode with plot.ly in Jupyter is supposed to work after calling: from plotly.offline import download_plotlyjs, init_notebook_mode, iplot init_notebook_mode(connected=True) Now I am trying to show the following…
clstaudt
  • 21,436
  • 45
  • 156
  • 239
52
votes
5 answers

How to set line color

How can I set the color of a line in plotly? import plotly.graph_objects as go from plotly.subplots import make_subplots fig = make_subplots(rows=2, cols=1, subplot_titles=('Plot 1', 'Plot 2')) # plot the first line of the first…
Vader
  • 6,335
  • 8
  • 31
  • 43
51
votes
4 answers

What is the process to create pdf reports with charts from a DB?

I have a database generated by a survey to evaluate university professors. What I want is a python script that takes the information from that database, generates a graphing table for each user, creates graphs for each user, and then renders it in a…
ozo
  • 883
  • 1
  • 10
  • 18
1
2 3
99 100