teunbrand / ggh4x

ggplot extension: options for tailored facets, multiple colourscales and miscellaneous
https://teunbrand.github.io/ggh4x/
Other
534 stars 32 forks source link

`guide_stringlegend()` throws `Error in get_layer_key(...) : argument "data" is missing, no default` #159

Closed adcascone closed 1 week ago

adcascone commented 1 month ago

I tried recreating the second set of plots using the code provided in the "String legends" section of the "Miscellanous" vignette, but guide_stringlegend() throws the following error: Error in get_layer_key(...) : argument "data" is missing, no default

Here is the code I tried:

p <- ggplot(mpg, aes(displ, hwy)) + geom_point(aes(colour = class))
p + guides(colour = guide_stringlegend(face = "bold", spacing = 15))

image

I see that the function's lifecycle is marked as 'questioning' on the function reference site - are there plans to update this function in future package versions?

Thank you! Arianna C.

teunbrand commented 1 month ago

Hi thanks for inquiring!

It seems to be working fine on my end, using ggplot2 3.5.1 and ggh4x 0.2.8. What version combination of ggplot2 and ggh4x are you using?

are there plans to update this function in future package versions?

No I'm in the process of writing a separate package (gguidance) for guide extensions, where this one will be transferred to.

adcascone commented 1 month ago

Thanks for the reply - I'm using ggplot2 3.5.1 and ggh4x 0.2.6

And good to know about transferring this function to the new package - I appreciate the insight!

teunbrand commented 1 month ago

I'd recommend updating to 0.2.8, there were some breaking changes in ggplot2 that required some adaptation in ggh4x.

teunbrand commented 1 week ago

I'm going to go ahead and assume that updating has fixed the issue. I'll reopen if somebody points out I was mistaken.