0

Use of theme_classic() returns plot of expected format, except that the axis lines are missing.

Use of theme_bw(), and adding axis lines afterwards still doesn't show axis lines. eg.

qplot(input_data$trait1, input_data$trait2) + 
theme_bw() + 
theme(axis.line = element_line(colour = "black", size=10, linetype = 1))

Checking theme_bw() looks as though the size and linetype need changing from NULL to something.

$ axis.line            :List of 4
  ..$ colour  : chr "black"
  ..$ size    : NULL
  ..$ linetype: NULL
  ..$ lineend : NULL

I attempted creating a new theme, with the axes lines but it's not recognised as a command:

theme_classic2 = theme_set (theme_classic())
theme_classic2 = theme_update(axis.line = element_line(colour = "black", size=1,
                                                   linetype = 1)

I've a feeling I might have accidentally changed some default settings.

Please help. This rather infuriating, not to mention rather embarrassing.


> sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.5 (Yosemite)

locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] tidyr_0.4.0   ggplot2_2.1.0

loaded via a namespace (and not attached):
 [1] labeling_0.3     colorspace_1.2-6 scales_0.4.0     magrittr_1.5         R6_2.1.2         assertthat_0.1  
 [7] plyr_1.8.3       parallel_3.2.3   DBI_0.3.1        tools_3.2.3          gtable_0.2.0     dplyr_0.4.3     
[13] Rcpp_0.12.3      grid_3.2.3       munsell_0.4.3   
Sarah
  • 67
  • 1
  • 8
  • 2
    Possible duplicate of [ggplot2, axis not showing after using theme(axis.line=element\_line())](http://stackoverflow.com/questions/35833307/ggplot2-axis-not-showing-after-using-themeaxis-line-element-line) – user20650 Mar 14 '16 at 19:53
  • same question in two days. I can't reproduce the same problem. What's your sessionInfo()? – MLavoie Mar 14 '16 at 20:31
  • @MLavoie Session info added. – Sarah Mar 14 '16 at 20:50
  • With my own graphic and the same ggplot2 version, I can't reproduce your error. Could you add (using dput()) a subset of your dataset enough to reproduce your error? – MLavoie Mar 14 '16 at 20:56
  • 1
    Ah, no worries, I'm guessing it's a bug in ggplot. Have found a solution by specifying axis.line.x and y separately. – Sarah Mar 15 '16 at 13:50

0 Answers0