plotly

Pass variables as parameters to plot_ly function

旧城冷巷雨未停 提交于 2019-12-13 15:21:29
问题 I would like to create a function that creates different kinds of plotly plots based on the parameters that are passed into it. If I create the following data library(plotly) #### test data lead <- rep("Fred Smith", 30) lead <- append(lead, rep("Terry Jones", 30)) lead <- append(lead, rep("Henry Sarduci", 30)) proj_date <- seq(as.Date('2017-11-01'), as.Date('2017-11-30'), by = 'day') proj_date <- append(proj_date, rep(proj_date, 2)) set.seed(1237) actHrs <- runif(90, 1, 100) cummActHrs <-

Subplot with Plotly in R

有些话、适合烂在心里 提交于 2019-12-13 14:15:20
问题 I cannot get a side by side subplot of a piechart using the plotly library in R with R Markdown. Instead, it looks like the subplot is overlaying one pie on top of the other: --- title: "Test Plotly Pie" author: "" date: "" output: html_document: self_contained: no --- ```{r plotpie1, results='asis', tidy=FALSE, message=FALSE, fig.retina=NULL, echo=FALSE, out.width = "99%", out.height="750p[![enter image description here][1]][1]x"} require(plotly) require(dplyr) p1 <- plot_ly(type="pie"

3D Bubble Chart in R Plotly

这一生的挚爱 提交于 2019-12-13 13:46:42
问题 I am struggling with developing a 3D bubble chart in R plotly. Plotly has a nice tutorial in python, but I have been unable to replicate in R. library(plotly) plot_ly(mtcars, x=mpg, y=cyl, z=disp, type='scatter3d', mode='markers', marker=list(sizemode='diameter', sizeref=750, size=hp, color=drat, colorscale = 'Viridis')) 回答1: library(plotly) plot_ly(mtcars, x=mpg, y=cyl, z=disp, type='scatter3d', mode='markers', sizemode='diameter', size=hp, color=drat, colorscale = 'Viridis') 来源: https:/

ggplotly - R, labeling trace names

混江龙づ霸主 提交于 2019-12-13 12:08:00
问题 I'm new to plotly and not able to find the relevant documentation on how to name the traces so a meaningful label appears in plot rendered by ggplotly . Here is the ggplotly site that shows a number of examples. What is needed to show a meaningful label on hover instead of the value followed by trace0, trace1, etc. For example, in the first plot, how can the labels appear so it shows: Proportion: value Total bill: value Ideally, I would like to do this directly in R rather than through the

Python Plotly: AttributeError: 'PlotlyJSONEncoder' object has no attribute 'encoding'

限于喜欢 提交于 2019-12-13 08:44:41
问题 I am getting an error when trying to plot the basic chart on the Plotly Tutorial: https://plot.ly/python/getting-started/. Full traceback here: Traceback (most recent call last): File "testing_plotly.py", line 13, in unique_url = py.plot(data, filename = 'basic-line') File "C:\Python34\lib\site-packages\plotly\plotly\plotly.py", line 186, in plot res = _send_to_plotly(figure, **plot_options) File "C:\Python34\lib\site-packages\plotly\plotly\plotly.py", line 1229, in _se cls=utils

Plot multiple columns on line graph using Dash/Plotly

被刻印的时光 ゝ 提交于 2019-12-13 08:36:14
问题 I have a table that has looks like this ... ticker,price1y,price2y,price3y,price5y, aapl,12,23,47,69, tsla,-9,24,54,190, att,-10,23,34,35, I would like to plot these using pandas plotly in dash to show price1y price2y ... price5y along the x axis and % change up the y axis. i need to be able to select multiple values to add to the graph using dash's callback feature. i currently create a dash_core_components graph however i have been unsuccessfully in plotting to this. app.layout = html.Div([

plotly in R - specifying bin size for choropleth maps

。_饼干妹妹 提交于 2019-12-13 07:50:50
问题 When creating a choropleth map using the plotly package in R, is there any way to specify the bin size? Example: library(plotly) df <- read.csv("https://raw.githubusercontent.com/plotly/datasets/master/2011_us_ag_exports.csv") plot_ly(df, z=total.exports, locations=code, type="choropleth", locationmode="USA-states", colors = 'Purples', filename="", colorbar=list(title = "2011 US Agriculture Exports by State")) %>% layout(geo = list(scope="usa")) Currently, the above code auto-bins into 2k

Manually changing the size of the Bubbles for Plotly Bubble Map in R

妖精的绣舞 提交于 2019-12-13 07:15:54
问题 I am currently trying to change the sizes of the Bubbles for Plotly's bubble map manually. I was successful in changing the colors of the map using the data provided but I am unable to use the same logic to change the size. To change the colors I simply called: colors_wanted <- c("red", "blue", "black", "pink") and passed this command to colors within plot_ly . Do you think it is possible to change the sizes rather than using the formula in this case sqrt to claim the sizes? library(plotly)

Error in plotly graph download from a shiny app when using javascript

隐身守侯 提交于 2019-12-13 04:19:19
问题 I have the shiny app below which displays either a plot or a table. Im not interested in the table and my Q is exclusively about the plot section. I am trying to download the plot when I open the app in browser using this javascript solution. I am not familiar with javascript and I would like to know how to prevent this from downloading this empty file when I press the "Download" button for 1st time and download only my plot which is not downloaded at all. library(shiny) library(plotly) d <-

Why is Dash giving a parse error when uploading files?

…衆ロ難τιáo~ 提交于 2019-12-13 03:40:52
问题 Uploading Excel or CSV results in an error. I followed the Dash demo, but as soon as I try to extend it to do something like plotting, it doesn't work. I don't want to just show a table. The Dash_Table function was updated, so previous examples that used Dash_Table_Experiments no longer work I've spent the whole night on stack exchange, tinkering with my code and reading other solutions. the full working code is provided below. I'd like to also add a drop down call back function to "filter"