ggplotly

Cumulative points over year on map with R ggplot2 and ggplotly

萝らか妹 提交于 2020-06-27 17:47:05
问题 I am trying to plot new locations opened over each month on a map cumulatively. I am able to create an animation with new locations each month, but not cumulatively. In other words, I want to see the new locations add to the existing ones. Here is the sample data DF <- data.frame("latitude" = c(42.29813,41.83280,41.83280,30.24354), "longitude" =c(-71.23154,-72.72642,-72.72642,-81.62098), "month" = c(1,2,3,4)) This is what I have tried usa <- ggplot() + borders("usa", colour = "gray85", fill =

Using `ggplotly` and `DT` from a `for` loop in Rmarkdown

人盡茶涼 提交于 2020-06-27 04:03:11
问题 Is that possible to use ggplotly() or datatable() in RMarkdown from inside a for loop or function? Example: --- title: "Using `ggplotly` and `DT` from a `for` loop in Rmarkdown" output: html_document --- ```{r setup, include=FALSE} library(ggplot2); library(DT) ``` ## Without `for` loop - works ```{r} datatable(cars) g <- ggplot(cars) + geom_histogram(aes_string(x=names(cars)[1] )) ggplotly(g) ``` ## From inside the `for` loop - does not work (nothing is printed) ```{r} for( col in 1:ncol

Flex Dashboard not working when I add the world map code in it

戏子无情 提交于 2020-05-31 04:57:45
问题 I have created a flex dashboard using R Markdown in RStudio for 'COVID-19 WORLDWIDE TRACKER'. I have created one line plot, one area plot and 2 column graphs. I want to add a world heat map in it. The data is here: mydata and x. Code is as follows: --- title: "COVID-19 WORLDWIDE TRACKER" output: flexdashboard::flex_dashboard: orientation: rows vertical_layout: scroll runtime: shiny --- ```{r setup, include=FALSE} library(flexdashboard) library(ggplot2) library(plotly) library(readxl) library

ggplotly removing data from single facet

时间秒杀一切 提交于 2020-01-24 04:14:07
问题 I am trying to create a plotly graph for a shiny app. I am running into an issue with certain layouts of faceted plots. Whenever there are four facets and they are in a 2x2 grid, the bottom left facet does not display any data even though the data is there in the ggplot figure. This also happens when there are 6 facets in a 3x2 grid, with the bottom left again being dropped. The examples on the plotly ggplot examples page show several examples with a 2x2 grid and the data being displayed. I

ggplotly not working properly when number are facets are more

南楼画角 提交于 2020-01-24 01:05:05
问题 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. But when i use ggplotly to convert my ggplot plots to interactive graphs, i am not getting the expected output and the issues get multiplied when the number of facets in the output are more. for example kindly find the code below. Source_Data_dupli <- data.frame( key = c(1, 1, 1, 2, 2, 2, 3, 3, 3,4,4,5,5,6,7), Product_Name = c

ggplotly not working properly when number are facets are more

倾然丶 夕夏残阳落幕 提交于 2020-01-24 01:04:14
问题 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. But when i use ggplotly to convert my ggplot plots to interactive graphs, i am not getting the expected output and the issues get multiplied when the number of facets in the output are more. for example kindly find the code below. Source_Data_dupli <- data.frame( key = c(1, 1, 1, 2, 2, 2, 3, 3, 3,4,4,5,5,6,7), Product_Name = c

Plotly R with ggplot2: Use coord_polar in a geom_bar using plotly

ぐ巨炮叔叔 提交于 2020-01-14 05:26:09
问题 Is there a simple way of using coord_polar() when doing a barplot in ggplot2 using plotly? Example without using polar coordinates - It works One could also add +coord_flip() and this would still work. library(ggplot2) library(plotly) # Create fake data df <- data.frame( genre=c("Pop", "HipHop", "Latin", "Pop", "Pop", "HipHop"), artist=c("ArianaGrande", "ChrisBrown", "DaddyYankee", "EdSheeran", "LewisCapaldi", "ShawnMendes") ) # Create a ggplot bar plot in polar coordinates p <- ggplot(data

Converting ggplot object to plotly object creates axis title that overlaps tick values

痞子三分冷 提交于 2020-01-13 19:48:08
问题 I had the same issue described in this question: R: ggplot and plotly axis margin won't change but when I implemented the solution, I got the following error: Warning: Ignoring unknown aesthetics: text We recommend that you use the dev version of ggplot2 with ggplotly() Install it with: devtools::install_github('hadley/ggplot2') Error in tmp [[2]] : subscript out of bounds This code will produce this error on my machine: library(gapminder) library(plotly) library(ggplot2) lead <- rep("Fred

How to plot a line with color vector in R Plotly

倖福魔咒の 提交于 2020-01-04 04:08:15
问题 Say I have the following data frame: ret <- rnorm(100, 0, 5) df <- data.frame( x = seq(1, 100, 1), ret = ret, y = 100 + cumsum(ret), col = c(ifelse(ret > 0, "red", "forestgreen"), NA)[-1] ) Here I'm simulating the returns of some fictional financial asset using rnorm named 'ret', and am defining a color vector named 'col' where upticks are green and downticks are red. What I want to produce is something like the following: library(ggplot2) ggplot(df, aes(x=x, y=y)) + geom_line(aes(colour=col,

Creating Process Map Diagrams using different packages in R

随声附和 提交于 2020-01-02 09:31:49
问题 the given script simply creates a process map diagram showing the flow of events in R. This field of study is called event log mining or process mining. I wish to know any other packages or functionality in R using which I can create similar maps and also make them interactive like ggplotly. Please help me with some links if possible. Thanks and please help. library(bupaR) library(edeaR) library(eventdataR) library(processmapR) library(processmonitR) library(xesreadR) library(petrinetR)