ggplotly

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

谁说我不能喝 提交于 2019-12-17 08:28:40
问题 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() + geom_point() Now I want to use plotly, mostly to be able, when mousing over a point, to get other information than the value, such as the company name. I try this : require(plotly) ggplotly() which get me a tooltip, but with only seq and value. I

Diplaying activity details in a data table in R shiny

无人久伴 提交于 2019-12-14 03:32:22
问题 When I run this R shiny script below, I get two plots with a chart for activity path derived from the patients dataset of the bupaR library called trace explorer on the left and a data table to display the activity/trace details. The chart on the left is such,that we observe various paths with sequence of horizontal traces of activities which occur one after the other. When clicked on any box in a particular trace, the trace details are presented on the right table. My requirement is that,

R chart convert to html format without other files

落花浮王杯 提交于 2019-12-13 16:09:29
问题 My sample dataset: library(plotly) library(htmlwidgets) d <- data.frame( "name" = c("bily", "mary", "ken"), "fruit" = c("cherry", "apple", "apple"), "count" = c(1, 10, 30) ) gg <- ggplot(data = d, aes(x = fruit, y = count, group = name)) + geom_line(aes(color = name)) + geom_point(aes(color = name)) plotly <- ggplotly(gg) save graph: d <- # please put your directory where you want to save the graph "xxxx/graph.html" I have searched these three functions that can output the HTML format but

Multiple axis.text.x names coloring does not work with ggplotly()

瘦欲@ 提交于 2019-12-13 14:24:58
问题 I have a data frame: HG44 <- data.frame( gene_symbol = c("sads","sdsds","sdasdad","dfds","sdsdd"), panel = c("big","gr","sm","big","big"), variable = c("x","x","y","z","y") , value = c("normal","over","low","normal","low") , colors = c("red","green","yellow","red","red")) And I create a heatmap with: library(plotly) library(ggplot2) library(reshape2) pp <- ggplot(HG44, aes(gene_symbol,variable)) + geom_tile(aes(fill = value)) + theme(axis.text.x = element_text(family = "Calibri", size = 11

Counting the number of bars in a grouped bar chart in R and plotly

末鹿安然 提交于 2019-12-13 03:13:38
问题 When I run this script below, It gives me two grouped bar charts. I simply want a vector with the count of number of bars in each group. Attaching the snapshot for reference, clearly, the vector will have two count values. Please help. library(shiny) library(shinydashboard) library(ggplot2) library(plotly) ui <- dashboardPage( dashboardHeader(title = "Sankey Chart"), dashboardSidebar( width = 0 ), dashboardBody( fluidRow( column(10, uiOutput('box1'), tags$br()), tags$br(), column(10, box

In plotly, how do I retain the information about both the lasso selection and the clicked point?

荒凉一梦 提交于 2019-12-12 11:32:14
问题 I'm using plotly::ggplotly() and I need the user to be able to both select a single point and to select multiple points with brushing. I want both selection options to exist in parallel. The user should be able to click on a point and to lasso select several points, and both of those pieces of information should be recorded. The problem I'm having is that if I click on a point, then the lasso selection gets reset. But the opposite is not true: if I lasso select and then click on a point, then

Issue with “na” in arranging the bars in a bar plot in R and ggplot2

心不动则不痛 提交于 2019-12-12 06:38:33
问题 I am trying to create a Descending bars bar plot using ggplot2 and plotly in R. The data I am using is "a12" which is consumed by the ggplot under the line "#Final Data frame is consumed below". If you see the snap shot below, the "na" value in the column "a1" should come at second spot in the plot, however it does not follow the descending order and is pushed at the last. One way to cure this issue is to hardcode the value there, but I don't want to do that. Instead is there a way using

Sankey diagram using Plotly

时光总嘲笑我的痴心妄想 提交于 2019-12-12 04:35:33
问题 I wish to create a simple sankey chart using this piece of data and specifically plotly package such that, activity ABC points to Resouce "R5", "BVN" to "R1" and "IOP" to "R6". I followed the plotly post https://plot.ly/r/sankey-diagram/, but I just am not able to automate the scipt with this data. I would appreciate if you can help me do it without JSON. Data is attached below. library(plotly) library(rjson) json_file <-"https://raw.githubusercontent.com/plotly/plotly.js/master/test/image

How to convert a ggplot to plot_ly?

折月煮酒 提交于 2019-12-11 16:07:21
问题 I am trying to create a Shiny Dashboard which contains Plots also. Plotly is such a great a package that it provides great visualization and interactivity to the users. I know that the best way to convert a ggplot to plotly is by using the ggplotly() function. But when i am using the ggplotly, i am facing issues on the size and appearance of the plots in the dashboard. I had requested a question on this before (ggplotly not working properly when number are facets are more ) and also i tried

number instead of date on the density plot in R

不羁的心 提交于 2019-12-11 14:46:27
问题 I have a problem. I am trying to draw a density plot in R with the plotly package. But when I hover the mouse over the plot I get number format of date 17623 instead 2018-04-02. Any ideas how to solve this problem? Date <- seq(as.Date(Sys.Date()-30), by=1, len=31) Value <- runif(31) dataTable <- data.frame(Date, Value) density_plot = ggplot(dataTable, aes(x=Date, y = Value)) + geom_density(stat="identity", fill = "#4156C5") + labs(fill = "Value", x = "Date", y = "Frequency") ggplotly(density