[Solved] ggplot2 remove tick markers from geom_bar facet_wrap


I think this what you want. Having access to your data was really useful.

if you look at the structure of your dataset, you will see that Cost is a factor. Just change it to numeric and it will work. it will easier to change your tick if still necessary

str(uws)
'data.frame':   72 obs. of  4 variables:
 $ Scenario : Factor w/ 4 levels "Conv","S2","S3",..: 1 2 3 4 1 2 3 4 1 2 ...
 $ Component: Factor w/ 2 levels "WWC","WWT": 1 1 1 1 2 2 2 2 1 1 ...
 $ PE       : Factor w/ 9 levels "5,000","10,000",..: 1 1 1 1 1 1 1 1 2 2 ...
 $ Costs    : Factor w/ 63 levels "0","100,877,653",..: 28 61 1 45 18 38 34 4 54 7 ...

p <- ggplot() + 
  geom_bar(data=uws, aes(y = as.numeric(Costs), x = Scenario, fill = Component), stat="identity",position='stack') + 
  ggtitle("Plot Title") + ylab("Cost") +
  theme_bw() +  facet_wrap( ~ PE)

enter image description here

4

solved ggplot2 remove tick markers from geom_bar facet_wrap