Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
196 views
in Technique[技术] by (71.8m points)

r - Smaller line thickness in ggplot map

I am creating a map of UK election results, coloured by constituencies. Fill is the percent voted Labour and then I have a few constituencies highlighted using a variable coded 1 or 0 (red wall seats). It's looking pretty much how I want it (still need to tweak a few things), except the red line for the highlighted places is too thick. How can I make it thinner? This is the code for the map:

map.2010 <- ggplot(uk.df) + # creating plot
  geom_sf(data = uk.df,
          aes(colour = as.factor(red_wall), geometry = geometry,
              fill = lab_share, size = 0.01)) + # fill by labour share
  scale_color_manual(values = c('1' = 'red', '0' = NA), 
                     labels = c('1' = 'Red Wall Seats'), 
                     breaks = c('1')) + # to highlight red wall seats
  coord_sf(xlim = c(2e+05, 6e+05), ylim = c(2e+05, 7e+05), expand = FALSE) + # to zoom in
  scale_fill_viridis(option="viridis") + # to change colours
  ggtitle("Labour's Share of the Vote in the 2010 General Election") + # title
  labs(fill = "Labour Share (%)", colour = "") + # legend titles
  theme(plot.title = element_text(lineheight = .8, face = "bold", size = 11, hjust = 0.2), # title
        axis.text.x = element_blank(), # remove x axis labels
        axis.text.y = element_blank(), # remove y axis labels  
        axis.ticks = element_blank(), # remove axis ticks
        panel.grid.major = element_blank(), panel.grid.minor = element_blank()) # remove grid lines

Which produces this map: enter image description here Any help would be appreciated. Thank you.

question from:https://stackoverflow.com/questions/65598532/smaller-line-thickness-in-ggplot-map

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...