33# ' @name depict-SpecificSynopsis
44# ' @description depict method applied to SpecificSynopsis
55# ' @param x An object of class SpecificSynopsis
6- # ' @param base_height PARAM_DESCRIPTION, Default: 13
6+ # ' @param axis_text_sclg_1L_dbl Axis text scaling (a double vector of length one), Default: 1.5
7+ # ' @param axis_title_sclg_1L_dbl Axis title scaling (a double vector of length one), Default: 2
8+ # ' @param base_height_1L_dbl Base height (a double vector of length one), Default: 13
79# ' @param base_size_1L_dbl Base size (a double vector of length one), Default: 30
810# ' @param depnt_var_desc_1L_chr Dependent variable description (a character vector of length one), Default: 'NA'
11+ # ' @param dim_plot_heights_int Dimension plot heights (an integer vector), Default: c(10L, 1L)
12+ # ' @param dim_plot_log_log_tfmn_1L_lgl Dimension plot log log transformation (a logical vector of length one), Default: F
13+ # ' @param dim_plot_rows_cols_pair_int Dimension plot rows columns pair (an integer vector), Default: c(3L, 2L)
914# ' @param labels_chr Labels (a character vector), Default: c("A", "B", "C", "D")
1015# ' @param label_x_1L_dbl Label x (a double vector of length one), Default: 0.2
1116# ' @param label_y_1L_dbl Label y (a double vector of length one), Default: 0.9
1217# ' @param label_size_1L_dbl Label size (a double vector of length one), Default: 30
18+ # ' @param legend_sclg_1L_dbl Legend scaling (a double vector of length one), Default: 2
1319# ' @param mdl_idxs_int Model indices (an integer vector), Default: 1:2
20+ # ' @param rel_heights_dbl Rel heights (a double vector), Default: c(4, 10, 1)
21+ # ' @param scale_dbl Scale (a double vector), Default: c(0.9, 0.9, 0.9)
1422# ' @param timepoint_old_nms_chr Timepoint old names (a character vector), Default: 'NA'
1523# ' @param timepoint_new_nms_chr Timepoint new names (a character vector), Default: 'NA'
1624# ' @param use_png_fls_1L_lgl Use png files (a logical vector of length one), Default: F
25+ # ' @param utl_plot_label_1L_chr Utility plot label (a character vector of length one), Default: ' '
26+ # ' @param utl_by_rnd_plots_params_ls Utility by round plots parameters (a list), Default: list(width_1L_dbl = 6, height_1L_dbl = 4)
1727# ' @param what_1L_chr What (a character vector of length one), Default: 'composite_mdl'
1828# ' @param write_1L_lgl Write (a logical vector of length one), Default: F
29+ # ' @param y_label_1L_chr Y label (a character vector of length one), Default: ' '
1930# ' @return Plot (a plot)
2031# ' @rdname depict-methods
2132# ' @aliases depict,SpecificSynopsis-method
2233# ' @export
2334# ' @importFrom ready4show ready4show_correspondences
24- # ' @importFrom cowplot save_plot
25- # ' @importFrom ready4 depict
26- methods :: setMethod ("depict ", "SpecificSynopsis", function (x, base_height = 13, base_size_1L_dbl = 30, depnt_var_desc_1L_chr = NA_character_,
27- labels_chr = c(" A" , " B" , " C" , " D" ), label_x_1L_dbl = 0.2 ,
28- label_y_1L_dbl = 0.9 , label_size_1L_dbl = 30 , mdl_idxs_int = 1 : 2 ,
35+ # ' @importFrom rlang exec
36+ # ' @importFrom youthvars make_var_by_round_plt make_sub_tot_plts
37+ # ' @importFrom ready4 get_from_lup_obj depict
38+ # ' @importFrom cowplot get_legend plot_grid save_plot
39+ # ' @importFrom ggplot2 theme
40+ methods :: setMethod ("depict ", "SpecificSynopsis", function (x, axis_text_sclg_1L_dbl = 1.5, axis_title_sclg_1L_dbl = 2,
41+ base_height_1L_dbl = 13 , base_size_1L_dbl = 30 , depnt_var_desc_1L_chr = NA_character_ ,
42+ dim_plot_heights_int = c(10L , 1L ), dim_plot_log_log_tfmn_1L_lgl = F ,
43+ dim_plot_rows_cols_pair_int = c(3L , 2L ), labels_chr = c(" A" ,
44+ " B" , " C" , " D" ), label_x_1L_dbl = 0.2 , label_y_1L_dbl = 0.9 ,
45+ label_size_1L_dbl = 30 , legend_sclg_1L_dbl = 2 , mdl_idxs_int = 1 : 2 ,
46+ rel_heights_dbl = c(4 , 10 , 1 ), scale_dbl = c(0.9 , 0.9 , 0.9 ),
2947 timepoint_old_nms_chr = NA_character_ , timepoint_new_nms_chr = NA_character_ ,
30- use_png_fls_1L_lgl = F , what_1L_chr = " composite_mdl" , write_1L_lgl = F )
48+ use_png_fls_1L_lgl = F , utl_plot_label_1L_chr = " " , utl_by_rnd_plots_params_ls = list (width_1L_dbl = 6 ,
49+ height_1L_dbl = 4 ), what_1L_chr = " composite_mdl" , write_1L_lgl = F ,
50+ y_label_1L_chr = " " )
3151{
3252 plt <- NULL
3353 outp_smry_ls <- append(x @ b_SpecificResults @ a_SpecificShareable @ shareable_outp_ls ,
@@ -45,10 +65,43 @@ methods::setMethod("depict", "SpecificSynopsis", function (x, base_height = 13,
4565 labels_chr = labels_chr , label_x_1L_dbl = label_x_1L_dbl ,
4666 label_y_1L_dbl = label_y_1L_dbl , label_size_1L_dbl = label_size_1L_dbl ,
4767 mdl_idxs_int = mdl_idxs_int , use_png_fls_1L_lgl = use_png_fls_1L_lgl )
48- if (write_1L_lgl ) {
49- cowplot :: save_plot(paste0(outp_smry_ls $ path_to_write_to_1L_chr ,
50- " /dens_and_sctr.png" ), plt , base_height = base_height )
51- }
68+ write_path_1L_chr <- paste0(outp_smry_ls $ path_to_write_to_1L_chr ,
69+ " /dens_and_sctr.png" )
70+ }
71+ if (what_1L_chr == " composite_utl" ) {
72+ ds_descvs_ls <- manufacture_SpecificSynopsis(x , what_1L_chr = " ds_descvs_ls" )
73+ outp_smry_ls <- append(x @ b_SpecificResults @ a_SpecificShareable @ shareable_outp_ls ,
74+ x @ b_SpecificResults @ b_SpecificPrivate @ private_outp_ls )
75+ maui_domains_col_nms_chr <- x @ c_SpecificParameters @ domain_labels_chr
76+ first_plt <- rlang :: exec(youthvars :: make_var_by_round_plt ,
77+ !!! list (data_tb = outp_smry_ls $ scored_data_tb , legend_sclg_1L_dbl = legend_sclg_1L_dbl ,
78+ var_nm_1L_chr = ds_descvs_ls $ utl_wtd_var_nm_1L_chr ,
79+ round_var_nm_1L_chr = ds_descvs_ls $ round_var_nm_1L_chr ,
80+ x_label_1L_chr = ds_descvs_ls $ dictionary_tb %> %
81+ ready4 :: get_from_lup_obj(match_value_xx = ds_descvs_ls $ utl_wtd_var_nm_1L_chr ,
82+ match_var_nm_1L_chr = " var_nm_chr" , target_var_nm_1L_chr = " var_desc_chr" ,
83+ evaluate_1L_lgl = F ) %> % as.vector(), label_fill_1L_chr = utl_plot_label_1L_chr ,
84+ axis_text_sclg_1L_dbl = axis_text_sclg_1L_dbl ,
85+ axis_title_sclg_1L_dbl = axis_title_sclg_1L_dbl ,
86+ y_label_1L_chr = y_label_1L_chr ))
87+ second_plt <- rlang :: exec(youthvars :: make_sub_tot_plts ,
88+ !!! list (data_tb = outp_smry_ls $ scored_data_tb , add_legend_1L_lgl = F ,
89+ axis_text_sclg_1L_dbl = axis_text_sclg_1L_dbl ,
90+ axis_title_sclg_1L_dbl = axis_title_sclg_1L_dbl ,
91+ col_nms_chr = maui_domains_col_nms_chr , legend_sclg_1L_dbl = legend_sclg_1L_dbl ,
92+ plot_rows_cols_pair_int = dim_plot_rows_cols_pair_int ,
93+ round_var_nm_1L_chr = ds_descvs_ls $ round_var_nm_1L_chr ,
94+ heights_int = dim_plot_heights_int , make_log_log_tfmn_1L_lgl = dim_plot_log_log_tfmn_1L_lgl ,
95+ y_label_1L_chr = y_label_1L_chr ))
96+ legend_ls <- cowplot :: get_legend(first_plt )
97+ plt <- cowplot :: plot_grid(first_plt + ggplot2 :: theme(legend.position = " none" ),
98+ second_plt , legend_ls , nrow = 3L , rel_heights = rel_heights_dbl ,
99+ scale = scale_dbl )
100+ write_path_1L_chr <- paste0(x @ a_Ready4showPaths @ outp_data_dir_1L_chr ,
101+ " /Output/_Descriptives/combined_utl.png" )
102+ }
103+ if (write_1L_lgl ) {
104+ cowplot :: save_plot(write_path_1L_chr , plt , base_height = base_height_1L_dbl )
52105 }
53106 return (plt )
54107})
0 commit comments