Questions tagged [plotly]

1

votes
1

answer
4.5k

Views

Plotly set color

I feel like ive tried everything but nothing seem to work: var charData = [{ x: x1, y: y, type: 'bar', color: 'rgb(31,119,180)', orientation: 'h', name: 'Nuværende', bar: { color: 'rgb(rgb(31, 114, 225)' } }, { x: x2, y: y, type: 'bar', orientation: 'h', name: 'Forventet' }], layout = { title: 'Bru...
Marc Rasmussen
1

votes
1

answer
371

Views

Plotly js chart hover text not displaying correct number values

I am using plotly to show revenue in my chart, but the hover is not displaying the numbers correctly. Is there a way to fix this? when I hover on that value it should show something like 10714.78. Right now it is in an integer format. But even if i format to a string such as '10,714.78' it still doe...
caffeinescript
1

votes
1

answer
1.3k

Views

Flask's DispatcherMiddleware not playing nice with Plotly's Dash

I have an existing Flask web app, and I want to incorporate an existing Dash app (a Plotly Flask app) into it. As Flask's documentation recommends, I am using DispatcherMiddleware thusly to make this happen: flask_app = Flask(__name__) # App with both apps attached to it app = Flask(__name__) # Ex...
zthomas.nc
1

votes
1

answer
124

Views

Hovering over the plot in plotly and having some images appear

I am using plotly.js and jquery. I would like to have a custom hover effect with the images. I have seen the answer by Etpinard (here is the look and feel). But I think I need a different solution. What I don't want to is to work with the iframe, while the mentioned solution works with it. Instead,...
Anna-Lischen
1

votes
2

answer
42

Views

How to make histogram bars to have different colors in Plotly in R

I am making a histogram using plotly package in R and below is the chart. Here is my code: plot_ly(test, x = ~count, type = 'histogram', marker = list(color = 'blue')) I am wondering if there is a way to make the chart more intuitive from a color perspective (eg. different colors for each bar) as t...
MMAASS
0

votes
2

answer
28

Views

Plotly stacked bar chart pandas dataframe

I have a dataframe with a varying number of columns. With positive and negative values. Is it possible to make a stacked bar chart with all of these columns in the dataframe? A B C 0 34 34 -12 1 34 223 -12 2 34 56 -12 3 34 86 -12 4 56 86 -12 5 56 43 -1...
fred.schwartz
0

votes
0

answer
9

Views

Program about the Monty Hall problem not returning expected results

First of all this program is probably stupid inefficient and long but it's my first real program and if you suggest changes in the program keep this in mind. and the text is in Norwegian. If there's anything that is unclear please just ask and I will translate more. The code is written in jupyter us...
Marius K
1

votes
1

answer
513

Views

Typescript definition file for json objects with string attributes as type indicators

I am investigating the creation of a Typescript Definition file for Plotly.js. I have looked at a number of example definition files on the DefinitelyTyped repository. One question that comes to mind is the interface for the Data object. The Data object is an array of Traces, as demonstrated in t...
Bill Kidwell
1

votes
1

answer
463

Views

Plotly Draw line according to an equation

I would like to drow a line according to an equation, for example: y=2x+3. Is there any way to do this in plotly javascript (or python) without having to sample the equation at different points?
Ignasi
1

votes
1

answer
690

Views

Python: How to revolve a surface around z axis and make a 3d plot?

I want to get 2d and 3d plots as shown below. The equation of the curve is given. How can we do so in python? I know there may be duplicates but at the time of posting I could not fine any useful posts. My initial attempt is like this: # Imports import numpy as np import matplotlib.pyplot as plt #...
I_am_Groot
1

votes
1

answer
459

Views

How do I color plot.ly js legend and why is it black?

When my graph renders, everything is great EXCEPT the legend only shows the colors black. The grouped bar chart graph is displaying how I would expect. All of the data and colors are wonderful, but the legend is not right. I am loading a plotly graph into a salesforce Visualforce page as follows: va...
notthehoff
1

votes
2

answer
1.4k

Views

Multiple Y-axis on graph not aligned

I created a graph through R's Plotly library. The graph has 2 y-axis's and everything looks fine, except that the y-axis's are misaligned. How do I 'realign' it?
DLo
1

votes
1

answer
1.1k

Views

Plotly: Create map based on GeoJSON file

I've found a GeoJSON file containing all cities in The Netherlands. I'm now trying to plot this map using Plotly, but I can't seem to figure out how to do this. I know it's possible to set the scope on a specific country, but Plotly's default map doesn't seem to contain the individual cities for eac...
Algorithm_NL
1

votes
1

answer
349

Views

plotly in R : feeding add_trace with data from a list() object

I have data that is already stored in a list object. I have several lines to draw one one top of the other. I would like to plot them using plotly WITHOUT converting the data into a data frame. In the code below, the first line draws fine, but the additional lines do not draw with add_trace() : libr...
Servet
1

votes
1

answer
902

Views

Custom hover text, singular/plural (plotly.js)

I'm building a scatter graph. My X axis represents dates, and Y axis represents the number of responses given. When mouse hovering, I'd like to show either: 1 response OR N responses I suppose it is something to do with custom hovering, but can't see how to do it with the hoverinfo property of the...
Meglio
1

votes
1

answer
323

Views

Plotly R: Cant get points to plot when two values present per x factor level

I have a data frame like this: dput(df) structure(list(x = structure(c(1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L), .Label = c('41197708', '41223094', '41244000', '41244435', '41244936'), class = 'factor'), y = c(1, 1, 1, 1, 1, 2, 2, 2, 2, 2)), .Names = c('x', 'y'), row.names = c(NA, -10L), class = '...
Gopala
1

votes
1

answer
2k

Views

Plotly custom hover text in barplot from R

I want have a stack barplot made in ggplot2 and Im applying the ggplotly() command to transform it into a interactive plotly graphic. The issue now is that I want the plot to display on hover each value depending on the ITEM. Here is what I mean... The plot is displaying a cumulative value for each...
1

votes
2

answer
1.8k

Views

Is it possible to manually set the scale and ticks on a plot.ly 3D scatter graph?

I have a basic plot.ly 3D scatter graph with various paths specified in three dimensions. After three days of reading documentation, I still haven't found a way to define the tick interval of my axes. It seems to be auto-generating them based on my data, which I don't want. In effect, I need my th...
Daniel Samuels
1

votes
1

answer
686

Views

Error plotting chart with facet_wrap and scales = “free” in plotly

I have a time series with various categories (facets), and I am trying to create a chart using the facet_wrap feature from ggplot2 and upload it on plotly. If I set scales = 'fixed', I have no problem: the graph looks fine on my computer and on plotly. But if I set scales = 'free', as in the code b...
Nikos Tsafos
1

votes
1

answer
391

Views

How to add long title in ggplotly?

Consider the following example: data(canada.cities, package = 'maps') viz
Arnab Maity
1

votes
2

answer
2.4k

Views

Using plotly with zeppellin in scala

I want to display my results in the form of a histogram in Zeppelin. I came across plotly. My code is in scala and I would like to know the steps to incorporate plotly into zeppelin using scala. Or is there any better way(libraries) that can be used to draw a histogram in Zeppelin(Scala)?
anony29
1

votes
1

answer
710

Views

Plotly in R not recognizing/plotting data retrieved from readxl package

A few months ago, I built a shiny app, with a plotly graph as my main output. My data is from an excel sheet, and I have used the readxl package to pull the data into R. I recently updated the excel data, and now plotly will no longer graph the data. From the shinyapp: ratings
L. Hansen
1

votes
1

answer
4.3k

Views

plotly multiple plot facet

I'd like to do multi plots with two axes on each plot like this library(plotly) ay
user3022875
1

votes
2

answer
726

Views

Live Streaming with plotly in javascript

var socket = io(); socket.on('temp', function(temp){ $('#messages').html(temp); var layout = { title: 'Live Data Streaming', xaxis: { title: 'X Axis', titlefont: { family: 'Verdana, Sans-serif', size: 18, color: '#7f7f7f' } }, yaxis: { title: 'Live Data', titlefont: { family: 'Verdana, Sans-serif',...
jay
1

votes
1

answer
114

Views

The R equivalent of the Python plotly.tools.FigureFactory.create_scatterplotmatrix?

I'm trying to recreate in R the scatterplotmatrix from the Python plotly tutorial: http://moderndata.plot.ly/using-plotly-in-jupyter-notebooks-on-microsoft-azure/ I have the dataframe in R, but what is the equivalent plotly code in R to recreate the below Python call? fig = FigureFactory.create_scat...
Dave Hirschfeld
1

votes
1

answer
287

Views

plotly.js how to change z data on hover to display % as well as % on colorscale

I would like to add a % tag to the z value that is show on hover. Also, right now, my colorscale is only displaying -10 to 10, but I would like it to show % so -10% to 10%. Here is the code I have. I have tried to add the ticksuffix : '%', but I'm not sure where I should put it since it seems like...
VincFort
1

votes
1

answer
1.4k

Views

Best way of create/delete/restyle graph dynamically with Plotly.js?

I want to add and delete graphs with buttons on my page. I have to pass layout, and data as Json to the plotly.plot() function. How can i do this dynamically? Example code from reference : var trace1 = { x: [1, 2, 3, 4], y: [10, 15, 13, 17], type: 'scatter' }; var trace2 = { x: [1, 2, 3, 4], y: [16...
Khan
1

votes
1

answer
490

Views

mesh3d how to colour the faces of the triangles R Plotly

I am trying to create a mesh3D plot in plotlyR using R studio but I am having problems with how to create a colour scale to my mesh. I have a nice mesh plot using the code, zmean
user3715775
1

votes
1

answer
752

Views

fix plotly color scale breaks

I have created a heatmap using plotly's R interface, like so: df % plot_ly(x = date, y = period, z = abs(diff), type = 'heatmap', hoverinfo='none', colors = rev(RColorBrewer::brewer.pal(5, 'RdYlGn')), showscale = F) %>% add_trace(x = date, y = period, text = paste0(round(diff*100), '%'), mode='text'...
RoyalTS
1

votes
1

answer
520

Views

How to fill area with our choice colour in plotly area grap

I want to change/fill area of plotly Area graph with our choice of colour instead of blue. But I'm unable to change it. I referred This Code. Graph is coming like this:
Anil Jagtap
1

votes
1

answer
708

Views

How to increase width and height of plotly area graph

I don't want to increase height and width of div tag. Just I want increase only following part of graph. I referred this code My html code is: And my plotly.js code is: var trace1 = { x: ['2013-10-04 22:23:00', '2013-10-06 22:23:00', '2013-11-04 22:23:00', '2013-11-07 22:23:00','2013-12-04 2...
Anil Jagtap
1

votes
1

answer
268

Views

plotly does not show titles of multiple plots in R

I am trying to layout 2 plots together using ggplot2 and plotly. Here's what I tried: library(ggplot2) library(plotly) mt_mpg
umair durrani
1

votes
1

answer
2.7k

Views

Plotly Javascript Not Working w Local CSV

I'm practicing trying to replicate the USA Chorleth map (https://plot.ly/javascript/choropleth-maps/) When I run their code snippet where it links to the CSV file (https://raw.githubusercontent.com/plotly/datasets/master/2011_us_ag_exports.csv) it works. However, when I try downloading that CSV and...
James Holland
1

votes
1

answer
427

Views

re-arrange Legend in plotly boxplot

I have been struggling for re-arrenging the legend in one of my plots. The example below ilustrates the problem I am currently having: library(plotly) library(data.table) test
alsarria
1

votes
2

answer
168

Views

R: ggplot2 & Plotly: Recreating 'reference bands' on bar graphs from Tableau in R

I am trying to recreate some functionality I use daily in Tableau for R (ggplot2 and plotly). I need to be able to create reference bands and lines similar to the image below. I've figured out how to create the reference lines from the geom_errorbar(). However I can't seem to find a solution for the...
Jordan Webb
1

votes
2

answer
454

Views

Plotly Facet_Wrap Bar Graph Not Working

I have a dataset as follows: DATE
nak5120
1

votes
1

answer
313

Views

Plotly javascript. 'plotly_click' gets on is not a function

I am attempting to create an onclick event on my plotly chart. Following the documentation i have created the following chart: var graphDiv = document.getElementById('uniqueId'); Plotly.newPlot('uniqueId', charData, layout); graphDiv.on('plotly_click', function (data) { var i = 0; }) However when i...
Marc Rasmussen
1

votes
2

answer
421

Views

Horizontal line in R plotly, when xaxis is discrete

I would like to create a bar plot (with the plotly package), which (for some months) would have red horizontal line (gain to obtain). Plots below show my problem more precisely, I hope. Code and data needed to obtain first plot: library('plotly') library('dplyr') data.frame(miesiac_label = as.chara...
Marta
1

votes
1

answer
429

Views

R - Handle long labels in plotly

I have the following function with ggplot2 plot. One feature of the function is the str_wrap function call to handle the very long labels I have. PlotResponseRate
Kumpelka
1

votes
1

answer
130

Views

Draw a simple plotly line graph horizontally

With the bar graph, you can add orientation: h to the trace. Couldn't find a way to do that with line graph, so a basic graph like this one: Can be rotated to look something like this (rotated in gimp...):
shaharsol

View additional questions