# DAL ToolBox
# version 1.01.727
source("https://raw.githubusercontent.com/cefet-rj-dal/daltoolbox/main/jupyter.R")
#loading DAL
load_library("daltoolbox")
Loading required package: daltoolbox Registered S3 method overwritten by 'quantmod': method from as.zoo.data.frame zoo Attaching package: ‘daltoolbox’ The following object is masked from ‘package:base’: transform
load_library("ggplot2")
load_library("RColorBrewer")
#color palette
colors <- brewer.pal(4, 'Set1')
# setting the font size for all charts
font <- theme(text = element_text(size=16))
Loading required package: ggplot2 Loading required package: RColorBrewer
x <- seq(0, 10, 0.25)
serie <- data.frame(x, sin=sin(x), cosine=cos(x)+5)
head(serie)
x | sin | cosine | |
---|---|---|---|
<dbl> | <dbl> | <dbl> | |
1 | 0.00 | 0.0000000 | 6.000000 |
2 | 0.25 | 0.2474040 | 5.968912 |
3 | 0.50 | 0.4794255 | 5.877583 |
4 | 0.75 | 0.6816388 | 5.731689 |
5 | 1.00 | 0.8414710 | 5.540302 |
6 | 1.25 | 0.9489846 | 5.315322 |
A series plot is a type of chart that displays information as a series of data points connected by straight line segments.
It is similar to a scatter plot except that their x-axis value orders the measurement points.
More information: https://en.wikipedia.org/wiki/Line_chart
grf <- plot_series(serie, colors=colors[1:2]) + font
plot(grf)