thomasp85 / ggforce

Accelerating ggplot2
https://ggforce.data-imaginist.com
Other
916 stars 105 forks source link

geom_circle() ignoring linewidth parameter #280

Closed markeletona closed 1 year ago

markeletona commented 1 year ago

Hi!

I've just found out that when modifying the width of the lines in geom_circle(), the linewidth parameter is ignored.

See, based on the example from the docs:

library(ggplot2)
library(ggforce)

circles <- data.frame(
  x0 = rep(1:3, 3),
  y0 = rep(1:3, each = 3),
  r = seq(0.1, 1, length.out = 9)
)

# Fails to change linewidth:
ggplot() +
  geom_circle(aes(x0 = x0, y0 = y0, r = r, fill = r), linewidth = 5, data = circles) +
  coord_fixed()

# A warning message is returned:
# Warning message:
# Ignoring unknown parameters: linewidth

irudia

However, if size is provided instead of linewidth, the line width is changed:

ggplot() +
  geom_circle(aes(x0 = x0, y0 = y0, r = r, fill = r), size = 5, data = circles) +
  coord_fixed()

irudia

From the documentation I understand that the intended behaviour should be providing the line width via the linewidth aesthetic, not size (which is not mentioned in the docs). lineend is also ignored. All other aesthetics seem to behave just fine.

I hope it is of help!

thomasp85 commented 1 year ago

This is because the dev version is in anticipation of the change to using linewidth in gglot2 in the coming release. If you don't have the dev version of ggplot2 installed then linewidth won't be recognised

mduvekot commented 1 year ago

Using ggforce version 0.4.1.9000 and ggplot2 version 3.4.0, I still cant get geom_circle to work with either linewidth or size.