0

I wrote a ggplot2 script that produces a plot with 3 points and associated error bars. On my computer it works fine, but the same script run on a colleague's computer omits the x and y axes. Any idea why the same ggplot2 code would produce axes on one computer but not another?

I've pasted the code below. for_group_code is a factor with 3 levels. CIlo, CIhi, and y are continuous variables (mean and associated 95% confidence intervals):

Plotnewdat.fg <- ggplot(newdat.fg, aes(x=for_group_code, y=y)) + 
  geom_point(aes(shape=dum, size=10)) +
  scale_shape_manual(values=c(1,0,15)) +
  geom_errorbar(aes(ymin=(CIlo), ymax=(CIhi)), size=1, width=0) +
  scale_fill_identity()+
  scale_x_discrete(labels=newdat.fg$for_group_code)+
  xlab("")+
  ylab("Density") +
  scale_y_continuous(expand=c(0,0), limits=c(0, ymax), breaks=c(0,round((ymax/2), digits=1),ymax)) +   
  theme(axis.text.x=element_text(size=10, colour="#000000"), axis.text.y=element_text(size=10, colour="#000000"),
        axis.title.x=element_text(size=10, colour="#000000"), axis.title.y=element_text(size=10, vjust=1.0),
        panel.background = element_blank(), panel.grid.major = element_blank(), panel.grid.minor = element_blank(), 
        axis.line = element_line(colour = "black"), plot.title=element_text(face="bold", size=10, vjust=0.9),
        legend.position="none")
Plotnewdat.fg
Michel
  • 1
  • 1
  • 2
    Are the versions of `ggplot2` identical across computers? – cory Mar 09 '16 at 20:53
  • Possibly something to do with [this](http://stackoverflow.com/questions/35833307/ggplo2-axis-not-showing-after-using-themeaxis-line-element-line/35833548#35833548). That is, as @cory suggests, different versions. – Sandy Muspratt Mar 09 '16 at 21:05
  • 1
    @SandyMuspratt: that (needing to define "axis.line.x" and "axis.line.y" separately) was the issue, thanks! We are using the same version of ggplot2. – Michel Mar 09 '16 at 22:20

0 Answers0