-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathindex.qmd
More file actions
34 lines (27 loc) · 764 Bytes
/
Copy pathindex.qmd
File metadata and controls
34 lines (27 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
---
title: "Plotly in Quarto"
format: html
editor: visual
---
`plotly` is such an amazing package. With the `ggplotly` function you can make your `ggplot` interactive in just 1 line of code!
Check it out:
```{r, message=FALSE, warning=F}
# Libraries
library(ggplot2)
library(dplyr)
library(plotly)
library(hrbrthemes)
# Load dataset from github
data <- read.table("https://raw.githubusercontent.com/holtzy/data_to_viz/master/Example_dataset/3_TwoNumOrdered.csv", header=T)
data$date <- as.Date(data$date)
# Usual area chart
p <- data %>%
ggplot( aes(x=date, y=value)) +
geom_area(fill="#69b3a2", alpha=0.5) +
geom_line(color="#69b3a2") +
ylab("bitcoin price ($)") +
theme_ipsum()
# Turn it interactive with ggplotly
p <- ggplotly(p)
p
```