Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow grayscale option for plot.FFTrees() #210

Merged
merged 5 commits into from Apr 21, 2024
Merged

Conversation

ndphillips
Copy link
Owner

@ndphillips ndphillips commented Apr 14, 2024

A user Guido Williams guido.l.williams@gmail.com emailed me asking for a grayscale option for plot.FFTrees().

Dear Nathaniel,

I have a question regarding the plot functions in the FFT package. Is there a simple way to print all plots/output in black and white/greyscale? For instance: plot(heart.fft, color = FALSE) or is there another way?
This would be very convenient for publication purposes.

This PR includes the new grayscale argument to plot.FFTrees() that enables this

See example below:

heart_fft <- FFTrees(formula = diagnosis ~.,
                     data = heart.train,
                     data.test = heart.test, 
                     decision.labels = c("Healthy", "Disease"))


plot(heart_fft, grayscale = TRUE)
image

Setting grayscale = FALSE (the default), gives us the color back

plot(heart_fft, grayscale = FALSE)
image

@ndphillips ndphillips changed the title WIP: Issue 209/grayscale Allow grayscale option for plot.FFTrees() Apr 15, 2024
@ndphillips ndphillips changed the title Allow grayscale option for plot.FFTrees() WIP: Allow grayscale option for plot.FFTrees() Apr 16, 2024
@ndphillips ndphillips marked this pull request as draft April 16, 2024 12:39
@ndphillips ndphillips marked this pull request as ready for review April 18, 2024 19:27
@ndphillips ndphillips changed the title WIP: Allow grayscale option for plot.FFTrees() Allow grayscale option for plot.FFTrees() Apr 18, 2024
@ndphillips
Copy link
Owner Author

Guido emailed me to confirm it works as desired:

It works like a charm! Thanks!

@hneth
Copy link
Collaborator

hneth commented Apr 19, 2024

This seems to be a nice enhancement and useful option — thanks for suggesting and implementing it!

An alternative approach to colors in FFT plots could collect all used ones in a vector and pass that as an argument. This would provide users with complete control over the colors, but the combination of a good default and a grayscale option probably covers 95% of all cases?

@ndphillips
Copy link
Owner Author

Thanks for the feedback @hneth ! I agree adding additional arguments to control the individual colors directly could be useful, but I'd prefer to save that for a future PR if needed.

In this PR I have also made a few modifications to DESCRIPTION and NEWS.md to conform to the conventions in the tidyverse (namely https://github.com/tidyverse/dplyr/blob/main/NEWS.md)

  • I changed the version to 2.0.0.9000 to avoid the need to increment each development version (i.e.; from 2.0.0.9009 to 2.0.0.90010). I think this will be easier for developers and assuming that most users are installing only stable versions from CRAN, they shouldn't be affected.
  • I simplified NEWS.md to not have so many sub-sections and additional descriptors. Again for the purpose of simplicity and to mimic the patterns in the tidyverse.

Happy to discuss reversing these changes if desired

@ndphillips ndphillips merged commit 0cdd7e6 into master Apr 21, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add plot(FFTrees, grayscale = TRUE) argument to allow printing to grayscale
2 participants