Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
0 votes
1 answer
39 views

Ggplot2 fill legend labels not in correct order

I am creating the following graph with ggplot2. The problem is that all labels show in the chronological order except the last three. I cannot work around it. Does anyone see what causes the issue and ...
Joe94's user avatar
  • 125
1 vote
0 answers
49 views

Display fill legend as smudges of colors instead of using pre-defined shapes in ggplot

Let's say I have this dataframe df: df <- structure(list(Fruit = c("Apple", "Orange", "Graphe", "Apple", "Orange", "Graphe", "Apple&...
benson23's user avatar
  • 18.8k
0 votes
0 answers
90 views

ggplot question : se=FALSE does not work to remove confidence interval from the caption

I am trying to do a plot with a regression line and cannot remove the confidence interval color from the fill caption. ggplot(KF, aes(x = d18O, y = d66Zn)) + facet_grid(. ~ Tissue) + ...
MGall's user avatar
  • 1
0 votes
2 answers
149 views

In R, How to provide different shape and fill to the point, showing the legend for fill in ggplot?

For example, I have a data like below, population=rep(c("High", "Low"), time=5) year=rep(c("2020_H","2020_L","2020_O","2021_L","2021_O&...
Jin.w.Kim's user avatar
  • 884
0 votes
1 answer
37 views

Changing the fill colour in a stacked barchart in ggplot2

I have a very simple question. I need to add a legend and change the colour of the bars in a stacked barchart. I managed to split my barchart into three different colour groups according to the year ...
Devon's user avatar
  • 27
0 votes
1 answer
57 views

Combine fill and color legend in ggplot

I have found some Questions similar to my issue, but none that really fit. I have 4 data columns I want to plot, 3 as lines and 1 as area. I'd like to condense the Legend of the resulting Plot into a ...
polypus's user avatar
  • 55
2 votes
0 answers
38 views

Consistent legend key height in a vertical legend for fill [duplicate]

I would like to use a vertical legend in my plot. My legend labels are quite long and differ in the number of lines they take up. However, I would like the legend to show consistent heights for each ...
Nova's user avatar
  • 5,706
2 votes
1 answer
2k views

ggplot scale_fill_identity legend missing when specifying labels and breaks

I have data like this, where I want to specify my fill color within the data frame (color column). I want my legend to show the values in the cut_value column. When I specify both labels and breaks, ...
user42485's user avatar
  • 801
0 votes
0 answers
52 views

ggplot | Legend not filled

this question is different from this one and this one in the sense that I get a legend. However, the values in the legend only have coloured borders, and not the entire area. I am fairly sure there ...
fußballball's user avatar
0 votes
0 answers
70 views

Legend won't appear because I'm using fill instead of color

I have the following plot: kleinebox<-ggplot(iris, aes(x=Petal.Length, y=Sepal.Length))+ geom_point(aes(fill=Species), colour="black", pch=21, size=4)+ scale_fill_manual(values = c("#D89000","#...
Leo's user avatar
  • 136
0 votes
1 answer
3k views

ggplot scale alpha continuous fill color

I've tried to create an alpha plot but I couldn't find right way to do it. I tried different combination to figure out and I've almost there but I need a little help. My question is how can I get rid ...
eabanoz's user avatar
  • 251
44 votes
2 answers
94k views

Label minimum and maximum of scale fill gradient legend with text: ggplot2

I have a plot created in ggplot2 that uses scale_fill_gradientn. I'd like to add text at the minimum and maximum of the scale legend. For example, at the legend minimum display "Minimum" and at the ...
nofunsally's user avatar
  • 2,091
1 vote
1 answer
2k views

ggplot2 How to move legend, and how to fill and dodge on multiple variable?

Question 1: Is it possible to have ggplot fill by one variable, and dodge by another variable? In this example group I would like to group Claims within Categories? I have researched this site ...
Michael Bellhouse's user avatar