I have the following graph using library(waffle)
My problem is that the last name group does not appear. the code that I am using is the following
counts<-c(135.92, 15.98, 14.97, 14.15, 5.82, 11.82, 0.07 )
counts_names<-sprintf("%s (%s)", c("Coal", "Gas", "Wind", "Hydro", "Grid-scalar solar", "Rooftop solar", "Storage systems"),
scales::percent(round(counts/sum(counts), 4)))
names(counts)<-counts_names
Generation_graph<-waffle(counts)+ scale_fill_tableau(name=NULL)
How can i get my original graph with the seven groups at the right
UPDATE: Reading one of the comments I noticed that including the option labels
enable me keep my original graph with all the names.
Generation_graph<-waffle(counts)+ scale_fill_tableau(name=NULL, labels=counts_names)
You can use the scale_fill_manual()
to get what you are looking for
library(ggthemes)
library(waffle)
counts<-c(135.92, 15.98, 14.97, 14.15, 5.82, 11.82, 0.07 )
counts_names<-sprintf("%s (%s)", c("Coal", "Gas", "Wind", "Hydro", "Grid-scalar solar", "Rooftop solar", "Storage systems"),
scales::percent(round(counts/sum(counts), 4)))
names(counts)<-counts_names
Generation_graph<-waffle(counts) +
scale_fill_manual(values = c("red", "blue", "green", "purple", "pink", "yellow", "orange", "blue"),
labels = counts_names,
drop = TRUE)