cross
cross

Reputation: 1068

Changing the width of a point in ggplot

I know this is too much fine-tuning, but I wonder if it is possible to change the width of the line pch=21.

I am trying to draw plots for a limited space, and I am using small units. And when I use the pch=21 with fill=white, the line of the pch remains too this compared to the rest of the plot lines.

One option would be to plot with bigger units and then make the plot smaller using scaling in LATEX, but this is not really what I want to do.

Is it possible to modify the thickness of the line for pch=21?


ggplot(test, aes(x=roundedRealNumVehicles/2, y=1-value, colour=as.factor(t1-t0) ) ) +
  stat_summary(fun.y=mean, geom="line", alpha=0.85 ) + 
  stat_summary(fun.y=mean, geom="point", pch=21, fill="white", size=1, width=0.01, show_guide=F )
ggsave(path= "~/Desktop/pics/", file="test.pdf", width=9/1, height=6/1, units = "cm")

dput(test)

the units used in the ggsave are the tricky part

Upvotes: 0

Views: 1953

Answers (1)

Heroka
Heroka

Reputation: 13139

I don't know how to modify the thickness of pch21 (my guess would be it's an inherent part of the figure), but you could approach it in another way: plot two dots of different sizes on top of each other (largest first) and play around with their sizes until you're satisfied.

ggplot(test, aes(x=roundedRealNumVehicles/2, y=1-value, colour=as.factor(t1-t0) ) ) +
  stat_summary(fun.y=mean, geom="line", alpha=0.85 ) + 
  stat_summary(fun.y=mean, geom="point", color="red", size=1, width=0.01, show_guide=F )+
  stat_summary(fun.y=mean, geom="point", color="white", size=0.2, width=0.01, show_guide=F )

enter image description here

Upvotes: 1

Related Questions