diff --git a/NEWS.md b/NEWS.md index 24fce6a2..736b170a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -15,13 +15,22 @@ From now on, consider using other packages such as **parsnip** or **tidymodels** ## Minor changes +Plotting: + +- `plot.FFTrees()` now labels row of 2x2 confusion matrix as "Prediction" when using "test" data. - `plot.FFTrees()` now has a `truth.labels` argument which, if set, distinguishes labels of true (signal vs. noise) cases from decision outcomes. - `plot.FFTrees()` now has a `grayscale` argument which, if TRUE, creates a grayscale plot. + + + +Decision costs: + - Increased value of `cost_cues_default` from 0 to 1, so that default cue costs correspond to `mcu`. ## Details +- Fix bug for missing plot title. - Added `@aliases FFTrees-package` to documentation of main `FFTrees()` function. - Removed redundant `data_old` folder. @@ -498,6 +507,6 @@ Thus, the main tree building function is now `FFTrees()` and the new tree object ------ -[File `NEWS.md` last updated on 2024-05-21.] +[File `NEWS.md` last updated on 2024-09-04.] diff --git a/R/plotFFTrees_function.R b/R/plotFFTrees_function.R index 8fe72957..4cec1f39 100644 --- a/R/plotFFTrees_function.R +++ b/R/plotFFTrees_function.R @@ -1640,7 +1640,7 @@ plot.FFTrees <- function(x = NULL, # print(lloc) # 4debugging - # Classification table: ---- + # Classification table: 2x2 matrix / confusion matrix: ---- if (show.confusion) { @@ -1695,16 +1695,19 @@ plot.FFTrees <- function(x = NULL, decision.labels[1], adj = 1 ) + # Adjust row category label: + if (data == "test") { + row_lbl <- "Prediction" + } else { # default: + row_lbl <- "Decision" + } + text( x = final_classtable_x[1] - .065, y = mean(final_classtable_y), cex = header_cex, - "Decision" + row_lbl ) - # text(x = final_classtable_x[1] - .05, - # y = mean(final_classtable_y), cex = header_cex, - # "Decision", srt = 90, pos = 3) - # Add final frequencies: ---- diff --git a/R/util_plot.R b/R/util_plot.R index e4722fbe..259cd85d 100644 --- a/R/util_plot.R +++ b/R/util_plot.R @@ -422,7 +422,11 @@ get_x_dev <- function(string, csf = .80){ # csf: constant scaling factor # Returns a difference value that depends on string width (from min = .15 upwards). - n_char <- nchar(string) + if (!is.na(string)) { + n_char <- nchar(string) + } else { + n_char <- 0 + } if (n_char > 15){ # widen rectangle: