Copy original theme eactly and apply to plots
This commit is contained in:
@@ -93,10 +93,9 @@ theme_publication <- function(base_size = 14, base_family = "sans", legend_posit
|
|||||||
theme(
|
theme(
|
||||||
plot.title = element_text(face = "bold", size = rel(1.2), hjust = 0.5),
|
plot.title = element_text(face = "bold", size = rel(1.2), hjust = 0.5),
|
||||||
text = element_text(),
|
text = element_text(),
|
||||||
panel.border = element_rect(colour = NA),
|
|
||||||
panel.background = element_rect(colour = NA),
|
panel.background = element_rect(colour = NA),
|
||||||
panel.border = element_rect(colour = NA),
|
|
||||||
plot.background = element_rect(colour = NA),
|
plot.background = element_rect(colour = NA),
|
||||||
|
panel.border = element_rect(colour = NA),
|
||||||
axis.title = element_text(face = "bold", size = rel(1)),
|
axis.title = element_text(face = "bold", size = rel(1)),
|
||||||
axis.title.y = element_text(angle = 90, vjust = 2),
|
axis.title.y = element_text(angle = 90, vjust = 2),
|
||||||
axis.title.x = element_text(vjust = -0.2),
|
axis.title.x = element_text(vjust = -0.2),
|
||||||
@@ -108,7 +107,7 @@ theme_publication <- function(base_size = 14, base_family = "sans", legend_posit
|
|||||||
legend.key = element_rect(colour = NA),
|
legend.key = element_rect(colour = NA),
|
||||||
legend.position = legend_position,
|
legend.position = legend_position,
|
||||||
legend.direction = ifelse(legend_position == "right", "vertical", "horizontal"),
|
legend.direction = ifelse(legend_position == "right", "vertical", "horizontal"),
|
||||||
legend.key.size = unit(0.2, "cm"),
|
legend.key.size = unit(0.5, "cm"),
|
||||||
legend.spacing = unit(0, "cm"),
|
legend.spacing = unit(0, "cm"),
|
||||||
legend.title = element_text(face = "italic"),
|
legend.title = element_text(face = "italic"),
|
||||||
plot.margin = unit(c(10, 5, 5, 5), "mm"),
|
plot.margin = unit(c(10, 5, 5, 5), "mm"),
|
||||||
@@ -395,7 +394,7 @@ generate_and_save_plots <- function(out_dir, filename, plot_configs, grid_layout
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Start building the plot with aes_mapping
|
# Start building the plot with aes_mapping
|
||||||
plot_base <- ggplot(df, aes_mapping)
|
plot_base <- ggplot(df, aes_mapping) + theme_publication()
|
||||||
|
|
||||||
# Use appropriate helper function based on plot type
|
# Use appropriate helper function based on plot type
|
||||||
plot <- switch(config$plot_type,
|
plot <- switch(config$plot_type,
|
||||||
|
|||||||
Reference in New Issue
Block a user