Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

theme_excel_new() doesn't display labels (and base size doesnt work as expected for title) #176

Open
@Yann-C-INN

Description

@Yann-C-INN

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_size does not work
  • When increasingbase_size it actually shrinks the plot, but does not change the text size
  • Also, when edited the source code i changedsize argument inelement_line() tolinewidth as usingsize is 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_size and 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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2026 Movatter.jp