Related
I want make a time series plot grouped by ID. My dataset has 42 different IDs with 7 different timeframes. The timeframe varies per ID and ranges from 9/2016 to 8/2018. I.e., ID1 can start 10/2016 and end 7/2017 (with 7 rows containing a different date) and ID40 can start 11/2016 and ends 6/2018 (also with 7 rows containing a different date). I try to plot this with the following code
p <- ggplot(data = df6, aes(x = START, y = AI, col = ID, group = ID))
p + geom_point(size = 1.2,
alpha = .8) + stat_smooth(aes(group = 1)) + stat_summary(aes(group = 1), geom =
"point", fun.y = mean,
shape = 17, size = 3) + theme_minimal() + theme(axis.text.x = element_text(angle =
90, vjust = 0.5, hjust=1))
This gives me the following graph:
As one can see the X-axis is not chronological. I should start at 09/2016 and end at 08/2018 and then correspond with the Y value based on the ID. I got the following dataset:
structure(list(ID = c("ID1", "ID1", "ID1", "ID1", "ID1", "ID1",
"ID1", "ID10", "ID10", "ID10", "ID10", "ID10", "ID10", "ID10",
"ID11", "ID11", "ID11", "ID11", "ID11", "ID12"), Time = c("1",
"2", "3", "4", "5", "6", "7", "1", "2", "3", "4", "5", "6", "7",
"1", "2", "3", "4", "5", "1"), AI = c(0.393672183448241, 0.4876954603533,
0.411717908455957, 0.309769862660288, 0.149826889496538, 0.2448558592586,
0.123606753324621, 0.296109333767922, 0.309960002123076, 0.445886231347992,
0.370013553008003, 0.393414429902431, 0.318940511323733, 0.131112361225666,
0.31961673567578, 0.227268892979164, 0.433471105477564, 0.207184572401005,
0.144257239122978, 0.520204263001733), AI_VAR = c(0.154977788020905,
0.237846862049217, 0.169511636143347, 0.0959573678125739, 0.0224480968162077,
0.0599543918132674, 0.0152786294674538, 0.0876807375444826, 0.0960752029161373,
0.198814531305715, 0.136910029409606, 0.154774913655455, 0.101723049763444,
0.0171904512661696, 0.102154857724042, 0.0516511497159746, 0.187897199283942,
0.0429254470409874, 0.020810151039384, 0.270612475245176), activity = c(0,
0.303472222222222, 0.232638888888889, 0.228472222222222, 0.348611111111111,
0.215972222222222, 0.123611111111111, 0.357638888888889, 0.235416666666667,
0.233333333333333, 0.2875, 0.353472222222222, 0.356944444444444,
0.149305555555556, 0.448611111111111, 0.213888888888889, 0.248611111111111,
0.288888888888889, 0.25625, 0.238888888888889), ZIM_SD = c(0,
0.148002025121106, 0.095781596758851, 0.0707738088994687, 0.0522313184217097,
0.0528820640482116, 0.0152791681192935, 0.105900213118389, 0.0729697504998075,
0.104040120647865, 0.106378896489801, 0.139061072791901, 0.113844043625277,
0.0195758039329988, 0.143383618921218, 0.0486102909983211, 0.107765733167339,
0.059853320915846, 0.036965917525263, 0.124271018383747), ZIM_VAR = c(0,
0.0721799157746582, 0.039434998686126, 0.0219235930627339, 0.00782565597342798,
0.0129484832318932, 0.00188860836472692, 0.0313580415523671,
0.0226177040198407, 0.0463900573046668, 0.0393616334552618, 0.0547086326740462,
0.0363094774850072, 0.00256662987654616, 0.0458278042289798,
0.0110476070225835, 0.0467133314886466, 0.0124006847007297, 0.00533260120384214,
0.0646463135307921), CHECK = c(10L, 13L, 11L, 7L, 7L, 5L, 4L,
36L, 36L, 34L, 34L, 32L, 29L, 21L, 28L, 27L, 26L, 25L, 21L, 36L
), BULBAR = c(2L, 4L, 4L, 4L, 4L, 2L, 2L, 9L, 9L, 9L, 9L, 9L,
7L, 6L, 12L, 12L, 11L, 11L, 11L, 11L), FINE = c(0L, 0L, 0L, 0L,
0L, 0L, 0L, 9L, 9L, 8L, 8L, 7L, 6L, 4L, 2L, 1L, 1L, 1L, 0L, 7L
), GROSS = c(2L, 2L, 2L, 2L, 2L, 2L, 1L, 9L, 9L, 9L, 9L, 8L,
8L, 6L, 3L, 3L, 3L, 3L, 2L, 6L), RESPI = c(6L, 7L, 5L, 1L, 1L,
1L, 1L, 9L, 9L, 8L, 8L, 8L, 8L, 5L, 11L, 11L, 11L, 10L, 8L, 12L
), GROSS_RENEWD = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 6L, 6L, 6L, 6L,
5L, 5L, 4L, 3L, 3L, 3L, 3L, 2L, 3L), ACTIVE = c(2L, 2L, 2L, 2L,
2L, 2L, 1L, 18L, 18L, 17L, 17L, 15L, 14L, 10L, 5L, 4L, 4L, 4L,
2L, 13L), NON.ACTIVE = c(8L, 11L, 9L, 5L, 5L, 3L, 3L, 18L, 18L,
17L, 17L, 17L, 15L, 11L, 23L, 23L, 22L, 21L, 19L, 23L), START = c("09/2016",
"11/2016", "01/2017", "04/2017", "06/2017", "10/2017", "02/2018",
"10/2016", "12/2016", "02/2017", "04/2017", "07/2017", "11/2017",
"04/2018", "10/2016", "12/2016", "02/2017", "04/2017", "07/2017",
"10/2016"), STOP = c("10/2016", "11/2016", "01/2017", "04/2017",
"06/2017", "10/2017", "03/2018", "10/2016", "12/2016", "02/2017",
"04/2017", "07/2017", "11/2017", "04/2018", "10/2016", "12/2016",
"02/2017", "04/2017", "07/2017", "10/2016")), row.names = c(NA,
20L), class = "data.frame")
In general I want the column START to start with the begin date and end with the last date when it is plotted
You should convert your "START" column to a date format. You could use the package zoo with the function as.yearmon for that. To start the axis with your start date and end it with the end date, you could create a vector of date breaks using the min (start) date and max (end) date. Here is a reproducible example:
library(ggplot2)
library(zoo)
library(dplyr)
df6 <- df6 %>%
mutate(START = as.Date(as.yearmon(START, format = '%m/%Y')))
breaks.vec <- c(min(df6$START),
seq(from=min(df6$START), to=max(df6$START), by = 'month'))
ggplot(data = df6, aes(x = START, y = AI, col = ID, group = ID)) +
geom_point(size = 1.2, alpha = .8) +
stat_smooth(aes(group = 1)) +
stat_summary(aes(group = 1), geom = "point", fun.y = mean, shape = 17, size = 3) +
scale_x_date(breaks = breaks.vec, date_labels = "%m/%Y") +
theme_minimal() +
theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))
#> Warning: `fun.y` is deprecated. Use `fun` instead.
#> `geom_smooth()` using method = 'loess' and formula 'y ~ x'
Created on 2022-10-17 with reprex v2.0.2
I have a sequence of Surfaces that were touched in a room during patient care.
dput(sequence_contacts)
structure(list(value = structure(c(1L, 1L, 2L, 3L, 2L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 1L, 4L, 1L, 5L, 5L, 5L, 5L, 5L, 5L, 5L,
5L, 5L), .Label = c("FarPatient", "Patient", "Equipment", "HygieneArea",
"Out"), class = "factor"), x = 1:25), row.names = c(NA, -25L), class = c("tbl_df",
"tbl", "data.frame"))
I'm trying to plot the sequence of contacts on along the x axis with the surface name on the y axis using a connected stair-step graph.
But I can't get the points to join up. Why not?
ggplot()+
geom_step(data= sequence_contacts, mapping=aes(x=x, y=value)) +
geom_step(data= sequence_contacts, mapping=aes(x=x, y=value), direction="vh", linetype=3) +
geom_point(data= sequence_contacts, mapping=aes(x=x, y=value, colour=x)) +
scale_color_gradient(low="blue", high="red")+
scale_x_continuous("Contact Number")+
scale_y_discrete("Surface Category")
I have a dataset, d, that contains personally identifiable data, I have the dataset putting an X for all values that are suppressed:
column1 column2 column3
* FSM X
* Male 2.5
* Female X
A FSM 6
A Male 10.3
A Female 11.7
B FSM 14.8
B Male 21.5
B Female 25.3
I want to plot this with an X above the bars in a bar plot, where data has been suppressed, such as:
My code is:
p <- ggplot(d, aes(x=column1, y=column3, fill=column2)) +
geom_bar(position=position_dodge(), stat="identity", colour="black") +
geom_text(aes(label=column2),position= position_dodge(width=0.9), vjust=-.5)
scale_y_continuous("Percentage",breaks=seq(0, max(d$column3), 2)))
But of course, it can't plot 'X' on the graph and says:
Error: Discrete value supplied to continuous scale
How can I get the bar plotting to ignore the 'X' and still add the label if it's present?
Data dump:
structure(list(column1 = structure(c(1L, 1L, 1L, 2L, 2L, 2L,
3L, 3L, 3L, 4L, 4L, 4L, 5L, 5L, 5L, 6L, 6L, 6L, 7L, 7L, 7L), .Label = c("*",
"A", "B", "C", "D", "E", "U"), class = "factor"), column2 = structure(c(1L,
2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L,
3L, 1L, 2L, 3L), .Label = c("FSM", "Male", "Female"), class = "factor"),
column3 = structure(c(21L, 1L, 2L, 18L, 3L, 4L, 7L, 12L,
14L, 16L, 15L, 13L, 10L, 9L, 8L, 11L, 6L, 5L, 20L, 19L, 17L
), .Label = c("1.93889541715629", "1.97444831591173", "10.1057579318449",
"11.7305458768873", "12.7758420441347", "14.4535840188014",
"14.8471615720524", "18.5830429732869", "19.9764982373678",
"20.0873362445415", "20.9606986899563", "21.5628672150411",
"24.1579558652729", "25.3193960511034", "25.7931844888367",
"29.2576419213974", "5.45876887340302", "6.11353711790393",
"6.16921269095182", "6.98689956331878", "X"), class = "factor")), .Names = c("column1",
"column2", "column3"), row.names = c(NA, -21L), class = "data.frame")
I 'm happy to print out 0 instances where there are 0 instances, but in the case of data suppression, I want to make it clear that data has been suppressed by printing out a 'X', but the bar will also show 0 instances
First convert the height to numeric which gives NA for censored values. Then create a label column based on that. Then you need a column of zeroes for the y coordinate of the labels.
> d$column3=as.numeric(as.character(d$column3))
Warning message:
NAs introduced by coercion
> d$column4 = ifelse(is.na(d$column3),"X","")
> d$y=0
Then:
> p <- ggplot(d, aes(x=column1, y=column3, fill=column2))
> p + geom_bar(position=position_dodge(), stat="identity",
colour="black") +
geom_text(aes(label=column4,x=column1,y=y),
position=position_dodge(width=1), vjust=-0.5)
Giving:
Its a variant on labelling a geom_bar with the value of the bar. Almost a dupe.
I have the following dataframe (output of dput(df2)):
structure(list(angles = c(-0.701916320805404, 2.33367948606366,
0.364313791379516, -0.228918909875176, -2.77064550417737, 2.97776037032614,
-3.03604124258522, 2.10507549390108, 2.07708771915781, -0.0646656487453258,
-0.701916320805404, 2.33367948606366, 0.364313791379516, -0.228918909875176,
-2.77064550417737, 2.97776037032614, -3.03604124258522, 2.10507549390108,
2.07708771915781, -0.0646656487453258, -0.701916320805404, 2.33367948606366,
0.364313791379516, -0.228918909875176, -2.77064550417737, 2.97776037032614,
-3.03604124258522, 2.10507549390108, 2.07708771915781, -0.0646656487453258
), id = c(9L, 4L, 5L, 6L, 3L, 10L, 3L, 4L, 4L, 6L, 1L, 4L, 5L,
6L, 2L, 1L, 3L, 4L, 4L, 6L, 1L, 7L, 5L, 6L, 2L, 1L, 3L, 4L, 4L,
6L), method = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L), .Label = c("kd-clips", "QT-Clust", "True"
), class = "factor"), truid = structure(c(1L, 4L, 5L, 6L, 2L,
1L, 3L, 4L, 4L, 6L, 1L, 4L, 5L, 6L, 2L, 1L, 3L, 4L, 4L, 6L, 1L,
4L, 5L, 6L, 2L, 1L, 3L, 4L, 4L, 6L), .Label = c("1", "2", "3",
"4", "5", "6"), class = "factor")), .Names = c("angles", "id",
"method", "truid"), row.names = c(940L, 474L, 889L, 298L, 222L,
932L, 87L, 695L, 261L, 832L, 1940L, 1474L, 1889L, 1298L, 1222L,
1932L, 1087L, 1695L, 1261L, 1832L, 2940L, 2474L, 2889L, 2298L,
2222L, 2932L, 2087L, 2695L, 2261L, 2832L), class = "data.frame")
I run the following code to make the plot that follows:
df2$y <- as.numeric(as.factor(df2$method)) + 3
df2$yend <- df2$y + 1
library(ggplot2)
library(RColorBrewer)
cx <- ggplot(df2, aes(y = y, x = angles))
cx + geom_point(aes(color = as.factor(id))) + ylim(0,6) + theme_light() + scale_colour_brewer(palette = "Paired") +
scale_x_continuous(labels = NULL, breaks = df2$angles)+coord_polar() +
theme(legend.position="none", panel.border=element_blank(), axis.title =
element_blank(), axis.text = element_blank())
I get the following figure:
Almost there, but what I would like to get are two more things:
The radial lines to be colored according to the last column (true.id) of the df2 (which is the same color as the points in the third concentric circle -- same as that for id == "True").
I would like a radial scale also, marked at intervals of 30 (like at angles of 0, 30, 60, 90, ... 330. 0). However, I do not want the scale at the left (of the y's).
The above has 30 points, three replicates of each method at each angle. However, the figures only appears to plot 9 replicates, i.e. 27 points in total. (It is possible that two angles -- the one with 2.077 and the one with 2.105) are very close, so that they are really perhaps both there, but I can not tell because then what are the two points that are close to each other?
I have tried all day but could not get either of these to work, so I was wondering if anyone can help.
Thanks in advance!
I think this is probably what you wanted (I know, long time ago now...). Some of what you were getting wrong I actually couldn't quite tell, but it's nearly always a mistake to try to use the coordinate gridlines to show data - use geom_line or geom_segment for the data, and leave the gridlines to show the coordinates. This solves both your need to have the lines coloured, and makes it easier for the x gridlines (ie the radial ones) to have the labels you want (whether I understood you correctly on this, re degrees v. radians, I'm not sure).
library(ggplot2)
library(RColorBrewer)
# your "angle" looks to be in radians, not sure how you want these converted to degrees?
# but let's set where we want the axis marks to be
br <- seq(from = -pi, to = pi, length.out = 7)
ggplot(df2, aes(y = y, x = angles)) +
geom_point(aes(color = as.factor(id))) +
theme_light() +
scale_colour_brewer(palette = "Paired") +
geom_vline(aes(xintercept = angles, colour = truid)) +
coord_polar() +
scale_x_continuous(lim = c(-pi, pi), breaks = br, labels = 0:6 * 60) +
theme(legend.position="none",
panel.border=element_blank(),
axis.title = element_blank(),
axis.text.y = element_blank())
Here is my data:
data <- structure(list(Indicator = structure(c(1L, 1L, 1L, 2L, 2L, 2L,
3L, 3L, 3L, 6L, 6L, 6L, 6L, 4L, 4L, 5L, 5L, 1L, 1L, 1L, 2L, 2L,
2L, 3L, 3L, 3L, 6L, 6L, 6L, 6L, 4L, 4L, 5L, 5L, 1L, 1L, 1L, 2L,
2L, 2L, 3L, 3L, 3L, 6L, 6L, 6L, 6L, 4L, 4L, 5L, 5L, 1L, 1L, 1L,
2L, 2L, 2L, 3L, 3L, 3L, 6L, 6L, 6L, 6L, 4L, 4L, 5L, 5L, 1L, 1L,
1L, 2L, 2L, 2L, 3L, 3L, 3L, 6L, 6L, 6L, 6L, 4L, 4L, 5L, 5L), .Label = c("Causality",
"Climatechangeriskperceptions", "Currentadaptationoptions", "Fishingasalivelihoodactivity",
"Governance", "Roleofshadowstateactors"), class = "factor"),
Village = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L,
5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L,
5L), .Label = c("Andra", "lahapau", "Pelipowai", "Ponam",
"Tulu"), class = "factor"), Variables = structure(c(13L,
3L, 10L, 11L, 12L, 16L, 5L, 8L, 1L, 2L, 15L, 17L, 6L, 14L,
9L, 4L, 7L, 13L, 3L, 10L, 11L, 12L, 16L, 5L, 8L, 1L, 2L,
15L, 17L, 6L, 14L, 9L, 4L, 7L, 13L, 3L, 10L, 11L, 12L, 16L,
5L, 8L, 1L, 2L, 15L, 17L, 6L, 14L, 9L, 4L, 7L, 13L, 3L, 10L,
11L, 12L, 16L, 5L, 8L, 1L, 2L, 15L, 17L, 6L, 14L, 9L, 4L,
7L, 13L, 3L, 10L, 11L, 12L, 16L, 5L, 8L, 1L, 2L, 15L, 17L,
6L, 14L, 9L, 4L, 7L), .Label = c("alternativelivelihood",
"anyactorsinvolvedinsustainability", "Attributionfactors",
"discusswithelectedleaders", "Effortsdirectedtoreducerisks",
"fishercommunityinfluence", "Infrastructureeffectiveness",
"multiplicityofactors", "Occupationforchildren", "Reversibility",
"Riskasamajorconsideration", "Riskbeingaddressed", "Statusoffisheries",
"Timefishing", "Whatwasdone", "Whoisatrisk", "whowasinvolved?"
), class = "factor"), legend.var = structure(c(1L, 2L, 3L,
4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L,
17L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L,
14L, 15L, 16L, 17L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L,
11L, 12L, 13L, 14L, 15L, 16L, 17L, 1L, 2L, 3L, 4L, 5L, 6L,
7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 1L, 2L,
3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L,
16L, 17L), .Label = c("a", "b", "c", "d", "e", "f", "g",
"h", "i", "j", "k", "l", "m", "n", "o", "p", "q"), class = "factor"),
score = c(1, 0.97, 1, 0.76, 0.794, 1, 0.71, 0.9, 0.5, 1,
1, 1, 1, 0.49, 0.72, 1, 0.7, 1, 1, 0, 0.67, 0.5, 1, 0.2,
1, 1, 0.7, 0.4, 0.5, 0.3, 0.67, 0.5, 0.7, 0.8, 1, 0, 0.46,
0.56, 0.375, 1, 0.13, 0.3, 0.5, 0.3, 0.3, 0.4, 0.6, 1, 1,
0.7, 0.8, 1, 0.86, 0.69, 0.51, 0.429, 1, 0.44, 0.3, 0.5,
0.6, 0.6, 0.7, 0.8, 0.4, 0.79, 0.8, 1, 1, 0.82, 0.85, 0.25,
0.226, 1, 0.18, 0.1, 1, 0.7, 0.3, 0.6, 0.3, 0.48, 0.16, 0.4,
0.8)), .Names = c("Indicator", "Village", "Variables", "legend.var",
"score"), class = "data.frame", row.names = c(NA, -85L))
I have made polar plots as follows:
library(ggplot2)
ggplot(data, aes(x = legend.var, y = score, fill = Indicator), color='black') +
geom_bar(width = 1, alpha=0.5, stat="identity") +
scale_y_continuous() +
coord_polar() +
theme( axis.ticks = element_blank()) +
facet_wrap(~Village, nrow=2, ncol=3) +
guides(colour = guide_legend(title.hjust = 0.5))
As you can see in the data, column legend.var is grouped by the column indicator. I would like to insert a table or a second legend which associates each of the indicator with the legend.var and variables column. Ideally if this is inserted as a second legend, the unique items comprised in legend.var column would have the same fill color as the corresponding indicator. The fill legend is based on the column indicator. The inserted table/extra legend would comprise columns legend.var with a unique alphabet and column variables with the meaning of the respective alphabet. These can then have the same fill color as the corresponding indicator. I hope this is clear.
Here is a solution using a gtable:
library(ggplot2)
p <- ggplot(data, aes(x = legend.var, y = score, fill = Indicator), color='black') +
geom_bar(width = 1, alpha=0.5, stat="identity") +
scale_y_continuous() +
coord_polar() +
theme( axis.ticks = element_blank()) +
facet_wrap(~Village, nrow=2, ncol=3) +
guides(colour = guide_legend(title.hjust = 0.5)) +
theme(legend.position=c(0.85,0.25))
#create table
library(gridExtra)
tab <- tableGrob(unique(data[, c("legend.var", "Variables")]),
show.rownames=FALSE, gpar.coretext=gpar(fontsize=10),
gpar.coltext=gpar(fontsize=10, fontface='bold'),
gpar.corefill = gpar(fill = "grey90", col = "white"),
gpar.colfill = gpar(fill = "grey80", col = "white"))
#arrange grobs
library(gtable)
a <- gtable(unit(c(0.7, 0.3) ,c("npc")), unit(1, "npc"))
a <- gtable_add_grob(a, ggplotGrob(p),1,1)
a <- gtable_add_grob(a, tab,1,2)
#plot
grid.draw(a)
For a start, you may try something like this. You need to adjust arrangement and layout according to your own preferences.
library(ggplot2)
library(gridExtra)
gg <- ggplot(data, aes(x = legend.var, y = score, fill = Indicator), color='black') +
geom_bar(width = 1, alpha=0.5, stat="identity") +
coord_polar() +
theme(axis.ticks = element_blank()) +
facet_wrap(~Village, nrow=2, ncol = 3)
# create a table that translates legend.var to Variables
tbl <- unique(data[ , c("legend.var", "Variables")])
# create a table grob
tt <- tableGrob(d = tbl,
col.just = "left",
gpar.coretext = gpar(col = "black", cex = 0.5),
gpar.coltext = gpar(col = "black", cex = 0.5, fontface = "bold"),
gpar.rowtext = gpar(col = "black", cex = 0.5, fontface = "italic"))
# arrange plot and table grob
grid.arrange(gg, tt, ncol = 2)
update with a quick and dirty ggplot-only alternative
# create labels
labs <- with(tbl, paste(legend.var, Variables))
gg <- ggplot(data, aes(x = legend.var, y = score, fill = Indicator, col = Variables)) +
geom_bar(width = 1, alpha = 0.5, stat = "identity") +
coord_polar() +
theme(axis.ticks = element_blank()) +
facet_wrap(~ Village, nrow = 2, ncol = 3) +
scale_color_grey(labels = labs, start = 0.8, end = 0.9)
gg