-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdraw_plots.R
60 lines (45 loc) · 2.03 KB
/
draw_plots.R
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
56
57
58
library(dplyr)
library(ggplot2)
source("R/helpers.R")
source("R/draw_plot.R")
source("R/interval_trans.R")
## ------------------------------------------------------------------------
## scale y axis only:
## ------------------------------------------------------------------------
data <- readr::read_tsv("data/xydata_1.tsv")
data_intervals <- readr::read_tsv("data/y_intervals_1.tsv")
draw_plot(data,
x_trans=NULL,
y_trans=interval_trans,
y_trans_params=list(intervals = data_intervals %>%
select(from,to),
scaling_factors = data_intervals %>%
pull(scaling_factors)
))
## ------------------------------------------------------------------------
## scale both axes:
## ------------------------------------------------------------------------
data <- readr::read_tsv("data/xydata_2.tsv")
x_data_intervals <- readr::read_tsv("data/x_intervals_2.tsv")
y_data_intervals <- readr::read_tsv("data/y_intervals_2.tsv")
draw_plot(data,
x_trans=interval_trans,
x_trans_params=list(intervals = x_data_intervals %>%
select(from,to),
scaling_factors = x_data_intervals %>%
pull(scaling_factors)
),
y_trans=interval_trans,
y_trans_params=list(intervals = y_data_intervals %>%
select(from,to),
scaling_factors = y_data_intervals %>%
pull(scaling_factors)
)
)
## ------------------------------------------------------------------------
## Use a built-in transformer:
## ------------------------------------------------------------------------
draw_plot(readr::read_tsv("data/xydata_1.tsv"),
x_trans=NULL,
y_trans="log10" ##"sqrt"
)