-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplotly.rmd
55 lines (42 loc) · 2.16 KB
/
plotly.rmd
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
---
title: ""
author: "atrevidoantonio"
date: "2021-07-31"
output: ioslides_presentation
---
```{r setup, include = FALSE}
library(tint)
knitr::opts_chunk$set(warning = FALSE, echo = FALSE, message = FALSE, cache.extra = packageVersion('tint'))
library(knitr)
library(tinytex)
library(plotly)
library(tidyverse)
library(dplyr)
library(tidyr)
library(lubridate)
library(zoo)
```
```{r theme, include = FALSE}
raspberry <- "#DB2955"
onyx <- "#313435"
```
```{r data, include = FALSE}
data("sunspots")
data <- as.data.frame(sunspots) %>%
transmute(date = seq(as.Date("1749-01-01"), as.Date("1983-12-01"), by = "month"), sunspots = x)
```
---
Sunspots are caused by disturbances in the Sun's magnetic field welling up to the photosphere, the Sun's visible "surface". The powerful magnetic fields in the vicinity of sunspots produce active regions on the Sun.
Susnpots are darker, cooler places on the sun's surface: the photosphere has a temperature of 5,800 degrees Kelvin; sunspots have temperatures of about 3,800 degrees K. And for this reason, they look dark only in comparison with the brighter and hotter regions of the photosphere around them. Because sunspots occur over regions of intense magnetic activity, when that energy is released, solar flares and big storms called coronal mass ejections erupt from them.
---
Although the amount of sunspots is related to a multitude of time of factors, perhaps the most widely studied factor is time. The solar cycle, for instance,is a nearly periodic 11-year change in the Sun's activity measured in terms of variations in the number of observed sunspots on the solar surface.
---
```{r plot}
plot_ly(data, x = ~date, y = ~sunspots, type = 'scatter', mode = 'markers',
marker = list(color = raspberry)) %>%
layout(xaxis = list(title = ""), yaxis = list(title = "Sunspots"),
annotations = list(x = 1, y = -0.1, text = "Source: Sunspot numbers 1749 to 1983. Collected at Swiss Federal Observatory, Zurich until 1960, then Tokyo Astronomical Observatory.",
showarrow = F, xref = 'paper', yref = 'paper',
xanchor = 'right', yanchor='auto', xshift = 0, yshift = 0,
font = list(size = 10, color = onyx)))
```