ggplot scale_x_continuous with symbol: make bold

前端 未结 2 1099
小蘑菇
小蘑菇 2020-12-19 08:01

Here is the issue: I am using ggplot to to make a graph in which the x axis ranges from -90 to 90 degrees. I have successfully used a function to add degree sym

2条回答
  •  醉梦人生
    2020-12-19 08:23

    I read a comment here that mentions that labels take a character value. The output of your function was an expression. Changing add_degree() to the following outputs character values instead of an expression and seems to work for me:

    add_degree <- function(x) {
      paste(x, "º",sep = "")
    }
    

    Here is my output for sessionInfo()

    R version 3.0.3 (2014-03-06)
    Platform: x86_64-apple-darwin10.8.0 (64-bit)
    
    locale:
    [1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8
    
    attached base packages:
    [1] stats     graphics  grDevices utils     datasets  methods  
    [7] base     
    
    other attached packages:
    [1] ggplot2_1.0.0
    
    loaded via a namespace (and not attached):
     [1] colorspace_1.2-4 digest_0.6.4     grid_3.0.3      
     [4] gtable_0.1.2     labeling_0.2     MASS_7.3-31     
     [7] munsell_0.4.2    plyr_1.8.1       proto_0.3-10    
    [10] Rcpp_0.11.1      reshape2_1.4     scales_0.2.4    
    [13] stringr_0.6.2    tools_3.0.3   
    

提交回复
热议问题