Skip to content

weird behavious when specifying breaks in scale_x_continuous #4440

@iagogv3

Description

@iagogv3

Are the grid vertical lines around 2 and 6 expected?

library(ggplot2)
p1 <- ggplot(mpg, aes(displ, hwy)) +
    geom_point()
p1 + scale_x_continuous(breaks = c(2, 2.25, 4, 6)) + theme_bw()

sessionInfo()
#> R version 3.6.3 (2020-02-29)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Debian GNU/Linux 9 (stretch)
#> 
#> Matrix products: default
#> BLAS:   /usr/lib/openblas-base/libblas.so.3
#> LAPACK: /usr/lib/libopenblasp-r0.2.19.so
#> 
#> locale:
#>  [1] LC_CTYPE=en_GB.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=en_GB.UTF-8        LC_COLLATE=en_GB.UTF-8    
#>  [5] LC_MONETARY=en_GB.UTF-8    LC_MESSAGES=en_GB.UTF-8   
#>  [7] LC_PAPER=en_GB.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C       
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] ggplot2_3.3.3
#> 
#> loaded via a namespace (and not attached):
#>  [1] pillar_1.6.0      compiler_3.6.3    tools_3.6.3       digest_0.6.27    
#>  [5] evaluate_0.14     lifecycle_1.0.0   tibble_3.1.1      gtable_0.3.0     
#>  [9] pkgconfig_2.0.3   rlang_0.4.10      reprex_2.0.0      DBI_1.1.1        
#> [13] yaml_2.2.1        xfun_0.22         withr_2.4.2       styler_1.4.1     
#> [17] stringr_1.4.0     dplyr_1.0.5       knitr_1.32        generics_0.1.0   
#> [21] fs_1.5.0          vctrs_0.3.7       grid_3.6.3        tidyselect_1.1.0 
#> [25] glue_1.4.2        R6_2.5.0          fansi_0.4.2       rmarkdown_2.7    
#> [29] farver_2.1.0      purrr_0.3.4       magrittr_2.0.1    backports_1.2.1  
#> [33] scales_1.1.1      ellipsis_0.3.1    htmltools_0.5.1.1 assertthat_0.2.1 
#> [37] colorspace_2.0-0  labeling_0.4.2    utf8_1.2.1        stringi_1.5.3    
#> [41] munsell_0.5.0     crayon_1.4.1

Created on 2021-04-21 by the reprex package (v2.0.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions