All Questions
36
questions
0
votes
0
answers
33
views
How to plot the legend with combined_plot (ggplot2)
I created this script to display some environmental impacts for my research.
`legend_plot <- ggplot(data_longGW, aes(x = Crop_cycleGW, y = kg_CO2_eq, fill = Category)) +
geom_bar(stat = "...
1
vote
2
answers
42
views
Separate Legend Entries for Individual Outlined Overlapping Bars
I am creating a ggplot with multiple overlapping bar plots. The first underlying bar is filled with color and then I overlay one more set of bars with just an outline to show sub-components. I would ...
0
votes
1
answer
78
views
How to show values next to bars in tornado chart using ggplot in R [closed]
I have this table (T_Tornado_Total_EM_HM_sort):
And these are the lines that I used to make the tornado chart:
ggplot(T_Tornado_Total_EM_HM_sort, aes(Tipovi_troškova, RSD, fill=Populacija)) +
...
1
vote
1
answer
31
views
Order ggplot legend differently than elements in plot
Is there a way to order a legend in ggplot differently than the elements on the plot. for example I want the legend to be ordered Calanoida, Cladocera, Rotifera, and Cyclopoida but I want the ggplot ...
0
votes
0
answers
34
views
Same scale in legend for circular bar plot
Building on this post and code (with reproducible example) Different fill color for negative values in circular barplot, I want to plot two of these figures together as a comparison, like this:
But ...
3
votes
1
answer
72
views
Sharing multiple ggplot legend symbols with one label
I am trying to create a stacked barplot for one response over time (Year) across 3 different sites that I've separated into different facets (facet_wrap). I would like different colours per facet, and ...
0
votes
1
answer
74
views
How to create a bar graph to visually represent two variables, while keeping the same color for the x-axis variable?
For example, here is a data.
Genotype=c("A","A","B","B","C","C","A","A","B","B","C","...
1
vote
1
answer
56
views
Creating Separate Legend for Specific Line in ggplot2
I'm working on a data visualization project in R using the ggplot2 package. I have a bar plot with two bars per year and a trend line that applies to one of the bars. I'm trying to create a clear ...
0
votes
1
answer
59
views
ggplot2: Legend with barplot and line
I am trying to produce a graph that shows averages by decile of two variables (as they have very different values, I added a second y-axis). On variable is represented with bars, the other one with a ...
0
votes
1
answer
436
views
Why does my legend not match the colour of my bars in ggplot2?
I converted the bars of my graph from gray with a coloured outline to a solid fill which resulted in half of my error bars not being visible due to being the same colour. I therefore changed the ...
1
vote
4
answers
142
views
How to remove a single item from legend in ggplot
This question is related to this How to properly create this barplot in R using ggplot2?
If have this code which produces this plot:
library(tidyverse)
df=tibble(type=c('grass','forest','desert','crop'...
1
vote
1
answer
184
views
Force ggplot2 to show legends (barchar and geom_line)
Easy question: I'm creating a barchart in ggplot2 with both a stacked barchart and a geom_line referring to different parts of the same dataset.
No matter what I do, I'm unable to show the legends (...
0
votes
1
answer
243
views
Change order of legend in ggplot2
Example graph of my problem: https://i.sstatic.net/PQirh.jpg (Code at bottom)
I would like to reorder my legend in a bar plot in ggplot2. Currently the fill is on a scale from "Inside", &...
3
votes
1
answer
2k
views
Placing a Legend Title Above a Horizontal Legend Already Positioned at the Top of a Barplot ggplot
Issue:
I have done a lot of research and tried many different solutions and I could not find an answer to my problem, at least not one that worked for me. I am attempting to place the legend title '...
0
votes
1
answer
99
views
How to add legends to the barplot in R like shown in the below image?
I want to implement legend like tjhis