- Notifications
You must be signed in to change notification settings - Fork225
Open
Description
This was originally a bug report issue but I was able to edit the source code and fix it myself, but I couldnt submit a pull request so I attached what I wrote
Problem:
base_sizedoes not work- When increasing
base_sizeit actually shrinks the plot, but does not change the text size - Also, when edited the source code i changed
sizeargument inelement_line()tolinewidthas usingsizeis deprecated as of ggplot2 3.4.0 - as the warning states.
Changes I made:
- From Google, I found the Points to MM coefficient and set it within the function to be 0.352777778.
-I then re-coded everywhere where it saidelement_text(size = 9,...)to besize = base_sizeand re-codedplot.title()tosize = rel(1.5555)which corresponds to the original decision (base size = 9, title = 14).
I did not changeaxis.title that is set to blank, although I would suggest to not ommit axis labels as a default.
My corrected (and tested) code:
theme_excel_new <- function(base_size=9, base_family = "sans") { PT_TO_MM <- 0.352777778 colorlist <- list( lt_gray = "#D9D9D9", gray = "#BFBFBF", dk_gray = "#595959" ) theme_bw( base_family = base_family, base_size = base_size ) + theme( text = element_text( colour = colorlist$dk_gray, size = base_size ), line = element_line( linetype = "solid", colour = colorlist$gray ), rect = element_rect( linetype = 0, colour = "white" ), panel.grid.major = element_line( linetype = "solid", colour = colorlist$gray, linewidth = 0.75 * PT_TO_MM ), panel.grid.minor = element_blank(), axis.title = element_blank(), axis.text = element_text( colour = colorlist$dk_gray, size = base_size ), strip.background = element_rect( fill = NA ), strip.text = element_text( colour = colorlist$dk_gray, size = base_size ), axis.ticks = element_blank(), panel.background = element_blank(), panel.border = element_rect(colour = NA), title = element_text( face = "plain", hjust = 0.5 ), plot.title = element_text( hjust = 0.5, size = rel(1.555555) ), plot.subtitle = element_blank(), legend.position = "bottom", legend.text = element_text( size = base_size, colour = colorlist$dk_gray ), legend.title = element_blank(), )}Metadata
Metadata
Assignees
Labels
No labels