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

All Questions

0 votes
0 answers
28 views

ggplot legend in R not recognising aesthetic changes for label category with no data points

Consider the following image: Although the underlying dataset does not contain values below 0.1 degrees Celsius, I want to and still can force the legend to display the label and box for 'Below 0.1', ...
shogi's user avatar
  • 65
1 vote
1 answer
80 views

Remove specific items from legend but keep aesthetic the same in ggplot

I would like to remove the no pipe items from the legend in this plot but keep the same plotting aesthetics. I have tried using scale_colour_discrete with breaks, which removed the intended items but ...
mrob27's user avatar
  • 73
1 vote
1 answer
28 views

Merging shape and color in ggplot legend

I apologize that this might be a repost of another question. FWIW I've tried solutions from multiple threads but haven't been successful in my efforts. How do I get my legend to include both shape and ...
burphound's user avatar
  • 175
1 vote
1 answer
553 views

legend not appearing for ggplot geom_point color aesthetics

I am attempting to generate a legend for ggplot geom_point color aesthetics. I have tried various combinations and browsed through already asked questions but have not come up with a solution. library ...
KP1's user avatar
  • 129
1 vote
1 answer
213 views

Can someone help me properly set up my ggplot legend with multiple defined aesthetics?

I would love to have a clearer legend in my ggplot (below). Specifically, the point shapes overlapping with line geometries is not clear. It would be nice to have one legend for the predictive data (...
Dieter Kahl's user avatar
0 votes
0 answers
135 views

Legend in aes_string for a Loop rstudio

I have a problem with displaying the legend on the chart. Using aes_string does not appear to me. Could you help me to show some kind of legend on the chart? The data I have is the following: > ...
GFHR's user avatar
  • 11
2 votes
1 answer
2k views

How to prevent R from alphabetically ranking data in ggplot and specify the order in which data is plotted (Data + Code + Graphs provided)?

I'm trying to fix an issue with my GGBalloonPlot graph with regards to how R processes the axis labels. By default R plots the data using the labels ranked in reverse alphabetical order but to ...
Etienne's user avatar
  • 23
0 votes
1 answer
1k views

How to hide legend for geom_label only in ggplot? [duplicate]

I have a ggplot object to plot an outcome by days of the week as such: ggplot(weekdays, aes(x=weekday, fill=weekday, y=outcome_mean, ymin=outcome_lci, ymax=outcome_uci)) + geom_col() + ...
Mel's user avatar
  • 740
5 votes
1 answer
2k views

ggplot legend key color and transparency

I'm plotting multiple lines together and they are transparent. However, I do not want the legend color to have any transparency. I attempted the override.aes but without success. This is similar to ...
Tom Logan's user avatar
  • 351
1 vote
1 answer
768 views

R ggplot2 whitespace in legend key when using override.aes for size

I've recently gotten frustrated by the same issue as reported here regarding the hacks required to make up for ggplot not adding NA fills to the legend (please if anyone knows an update to this, do ...
Emma Wiik's user avatar
2 votes
1 answer
5k views

Change legend order ggplot bar

I made a barplot in ggplot, but, purely for aesthetic reasons, I want to change the order of the Legend categories. Here's my script: library(ggplot2) df <- data.frame(Month = c(4, 5, 6, 7, 8, 9, ...
SHW's user avatar
  • 491
3 votes
1 answer
4k views

Add legend to ggplot histogram with different types of aesthetics

I want to add a legend to one of my plots, but I have different aesthetics and I never created a legend so I find it very difficult to determine how to build it. One of my aesthetics is a fill code, ...
SHW's user avatar
  • 491
6 votes
1 answer
984 views

extra variables in legend when wrapping ggplot2 in plotly R

I am having trouble making the legend of the following ggplot wrapped in ggplotly() show only one aesthetic. It currently shows three variables (shape, color, linetype) for each legend entry, but I ...
Devri A's user avatar
  • 63
0 votes
2 answers
887 views

Multiple plots using ggplot: Error in printing plot

In trying to answer this question: Compare emissions from motor vehicle sources in Baltimore City with emissions from motor vehicle sources in Los Angeles County, California (fips == "06037"). ...
Ganesh Bhat's user avatar
1 vote
1 answer
143 views

The fill legend is not updated when used with other aesthetics in ggplot2?

In the below bubble plot, my intention is to have legends for shape, size, and fill aesthetics. The first two went well, but the fill aesthetic for cluster was lost and all clusters appeared as black ...
doctorate's user avatar
  • 1,413

15 30 50 per page