plotly

Creating a reactive dataframe with shiny apps

橙三吉。 提交于 2019-12-19 08:42:33
问题 I am trying to get this reactive to return a data frame that I can manipulate with plotly. avghour <- reactive({ result <- data.frame() start_date <- as.numeric(unlist(input$i6[1])) end_date <- as.numeric(unlist(input$i6[2])) mkw <- maxkwpeakdates[(maxkwpeakdates >= start_date & maxkwpeakdates <= end_date) & !is.na(maxkwpeakdates), ] mkw <- na.omit(mkw) mopkw <- maxonpeakkwdates[(maxonpeakkwdates >= x & maxonpeakkwdates <= y) & !is.na(maxonpeakkwdates), ] mopkw <- na.omit(mopkw) mkwhour <-

Python Plotly - Align Y Axis for Scatter and Bar

丶灬走出姿态 提交于 2019-12-19 03:21:30
问题 I'm trying to create a plotly graph with a Scatter and Graph elements. It all goes nicely, but one issue - the two Y axis don't align around 0. I have tried playing with different attributes, such as 'mirror' and tick0, I also tried following the examples on plotly's site, but it's mostly multiple y-axis with the same graph type. What can I do to fix this? import utils import pandas as pd import plotly.plotly as py import plotly.graph_objs as go import plotly pd_data ['dt'] = ... dates pd

Clear plotly click event

旧时模样 提交于 2019-12-19 03:16:49
问题 I'm trying to use plotly click events in the context of a shiny app. Following the official demo I'm using this bit of code to update a date picker and jump to another tab in my app on click: observe({ d <- event_data("plotly_click", source = 'plot') if(!is.null(d) & (input$navPanel == 'overview')) { d %>% filter(curveNumber == 0) %>% select(x) -> selected_date updateDateInput(session, "date", value = lubridate::ymd(selected_date$x)) updateTabsetPanel(session, "navPanel", selected = "details"

Plotly icreate_animations offline on Jupyter Notebook

落花浮王杯 提交于 2019-12-19 03:12:33
问题 I am trying to replicate this plotly tutorial on a Jupyter Notebook with a dataset that matches the one given in the example, I just had to change the name of one column. The issue here is that being offline the command py.icreate_animations(figure) which in offline notebook mode becomes icreate_animations(figure) is not recognized. Furthermore, if I simply try the iplot(figure) command, which I use for static plots, a very long error is raised: -----------------------------------------------

Plotly Maps Not Rendering in R

流过昼夜 提交于 2019-12-19 02:54:11
问题 I have successfully installed the plotly library for R. To get started, I followed their Getting Started for R guide and directly copied the code from several plots in my RStudio Version 0.99.489. The examples for scatterplots, box plots, etc. work well. The examples for bubble and choropleth maps do not plot properly. The maps do not render at all. Only title and legend show after running the code. Links to the code are here: https://plot.ly/r/bubble-maps/ https://plot.ly/r/choropleth-maps/

How to format data for plotly sunburst diagram

拈花ヽ惹草 提交于 2019-12-18 18:28:37
问题 I'm trying to make an sunburst diagram using Plotly via R. I'm struggling with the data model required for the hierarchy, both in terms of conceptualizing how it works, and seeing if there are any easy ways to transform a regular dataframe, with columns representing different hierarchical levels, into the format needed. I've looked at examples for plotly sunburst charts in R, e.g., here, and seen the reference page but don't totally get the model for data formatting. # Create some fake data -

Getting <script> and <div> tags from Plotly using Python

北慕城南 提交于 2019-12-18 13:25:56
问题 I was wondering if anyone knew a good way (preferably a built in method, but I'm open to writing my own of course) to get the <script> and <div> tags from the HTML output of the Plotly offline client. I'm already familiar with bokeh and really enjoy using it for 2D visualization, but would really like to integrate Plotly as well for its 3D visualization capabilities. Let me know if you need any extra details about the project. 回答1: If you call: plotly.offline.plot(data, filename='file.html')

Python — Setting Background color to transparent in Plotly plots

拥有回忆 提交于 2019-12-18 12:48:00
问题 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 = Data([ Bar( x=['Sivaranjani S', 'Vijayalakshmi C', 'Rajeshwari S', 'Shanthi Priscilla', 'Pandiyaraj G', 'Kamatchi S', 'MohanaPriya', 'Madhumitha G', 'Franklin Alphones Raj J', 'Akfaris Almaas', 'Biswajit Champati', 'Priya R', 'Rekha Rajasekaran',

add secondary description in axis values, plotly

天大地大妈咪最大 提交于 2019-12-18 09:39:36
问题 I am using a dataframe which includes the following columns: Country, GNI, CarSalesPerCap . I am using kmeans to create clusters. In the algorithm i pass the dataframe with the two numeric columns: 'GNI', 'CarSalesPerCap' . Then i am using plotly to create a scatter plot, where x-axis is the CarsalesPerCap and Y-axis is GNI . My question is, how am i going to add to the plot the corresponding country for each point plotted on the graph. df = pd.read_sql_query(query,conn) df = df.dropna()

Set marker size based on coordinate values, not pixels, in plotly R

一世执手 提交于 2019-12-18 09:38:49
问题 This post - Set marker size in plotly - unfortunately did not help with what I was looking for, and is the only post on the topic I could find. Per the plotly documentation on the size parameter for scatter plots: "size (number or array of numbers greater than or equal to 0), default: 6, Sets the marker size (in px)" the (in px) is a problem for me. I'd like to create a plot where the marker sizes are based on the coordinate values, not pixels, that way I can increase the size of a graph (by