Skip to content

Commit

Permalink
Adjusted plot format for plot_graphs to work with handwriterApp
Browse files Browse the repository at this point in the history
The previous format of `plot_graphs` did not display properly when rendered in handwriterApp. The facet labels were huge and the graphs were miniscule. I tried removing the facet labels and added an argument for number of columns for the faceting. I will see if this works well in handwriterApp.
  • Loading branch information
stephaniereinders committed Oct 23, 2024
1 parent 7a629fc commit e293f77
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ plotLetter = function(doc, whichLetter, showPaths = TRUE, showCentroid = TRUE, s
#' doc <- processDocument(image_path)
#' plot_graphs(doc)
#'
plot_graphs <- function(doc) {
plot_graphs <- function(doc, ncol = NULL) {
format_graph_df <- function(graph, i) {
# bind global variables to fix check() note
Var1 <- NULL
Expand Down Expand Up @@ -383,9 +383,10 @@ plot_graphs <- function(doc) {
ggplot2::ggplot(ggplot2::aes(x, y)) +
ggplot2::geom_raster(aes(fill = as.factor(value)), na.rm=TRUE) +
ggplot2::scale_fill_manual(values = c("black", "white"), guide = "none") +
ggplot2::coord_fixed() +
ggplot2::coord_fixed() +
ggplot2::theme_void() +
ggplot2::facet_wrap(~graph)
ggplot2::facet_wrap(~graph, ncol = ncol) +
ggplot2::theme(strip.text = element_blank())

return(p)
}
Expand Down

0 comments on commit e293f77

Please sign in to comment.