All Questions
12
questions
0
votes
2
answers
81
views
How do I add a graphical legend to the bottom of a figure using ggplot?
I am interested in creating a figure using ggplot2 similar to the one drafted here. I have created the top section using ggplot and facet_wrap but have yet to find a way to add a tiled legend to the ...
0
votes
0
answers
66
views
Add general label to facets ggplot2
I am trying to add a general legend to facets in a plot. But I can´t. I was looking but the nearest question is this: How do you add a general label to facets in ggplot2?. Anyway, this it isn't an ...
0
votes
1
answer
326
views
ggplot2: space legend per facet grid / manipulate position of individual legend entries [duplicate]
I have following code:
ggplot(data = mpg[is.element(mpg$manufacturer, c("audi", "dodge", "ford")),], mapping = aes(x = year, colour = manufacturer)) +
geom_line(stat = &...
2
votes
2
answers
853
views
ggplot: Separate legend for both a geom_vline and geom_hline
I'm trying to make a separate legend for geom_vline and geom_hline in a ggplot with facets.
Here is my code:
set.seed(1)
vec1 = rnorm(20)
set.seed(2)
vec2 = rnorm(20)
set.seed(3)
vec3 = rnorm(20)
vec ...
2
votes
1
answer
1k
views
How to add greek letters to Facet_Grid strip labels?
I have created the plot below using facet_grid and have used the labeller argument to add "p=" and "mu[2]" labels to the gray strips around the grid. I would like to replace "...
0
votes
1
answer
300
views
is there a way to show the same legend for each facet in ggplot2
reproducible example:
library(datasets)
library(tidyverse)
data(iris)
iris$facet <- "A"
A <- iris
iris$facet <- "B"
B <- iris
iris <- rbind(A,B)
iris %>%
...
4
votes
1
answer
2k
views
R: Reliable conversion between gtable and ggplot objects. How to make lemon::reposition_legend() work after ggplot_build()?
I have a pretty complicated case at hand with ggplot2. I tried to exemplify it with a MWE using iris data below.
I just have boxplots in facets, and wanted to move the legend to take the space of the ...
3
votes
0
answers
7k
views
ggplot different legends for different facets
I'd like to use different legends for 2 of the facets in this plot. The facets for 'Sharks' and 'Tunas' include multiple fish species, so I would like each facet to contain a unique legend for those ...
2
votes
1
answer
3k
views
Display the legend inside the graph when wrapping with ggplot2
How can I do...
... instead of the default ...
?
7
votes
1
answer
10k
views
How to add a label for a vertical line with legend in ggplot2
R 3.1.2/ggplot2_1.0.0/Windows7
How can one add 2 vertical lines with legends in a faceted graph without them changing the linetype? In the following example i can't get the legends to appear as I ...
68
votes
1
answer
49k
views
R ggplot2 legend inside the figure
So, I have the following data.frame, and I want to generate two plots in one graph for yval vs. xval, for each zval and type tp. The lef
> df
xval yval se zval cond
1 1.0 ...
34
votes
5
answers
29k
views
Place a legend for each facet_wrap grid in ggplot2
I have this data frame:
x <- data.frame(
Date = factor(rep(
c("12/1/2011", "1/2/2012", "2/1/2012", "2/10/2012", "2/13/2012"),
3
)),
...