Skip to main content

All Questions

1 vote
1 answer
38 views

ggplot of multiple geom_sf datasets gives mismatched legend colours

I am trying to create a ggplot map which includes two simple feature line datasets. I would like the lines to either appear in the same legend, or a separate legend. However the approach I am taking ...
David's user avatar
  • 205
0 votes
1 answer
42 views

Conflict between scale_color_gradient2() and scale_color_manual()

What I want is to remove diffmean legend produced by geom_segment() and scale_color_gradient2() and add legend for both dotted line and solid line (geom_line()). I have tried: ggplot2::geom_segment(...
piblo95's user avatar
  • 337
0 votes
2 answers
217 views

How to fix the legend for a grouped scatter plot added with geom_ablines

I want to make a scatter plot with two different groups (based on Size) each plotted with specified colors (Blue and Red). In addition, I want to add 4 geom_ablines to the scatter plot with the same ...
Muhammad Usama Ashraf's user avatar
0 votes
0 answers
108 views

Wrong matching of colours in ggplot using scale color discrete [duplicate]

ggplot() + geom_line(data=Final_UDR_summary, aes(y=pass_rate_IIR, x=year_week, color="blue"),size=1) + geom_line(data=Final_UDR_summary, aes(y=pass_rate_IQR, x=year_week, color=&...
user15981608's user avatar
1 vote
1 answer
566 views

Add legend to ggplot2 line with point plot

I have a question about legends in ggplot2. I managed to plot two lines and two points in the same graph and want to add a legend with the two colors used. This is the code used P <- ggplot() + ...
volcano's user avatar
  • 13