Any insight on issues leading to the following error modes would be 
appreciated.

#Version_1 CALL
alphaDivOTU <- ggplot(data=alphaDivOTU_pt1to5, aes(y = Num.OTUs,x = 
Patient,fill = Timepoint)) +
     geom_bar(position = position_dodge) +
     theme(text = element_text(family = 'Helvetica-Narrow',size = 18.0)) +
     scale_fill_manual(guide = guide_legend(),values = 
c("forestgreen","gray44","dodgerblue2","royalblue2","royalblue4","blue3")) +
     scale_y_continuous(breaks = pretty_breaks(n = 10.0,min.n = 5.0))

ggsave(plot=alphaDivOTU, filename='alphaDivOTU.png', scale=1, dpi=300, 
width=10, height=10, units=c("cm"))

#Version_1 Error modes
Mapping a variable to y and also using stat="bin".
   With stat="bin", it will attempt to set the y value to the count of 
cases in each group.
   This can result in unexpected behavior and will not be allowed in a 
future version of ggplot2.
   If you want y to represent counts of cases, use stat="bin" and don't 
map a variable to y.
   If you want y to represent values in the data, use stat="identity".
   See ?geom_bar for examples. (Deprecated; last used in version 0.9.2)
Error in .$position$adjust : object of type 'closure' is not subsettable

#Version_2 CALL
alphaDivOTU <- ggplot(data=alphaDivOTU_pt1to5, aes(y = Num.OTUs,x = 
Patient,fill = Timepoint)) +
     geom_bar(position = position_dodge, stat = identity) +
     theme(text = element_text(family = 'Helvetica-Narrow',size = 18.0)) +
     scale_fill_manual(guide = guide_legend(),values = 
c("forestgreen","gray44","dodgerblue2","royalblue2","royalblue4","blue3")) +
     scale_y_continuous(breaks = pretty_breaks(n = 10.0,min.n = 5.0))

ggsave(plot=alphaDivOTU, filename='alphaDivOTU.png', scale=1, dpi=300, 
width=10, height=10, units=c("cm"))

#For Version_2 I get the error:
Error in stat$parameters : object of type 'closure' is not subsettable

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to