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
31
votes
2 answers

Format y-axis as percent in plot.ly

How do I format the y-axis as percent in plot.ly?. in var layout I have the following settings for the y-axis: yaxis: { hoverformat: ",.0%" }, which changes the hover to percentages but the values printed on the y-axis…
Wessi
  • 1,702
  • 4
  • 36
  • 69
31
votes
3 answers

Ordering in r plotly barchart

Why do I get the different order in plotly bar chart than I defined in x and y variables. E.g. library(plotly) plot_ly( x = c("giraffes", "orangutans", "monkeys"), y = c(20, 14, 23), name = "SF Zoo", type = "bar" ) I need bar chart where I…
martinkabe
  • 1,079
  • 2
  • 12
  • 27
30
votes
5 answers

Distributed 1.21.8 requires msgpack, which is not installed

I'm having a problem trying to install plotly. I proceeded to upgrade anaconda using the command line on Debian 9 and I received the error message "distributed 1.21.0 requires msgpack, which is not installed". Then I tried a conda install mspack,…
Chloe Milkmaid
  • 301
  • 1
  • 3
  • 4
30
votes
3 answers

Change transparency of fillcolor

I'm trying to change the default color of a fillcolor in Plotly to another transparent one, but when I change the fillcolor it is not transparent anymore. trace = (go.Scatter(x=[30,45],y=[3000,3000], fill='tozeroy', # …
Hans Bambel
  • 806
  • 1
  • 10
  • 20
30
votes
7 answers

How to reverse axis values when using plotly?

Here is the program I used: library(plotly) mydata = read.csv("data_to_plot.txt") df = as.data.frame(mydata) p <- df %>% group_by(X) %>% plot_ly(x = ~Y, y = ~X, z = ~Z, type = "scatter3d", mode = "lines") p and below is an excerpt of…
Andrew
  • 926
  • 2
  • 17
  • 24
30
votes
1 answer

Listing legend items horizontally and centered below a plot

I have been tweaking legends in plotly and R. One thing I am unable to figure out is how (if it is possible) to reposition legend items so that they are listed horizontally and centered below the plot. The default legend items are positioned…
user1830307
30
votes
1 answer

Plotting Pandas Multiindex Bar Chart

How can I plot a Python Pandas multiindex dataframe as a bar chart with group labels? Do any of the plotting libraries directly support this? This SO post shows a custom solution using matplotlib, but is there direct support for it? As an…
rbinnun
  • 1,169
  • 2
  • 10
  • 18
29
votes
3 answers

How to manually set the color of points in plotly express scatter plots

https://plotly.com/python/line-and-scatter/ has many scatter plot examples, but not a single one showing you how to set all the points' colours within px.scatter: # x and y given as DataFrame columns import plotly.express as px df = px.data.iris() #…
RNs_Ghost
  • 1,687
  • 5
  • 25
  • 39
29
votes
3 answers

how to set the bold font style in Plotly

When using the Plotly, I can set the title font in the layout part as follow. titlefont=dict(size =14, color='black', family='Arial, sans-serif') My question is How to set the font as Bold. Thanks
Jason LiLy
  • 634
  • 2
  • 9
  • 19
29
votes
5 answers

Plot multiple figures as subplots

These resources show how to take data from a single Pandas DataFrame and plot different columns subplots on a Plotly graph. I'm interested in creating figures from separate DataFrames and plotting them to the same graph as subplots. Is this possible…
sparrow
  • 10,794
  • 12
  • 54
  • 74
29
votes
2 answers

How to display charts in Spyder

Since November 2015, plotly is Open-Source and available for python. https://plot.ly/javascript/open-source-announcement/ When trying to do some plots offline, these work in iPython Notebook (version 4.0.4) But if I try to run them in Spyder…
Gabriel
  • 3,737
  • 11
  • 30
  • 48
28
votes
4 answers

How to combine scatter and line plots using Plotly Express

Plotly Express has an intuitive way to provide pre-formatted plotly plots with minimal lines of code; sort of how Seaborn does it for matplotlib. It is possible to add traces of plots on Plotly to get a scatter plot on an existing line plot.…
Ébe Isaac
  • 11,563
  • 17
  • 64
  • 97
28
votes
2 answers

How to plot on secondary y-Axis with plotly express

How do I utilize plotly.express to plot multiple lines on two yaxis out of one Pandas dataframe? I find this very useful to plot all columns containing a specific substring: fig = px.line(df, y=df.filter(regex="Linear").columns,…
derflo
  • 981
  • 1
  • 7
  • 9
28
votes
18 answers

ImportError: 'No module named plotly.plotly' in LinuxMint17.3

Whenever I am trying to compile the following code to get a line graph shows some errors. But I don't know how to fix it. Here is my code : import plotly.plotly as py import plotly.graph_objs as go # Create random data with numpy import numpy as…
Primo
  • 413
  • 1
  • 6
  • 7
28
votes
3 answers

How to give subtitles for subplot in plot_ly using R

I am wondering how to give difference subtitles for the subplots using plot_ly. Any hint please. I got one title BB in this case. Thanks. p <- subplot( plot_ly(economics, x = date, y = uempmed)%>%layout(showlegend = FALSE, title="AA"), …
yuxu zi
  • 485
  • 1
  • 5
  • 10