Skip to main content

All Questions

Tagged with
1 vote
1 answer
41 views

how to change the legend sharp to circle

library(ggplot2) food_choices <- c("Pizza", "Pasta", "Sushi", "Caesar Salad") counts <- c(17, 10, 8, 11) table <- data.frame(food_choices, counts) # ...
walter's user avatar
  • 11
0 votes
2 answers
37 views

ggplot2 legend not appearing

I'm having trouble producing a legend for my ggplot2 figure of categorical point data with a bar indicating the mean overlaid on top. plot <- ggplot(df, aes(tree, o18)) plot + geom_point() + ...
Lmack101010's user avatar
2 votes
1 answer
102 views

How to show legend in a plot with both bars and points?

I have a dataframe the looks as follows: COUNTRY YEAR y AT 2019 25 AT 2020 38.0 AT 2021 23.4 BE 2019 11.1 BE 2020 18.6 BE 2021 15.0 DK 2019 ...
Bob's user avatar
  • 516
1 vote
1 answer
39 views

Multi-layer geom_bar shade legend

I have a very trivial question but for some reason I cannot figure out a solution to this... Essentially, I have a stacked geom_bar plot where I'm looking at insertions and deletions for four ...
Matteo's user avatar
  • 209
1 vote
1 answer
50 views

How to split two geom_bar in two separate legends?

What I am trying to do here is to get a stacked bar plot which is working as expected except for the fact that I would like to have two separate legends, one for each set of stacked bars. In other ...
gabt's user avatar
  • 774
0 votes
1 answer
136 views

The legend disappear in my ggplot graph in R

I'd like to add a legend for these two graphs(geom_line and geom_bar), but i cannot see any legend in the screen according to my code. I want to make a legend which indicates the geom_bar and ...
Seoyoung Park's user avatar
1 vote
1 answer
616 views

How to show selected legend but show all the colors in stacked geom_bar

I'm creating a stacked bar plot of relative abundance data, but I only want to display selected few interesting taxa in the legend. I have tried using scale_fill_manual(values = sample(col_vector), ...
Max Qiu's user avatar
  • 13
0 votes
2 answers
181 views

Reorder Columns/Legend [duplicate]

Country_Of_Data Year Appr_Country Apprehension ## <chr> <chr> <chr> <dbl> ## 1 Afghanistan 2010 PAN 17 ## 2 Afghanistan 2011 PAN ...
Joseph Tapia Guzman's user avatar
0 votes
0 answers
165 views

How to use separate columns for x variable fill and label names in ggplot?

I am creating multiple series of plots for different vegetation types and using filter to subset the individual veg type being plotted. These are bar graphs and I'd like to use the same palette of ...
emmaflowers's user avatar
1 vote
1 answer
2k views

Control legends in ggplot with geom_bar and geom_point

I'm plotting a bar graph and a line/point graph on the same plot and I'm trying to have two legends, one for the points and one for the bars. However, I end up with 3 legends (instead of two) and the ...
Lo Bo's user avatar
  • 577
3 votes
0 answers
2k views

ggplot2: Stacked bar and legend on the top

I am trying to plot my data using stacked bar plot. I want to put the legend on the top of the plot for aesthetics reasons. However, when I do so the order of the does not match the order of the ...
degopwn's user avatar
  • 517
0 votes
0 answers
42 views

Display second variable different in ggplot geom_bar

I want to treat the display of my second variable (legend, In or out) different than the first variable (x-axis, Reason). So, in stead of having the fill of the Out category blue, I want it to be ...
SHW's user avatar
  • 491
1 vote
1 answer
3k views

legend change the color specified for geom_bar

I have the following plot that includes data from two different data frames: ggplot(one100, aes(x=hour, y=countPerHour)) + ylab("Times reached") + xlab("Hour of the day") + geom_bar( stat="...
Elena's user avatar
  • 61
0 votes
1 answer
3k views

ggplot2: Missing legend when specify color using fill in geom_bar

In the stacked bar chart, I am trying to specify the color for different bars. E.g, gradient green for treatment group and gradient blue for control group. However, after specifying the colors, I lost ...
Hannah Xin Yuan's user avatar
3 votes
2 answers
751 views

What is the "N = 1" box in my R geom_bar legend, and how do I remove?

These are the data: structure(list(Group.1 = c((name list) ), Group.2 = structure(c(4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 3L, 3L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 5L, 5L, 5L, 1L, 1L, 1L, 2L, 2L, ...
Mark Bunster's user avatar

15 30 50 per page