Skip to content

Commit

Permalink
refactor: plot_output_handler
Browse files Browse the repository at this point in the history
- also bump version for dev
  • Loading branch information
jiajic committed Aug 15, 2024
1 parent 1be673b commit befbf25
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 22 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: GiottoVisuals
Title: Visuals for the Giotto spatial biology analysis ecosystem
Version: 0.2.4
Version: 0.2.5
Authors@R: c(
person("Ruben", "Dries", email = "[email protected]",
role = c("aut", "cre"), comment = c(ORCID = "0000-0001-7650-7754")),
Expand Down
6 changes: 5 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@

# GiottoVisuals 0.2.4
# GiottoVisuals 0.2.5



# GiottoVisuals 0.2.4 (2024/07/26)

## enhancements
- `giottoLargeImage` `max_window` and `colors` slot info is now followed during ggplot plotting
Expand Down
32 changes: 12 additions & 20 deletions R/aux_output.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
#' @examples
#' g <- GiottoData::loadGiottoMini("vizgen")
#' g_spatplot <- spatPlot2D(g, return_plot = TRUE)
#'
#'
#' plot_output_handler(g, plot_object = g_spatplot, save_plot = FALSE)
#'
#'
#' @export
plot_output_handler <- function(
gobject,
Expand All @@ -44,18 +44,10 @@ plot_output_handler <- function(
# IF setting is NULL then the appropriate setting from gobject instructions
# will be checked and used.
# IF setting is NOT NULL then the provided value will be used directly.
show_plot <- ifelse(is.null(show_plot),
readGiottoInstructions(gobject, param = "show_plot"),
show_plot
)
save_plot <- ifelse(is.null(save_plot),
readGiottoInstructions(gobject, param = "save_plot"),
save_plot
)
return_plot <- ifelse(is.null(return_plot),
readGiottoInstructions(gobject, param = "return_plot"),
return_plot
)
show_plot <- show_plot %null% instructions(gobject, param = "show_plot")
save_plot <- save_plot %null% instructions(gobject, param = "save_plot")
return_plot <- return_plot %null%
instructions(gobject, param = "return_plot")


## print plot ##
Expand All @@ -67,7 +59,7 @@ plot_output_handler <- function(
if (save_plot) {
checkmate::assert_character(default_save_name)
checkmate::assert_list(save_param)

do.call(
"all_plots_save_function",
c(
Expand Down Expand Up @@ -103,9 +95,9 @@ plot_output_handler <- function(
# checkmate::assert_class(gobject, 'giotto')
# checkmate::assert_character(default_save_name)
# checkmate::assert_list(save_param)
#
#
# instr = instructions(gobject)
#
#
# ## output settings detection ##
# # IF setting is NA then the appropriate setting from gobject instructions
# # will be checked and used.
Expand All @@ -121,12 +113,12 @@ plot_output_handler <- function(

# plot_output_handler_do = function(gplot_out) {
# checkmate::assert_class(gplot_out, 'giottoPlotOutput')
#
#
# ## print plot ##
# if(gplot_out$show_plot) {
# print(gplot_out$plot_object)
# }
#
#
# ## save plot ##
# if(gplot_out$save_plot) {
# do.call('all_plots_save_function',
Expand All @@ -136,7 +128,7 @@ plot_output_handler <- function(
# save_param)
# )
# }
#
#
# ## return plot ##
# if(return_plot) {
# invisible(return(plot_object))
Expand Down

0 comments on commit befbf25

Please sign in to comment.