3

I have the following dataframe:

df
   repo revrepo bankrate CRR Callrate WPI GDP FED width  nse usd
1   9.0     6.8      7.0 8.0      7.5 5.4 4.6 4.5   225 1125  47
2   8.8     6.5      7.0 7.5      8.0 5.6 4.6 4.0   225 1168  47
3   8.5     6.5      7.0 7.5      7.2 5.3 4.6 3.8   200 1108  47
4   8.5     6.5      7.0 7.5      7.2 5.2 5.3 3.8   200 1073  47
5   8.5     6.5      7.0 7.5      6.9 5.4 5.3 3.5   200 1054  47
6   8.5     6.5      7.0 7.5      7.3 4.5 5.3 3.0   200  914  48
7   8.5     6.5      6.5 7.5      7.4 2.9 6.8 2.5   200  972  48
8   8.5     6.5      6.5 5.8      7.0 2.6 6.8 2.0   200 1067  48
9   8.5     6.5      6.5 5.5      7.1 2.1 6.8 1.8   200 1059  48
10  8.5     6.5      6.5 5.5      6.6 1.5 6.4 1.8   200 1075  48

I am trying to plot the boxplot using ggplot as shown below:

d <- melt(df)
ggplot(d,aes(x=variable,y = value),fill=NULL) + facet_wrap(~variable,scales = "free") +     geom_boxplot(fill="#1abc9c",alpha=0.8)

I get the following plot: enter image description here

As one can see that each facet has an heading but also the x labels which i want to remove so that only facet heading labels remain.I tried using theme(axis.title.x = element_blank()) as below but its not working.

ggplot(d,aes(x=variable,y = value),fill=NULL) + facet_wrap(~variable,scales = "free") +     geom_boxplot(fill="#1abc9c",alpha=0.8) + theme(axis.title.x = element_blank())

Can someone suggest the solution to this issue.Thanks in Advance.

Nishant
  • 1,063
  • 13
  • 40

0 Answers0