Skip to content

Commit ed19e6d

Browse files
committed
Remove some dependencies
1 parent 827ea11 commit ed19e6d

File tree

5 files changed

+492
-1050
lines changed

5 files changed

+492
-1050
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ Description: Creates spc charts with control limits and centre line
1010
calculations partitioned into distinct periods.
1111
License: GPL-3
1212
Imports:
13+
cowplot,
1314
DiagrammeR,
1415
dplyr (>= 1.1.1),
1516
fpCompare,
1617
ggplot2 (>= 3.4.2),
17-
ggpubr (>= 0.6.0),
1818
lifecycle (>= 1.0.3),
1919
magrittr (>= 2.0.3),
2020
rlang (>= 1.1.0),

R/add_annotation_data.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ add_annotations_to_plot_pp <- function(p,
139139
segment.inflect = FALSE,
140140
segment.square = FALSE,
141141
arrow = grid::arrow(length = grid::unit(0.015, "npc")),
142-
na.rm = TRUE)
142+
na.rm = TRUE,
143+
max.overlaps = Inf)
143144
} else {
144145
p_annotated <- p + ggrepel::geom_text_repel(ggplot2::aes(x = x,
145146
y = cl,
@@ -153,7 +154,8 @@ add_annotations_to_plot_pp <- function(p,
153154
force = 0,
154155
hjust = 0,
155156
min.segment.length = Inf,
156-
na.rm = TRUE)
157+
na.rm = TRUE,
158+
max.overlaps = Inf)
157159
}
158160

159161
return(p_annotated)

R/visualisation.R

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,20 @@ create_spc_plot <- function(df,
128128
p_mr <- p_mr +
129129
ggplot2::labs(caption = caption)
130130

131-
p <- ggpubr::ggarrange(p, p_mr,
132-
ncol = 1,
133-
nrow = 2,
134-
legend = "right",
135-
common.legend = TRUE,
136-
align = "v")
131+
legend <- cowplot::get_legend(p)
132+
133+
p_no_legend <- p + ggplot2::theme(legend.position = "none")
134+
p_mr_no_legend <- p_mr + ggplot2::theme(legend.position = "none")
135+
136+
p <- cowplot::plot_grid(
137+
cowplot::plot_grid(p_no_legend, p_mr_no_legend,
138+
ncol = 1,
139+
align = "v"),
140+
legend,
141+
ncol = 2,
142+
rel_widths = c(1, 0.2)
143+
)
144+
137145
}
138146

139147
return(p)
@@ -159,7 +167,7 @@ create_timeseries_plot <- function(df,
159167
ggplot2::theme(panel.grid.major.y = ggplot2::element_blank(),
160168
panel.grid.major.x = ggplot2::element_line(
161169
colour = "grey80"
162-
),
170+
),
163171
panel.grid.minor = ggplot2::element_blank(),
164172
panel.background = ggplot2::element_blank(),
165173
axis.text.x = ggplot2::element_text(angle = 45,
@@ -259,18 +267,18 @@ format_SPC <- function(cht,
259267
override.aes = list(
260268
alpha = if(
261269
!is.na(first_display_period)
262-
) {
263-
c(1, 0.4)
264-
} else {
265-
c(1)
266-
}
270+
) {
271+
c(1, 0.4)
272+
} else {
273+
c(1)
274+
}
267275
)
268276
)
269277
) +
270278
ggplot2::theme(panel.grid.major.y = ggplot2::element_blank(),
271279
panel.grid.major.x = ggplot2::element_line(
272280
colour = "grey80"
273-
),
281+
),
274282
panel.grid.minor = ggplot2::element_blank(),
275283
panel.background = ggplot2::element_blank(),
276284
axis.text.x = ggplot2::element_text(angle = 45,

data-raw/algorithm_documentation_data.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ get_log_explanation_table <- function() {
117117
algorithm_flow_chart_string <- get_algorithm_flow_chart_string()
118118
log_explanation_table <- get_log_explanation_table()
119119

120-
usethis::use_data(algorithm_flow_chart_string,
121-
log_explanation_table,
122-
internal = TRUE,
123-
overwrite = TRUE)
120+
# usethis::use_data(algorithm_flow_chart_string,
121+
# log_explanation_table,
122+
# internal = TRUE,
123+
# overwrite = TRUE)
124124

0 commit comments

Comments
 (0)