r - How to change size of points of legend when 2 legends are present -
i have graph 2 legends present. need change size of points of 1 of legends.
i need change bullet size of "market type" in legend. use example here not work graph.
my code below:
k <- ggplot(subsetdf) + theme_bw() + geom_point( aes(y=y, x=x, size =total.unit.count, fill = region), shape=21)+ scale_colour_hue(aes(y=y, x=x),l=50) + # use darker palette normal geom_text_repel (aes(y=y, x=x, label = rownames(subsetdf))) + geom_smooth(aes(x=x, y=y),method=lm, # add linear regression lines se=false) + labs(y = "title", x = "title", title = "title", size = "size", fill = "fill")+ theme(plot.title = element_text (face = 'bold',size = 21,hjust = 0.5), legend.text = element_text(size = 16), legend.title = element_text(size = 18), axis.title.x = element_text(size=20), axis.title.y = element_text(size=20), axis.text.x = element_text(size = 18,angle=45, hjust=1), axis.text.y = element_text(size = 18,hjust = 1), panel.grid.major = element_blank(), panel.grid.minor = element_blank())+ scale_size_continuous(range = c(3,8))+ guides(colour = guide_legend(override.aes = list(size=10)))
you used fill
aesthetic guide, not color
. guide
override.
below example iris
dataset, code not reproducible.
library(ggplot2) ggplot(iris) + geom_point(aes(sepal.length, petal.length, size = sepal.width, fill = species), shape = 21) + guides(fill = guide_legend(override.aes = list(size=8)))
Comments
Post a Comment