grantmcdermott · GitHub

Fixes #388

I won't share just how many dead-ends I ended going down to resolve this. But I think I've cracked it now.

tl;dr For reasons that I don't fully understand, we can't wrap the whole draw_legend() function in recordGraphics() without messing up source calls (which is what #388 was ultimately about.) At the same time, simply wrapping the final legend/gradient_legend calls didn't work either for the Positron case (per #377). However, it turns out that the compromise solution is to wrap the fake legend construction (which we need for calculating the plot offset for outside legend placement), the offset calculation, and the final legend plotting call together... but only these steps.

I operationalised this by creating a new internal recordGraphics(tinylegend(...), ...) function.

Read the original on github.com ↗