Skip to content

Issue 555#568

Draft
katrinabrock wants to merge 3 commits intograntmcdermott:mainfrom
katrinabrock:issue-555
Draft

Issue 555#568
katrinabrock wants to merge 3 commits intograntmcdermott:mainfrom
katrinabrock:issue-555

Conversation

@katrinabrock
Copy link
Copy Markdown

@katrinabrock katrinabrock commented Apr 2, 2026

I've made an attempt to solve issue #555 , but it's not quite working. The plot I'm getting looks like this:

image
diff plot image

So pane A is almost right and pane B is further off.

I've diagnosed that when usr is set manually, asp is not taken into account.

tinyplot/R/facet.R

Lines 325 to 328 in ba46791

fusr[[ii]] = c(xext, yext)
assign(".fusr", fusr, envir = get(".tinyplot_env", envir = parent.env(environment())))
# Explicitly set (override) the current facet extent
par(usr = fusr[[ii]])

I've attempted to translate the logic used by plot.window(). However, it's not working. I believe the issue is that grconvertX(1, "npc", "inches") is not actually equivalent to GConvertXUnits(1.0, NPC, INCHES, dd) or maybe I'm calling grconvertX in the wrong context.

@katrinabrock
Copy link
Copy Markdown
Author

katrinabrock commented Apr 22, 2026

Ok, this seems very strange to me. This is totally outside tinyplot context:

print_scale <- function(from = "npc", to = "inches") print(c(
  grconvertX(1, from, to),
  grconvertY(1, from, to)
))

print_scale()

print("set mfrow")
par(mfrow = c(1,2))
print_scale()

print("mfg=c(1,1)")
par(mfg = c(1,1))
print_scale()

print("mfg=c(1,2)")
par(mfg = c(1,2))
print_scale()

Result:

[1] 6.58 6.18
[1] "set mfrow"
[1] 6.58 6.18
[1] "mfg=c(1,1)"
[1] 3.08 6.18
[1] "mfg=c(1,2)"
[1] 6.58 6.18

It seems very odd that setting the first figure vs the second figure to be drawn next would impact npc->inches conversion.

@grantmcdermott or @zeileis I would love some input here. I read #65 which seems related, but I still feel like there's something fundamental I'm missing here.

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.

1 participant