Linked Questions

1 vote
1 answer
1k views

ggplot: setting title of legend with multiple attributes [duplicate]

I'd like to change the title of the legend generated using the code below. Note, I know I could put the data.frame and aesthetic directly in the ggplot() function call, but I don't in this example ...
Andy Stein's user avatar
1 vote
1 answer
436 views

Combine two legends in R [duplicate]

I am trying to combine two legends in R, so they show up closer together. This is different to the usual query people ask on combining legends, which involves combining legends so that, say, a shape ...
James's user avatar
  • 58
2 votes
0 answers
543 views

How to combine two manual scales in ggplot? [duplicate]

I have a plot with 2 lines. Each line has its own color and type, however I failed trying to create the legend for this plot. I created 2 scale_..._manual, one for the line types, and other one for ...
Daniel Valencia C.'s user avatar
0 votes
1 answer
229 views

Adding a second legend to line chart in ggplot2 in R [duplicate]

I have the following very simple data set which I am representing with a multi-line line chart. The dataset: foo <- c(105,205,301,489,516,678,755,877,956,1010) foo1 <- c(100,201,311,419,517,690,...
Abhiroop Sarkar's user avatar
0 votes
0 answers
53 views

ggplot2 - scale color manual interfering in scale shape manual and plotting two labels (legends) [duplicate]

EDIT: Stack said my question is very similar to this one (Combine legends for color and shape into a single legend) but that person wanted to join two legends in one and I just want the wrong one to ...
Karina Ramos's user avatar
0 votes
0 answers
14 views

ggplot2 generating 2 legends. How to remove 1? [duplicate]

Trying to determine how to keep the colored legend and remove the greyscale one. problem occured when I added the *labs(colour = "cover type") line. enter image description here ...
woodsy_will's user avatar
13 votes
1 answer
10k views

Why won't the ggplot2 legend combine manual fill and scale values?

Expected Behavior If I create a plot with ggplot2 and use separate, say, shape and fill scales to delineate data, I would expect the legend would delineate between "white" filled points (which look ...
briandk's user avatar
  • 6,899
3 votes
2 answers
16k views

How to create dashed lines in legend?

I am trying to create a ggplot consisting of 2 densities with straight lines and 2 dashed densities. 2 densities are blue and the other 2 are red. My plot should include a legend with colors and lines ...
Joachim Schork's user avatar
3 votes
2 answers
1k views

Plot two chart types (area and line) in one graph with separate legends

I've searched for a solution to my problem but haven't been able to find one that directly answers my question. For example, I've seen: Combining Bar and Line chart (double axis) in ggplot2 and Bar ...
hmhensen's user avatar
  • 3,095
3 votes
1 answer
6k views

Creating a ggplot legend with color and linetype based on two variables

In Creating a ggplot legend with both color and shape there is way how to combine shape and color but based on one variable. I wonder if this is possible if the variable is splitted into two variables....
giordano's user avatar
  • 3,092
4 votes
1 answer
3k views

Add multiple legends to ggplot2 when using geom_sf

My question combines two separate issues posted on before on Stackoverflow: i. Adding multiple legends to ggplot and ii. Add line legend to geom_sf. I would like to add multiple legends to ggplot2 (...
C Sev's user avatar
  • 143
0 votes
1 answer
3k views

How to merge legends in ggplot2? (keep shape, color and label)

I can't find a way to merge the two legends that I get with: ggplot(datapoidsmono, aes(x = time, y = weight)) + stat_summary(aes(color = group), fun.data="mean_sdl", fun.args = list(mult=1), geom="...
B_slash_'s user avatar
  • 345
3 votes
1 answer
2k views

How to change the line type of ellipses in ggbiplot?

Is it possible to change the type of lines of the normal probability ellipsoids in ggbiplot, e.g. have them dashed and dotted lines instead of or additional to the different colors? I couldn't find ...
raumkundschafter's user avatar
2 votes
1 answer
1k views

How to adjust legend for a colour-shape combiation in ggplot2?

I would like to rename the title and labels of this legend combining shape and colour elements. data <- data.frame(x = rep(seq(from=10, to=100, by=10), each=2), y = runif(20,0,1),...
Marco's user avatar
  • 2,727
0 votes
1 answer
3k views

Triple legend in ggplot2 with point shape, fill and color

My dataframe (see below for link) contains output from several models, which I want to "categorize" according to: model name (9 models) -> 9 shape fill colors model domain (each model has one of ...
AF7's user avatar
  • 3,192

15 30 50 per page