I have a simple matrix like this
>df
School1 School2 School3
Program1 1 1 1
Program2 1 0 1
Program3 1 1 0
The number 1 indicates that the school receivied the program and the number zero, no receivied. I would like to plot a simple square like the a cheesboard (black for 1 and white for 0). First I melt my df
df<- melt(df)
head(df)
X1 X2 value
1 Program 1 School 1 1
2 Program 2 School 1 1
3 Program 3 School 1 1
4 Program 1 School 2 1
5 Program 2 School 2 0
6 Program 3 School 2 0
names(df)[1]<- "Var1"
names(df)[2]<- "Var2"
Now, I create my board
ggplot(df, aes(x=Var2, y=Var1, fill=value)) + geom_tile() +
theme(panel.background = element_blank(),
#panel.grid.major = element_line(colour = "orange", size=2),
panel.grid.minor = element_line(colour = "gray" , size = 3))
Which produces the following picture
But I would like to do somtehings:
1.- add a gray grid over the plot indicating the separation of each square
2.- manipulate the color square(black and white)
3.- manipulate the size of the labels on the axes (Program 1, Program 2, ... School 1, School 2,...) and its inclination(like las = 2 in barplot)
4.- Edit the bar legend (Yes with a black little square and No with a white little square)
5.- Exclude the names axes (Var1 and Var )