Skip to content

Some custom theme elements aren't being reset #477

@grantmcdermott

Description

@grantmcdermott

Playing around with this a bit, I came across an issue that might be related but maybe it needs to go into a separate issue. I tried:

tinyplot(dist ~ speed, data = cars)

tinytheme("clean2", pch = 17, cex = 3)
tinyplot(dist ~ speed, data = cars)

tinytheme()
tinyplot(dist ~ speed, data = cars)

First, I was surprised that cex = 3 appears to be expanded to various elements (main, axis, x/ylab) which isn't obvious to me from the documentation.

Second, and probably more importantly, I was surprised that reverting to the default theme does not unset this. Shouldn't the third panel look like the first panel?

Originally posted by @zeileis in #442

Looks like this is limited to custom elements that aren't explicitly named in the default params list here.

tinyplot/R/tinytheme.R

Lines 177 to 221 in 8d331f3

theme_default = list(
tinytheme = "default",
adj = par("adj"), # 0.5,
adj.main = par("adj"), # 0.5,
adj.sub = par("adj"), # 0.5,
bg = "white", # par("bg") # "white"
bty = par("bty"), #"o",
cex.axis = par("cex.axis"), #1,
cex.main = par("cex.main"), #1.2,
cex.xlab = par("cex.axis"), #1,
cex.ylab = par("cex.axis"), #1,
col.axis = par("col.axis"), #1,
col.xaxs = par("col.axis"), #1,
col.yaxs = par("col.axis"), #1,
col.lab = par("col.lab"), #"black",
col.main = par("col.main"), #"black",
col.sub = par("col.sub"), #"black",
dynmar = FALSE,
facet.bg = NULL,
facet.border = NA,
family = par("family"), # ""
fg = par("fg"),
font = par("font"), # 1,
font.axis = par("font.axis"), # 1,
font.lab = par("font.lab"), # 1,
font.main = par("font.main"), # 2,
font.sub = par("font.sub"), # 2,
grid = FALSE,
grid.col = "lightgray",
grid.lty = "dotted",
grid.lwd = 1,
lab = par("lab"), # c(5, 5, 7),
las = par("las"), # 0,
lwd = par("lwd"), # 1,
lwd.axis = par("lwd"), # 1,
mar = c(5.1, 4.1, 4.1, 2.1), ## test
mgp = par("mgp"),
# palette.qualitative = "R4",
# palette.sequential = "Viridis",
pch = par("pch"), # 1,
side.sub = 1,
tck = NA,
xaxt = "standard",
yaxt = "standard"
)

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