Created
August 28, 2018 19:52
-
-
Save khakieconomics/edb70b45bea002f05b278490d85f536f to your computer and use it in GitHub Desktop.
Simple R dashboard with plotly mouse-over effects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Demo of mouse-over" | |
output: | |
flexdashboard::flex_dashboard: | |
orientation: columns | |
vertical_layout: fill | |
--- | |
```{r setup, include=FALSE} | |
library(flexdashboard) | |
``` | |
### Demo chart | |
```{r} | |
library(tidyverse); library(plotly); library(ggthemes) | |
p <- crossing(`Law firm` = LETTERS[1:10], Year = 1990:2018) %>% | |
group_by(`Law firm`) %>% | |
mutate(`Profits per partner` = 1e6 + 50000 * (Year - 1990) + cumsum(rnorm(n(), 0, 100000))) %>% | |
ungroup %>% | |
ggplot(aes(x = Year, y = `Profits per partner`, group = `Law firm`)) + | |
geom_line(alpha = 0.6) + | |
theme_hc() | |
ggplotly(p) | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment