r-如何在ggplot2中设置标尺\颜色\布鲁尔()的导向尺寸?
我使用ggmap在谷歌地图上绘制散布图。我想调整scale\u color\u brewer()的指南字体大小。 数据是这样的r-如何在ggplot2中设置标尺\颜色\布鲁尔()的导向尺寸?,r,ggplot2,ggmap,R,Ggplot2,Ggmap,我使用ggmap在谷歌地图上绘制散布图。我想调整scale\u color\u brewer()的指南字体大小。 数据是这样的 shopGlng shopGlat shopPower 1 121.2149 31.04965 35 2 121.5595 31.22596 40 3 121.2326 31.00489 35 4 121.5184 31.22838 35 5 121.5160 31.15689 45 6
shopGlng shopGlat shopPower
1 121.2149 31.04965 35
2 121.5595 31.22596 40
3 121.2326 31.00489 35
4 121.5184 31.22838 35
5 121.5160 31.15689 45
6 121.4557 31.26370 35
7 121.5009 31.25928 35
8 121.1749 30.89317 35
9 121.1990 31.04987 35
10 121.5977 31.26352 35
这是我的密码
library(ggplot2)
library(magrittr)
library(ggmap)
data = read.csv('file')
# ny_center <- geocode("new york", source = "google")
sh_center <- geocode("shanghai", source = "google")
map <- get_googlemap(
zoom = 11,
# Use Alternate New York City Center Coords
center = sh_center %>% as.numeric,
maptype = "hybrid",
sensor = FALSE)
color <- as.character(data$shopPower/10)
p <- ggmap(map) +
geom_point(size = 1,
data = data,
aes(x = shopGlng,
y = shopGlat,
color = color)) +
xlab("") +
ylab("") +
scale_colour_brewer(palette = "Set1", guide = "legend")
p
库(ggplot2)
图书馆(magrittr)
图书馆(ggmap)
data=read.csv('文件')
#您可以使用legend.text
和legend.title
设置颜色栏的字体大小
p <- ggmap(map) +
geom_point(size = 1,
data = data,
aes(x = shopGlng,
y = shopGlat,
color = color)) +
xlab("") +
ylab("") +
scale_colour_brewer(palette = "Set1", guide = "legend")+
theme(legend.text = element_text(size=15),
legend.title = element_text(size=15) )
p您可以使用legend.text
和legend.title
设置颜色栏的字体大小
p <- ggmap(map) +
geom_point(size = 1,
data = data,
aes(x = shopGlng,
y = shopGlat,
color = color)) +
xlab("") +
ylab("") +
scale_colour_brewer(palette = "Set1", guide = "legend")+
theme(legend.text = element_text(size=15),
legend.title = element_text(size=15) )
p