- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
以下将 scale_x_continuous
与 geom_sf
结合使用可完全删除 x 轴标签。我假设指定的中断实际上并不存在于 ggplot 对象中,因此根本不会显示任何中断。
这是由coord_sf()
自动从EPSG 32717转换为EPSG 4326引起的吗?
data(ecuador, package = "sperrorest")
library(sf)
#> Linking to GEOS 3.5.1, GDAL 2.2.2, proj.4 4.9.2
library(ggplot2)
data = st_as_sf(ecuador, coords = c("x", "y"), crs = 32717)
ggplot(data) +
geom_sf()
ggplot(data) +
geom_sf() +
scale_x_continuous(breaks = c(79.085, 79.055))
devtools::session_info()
#> Session info -------------------------------------------------------------
#> setting value
#> version R version 3.4.3 (2017-11-30)
#> system x86_64, linux-gnu
#> ui X11
#> language (EN)
#> collate en_US.UTF-8
#> tz Europe/Berlin
#> date 2018-01-29
#> Packages -----------------------------------------------------------------
#> package * version date source
#> backports 1.1.2 2017-12-13 CRAN (R 3.4.3)
#> base * 3.4.3 2017-12-01 local
#> class 7.3-14 2015-08-30 CRAN (R 3.4.0)
#> classInt 0.1-24 2017-04-16 CRAN (R 3.4.3)
#> colorspace 1.3-2 2016-12-14 CRAN (R 3.4.3)
#> compiler 3.4.3 2017-12-01 local
#> datasets * 3.4.3 2017-12-01 local
#> DBI 0.7 2017-06-18 CRAN (R 3.4.3)
#> devtools 1.13.4 2017-11-09 CRAN (R 3.4.3)
#> digest 0.6.15 2018-01-28 cran (@0.6.15)
#> e1071 1.6-8 2017-02-02 CRAN (R 3.4.3)
#> evaluate 0.10.1 2017-06-24 CRAN (R 3.4.3)
#> ggplot2 * 2.2.1.9000 2018-01-29 Github (tidyverse/ggplot2@401511e)
#> graphics * 3.4.3 2017-12-01 local
#> grDevices * 3.4.3 2017-12-01 local
#> grid 3.4.3 2017-12-01 local
#> gtable 0.2.0 2016-02-26 CRAN (R 3.4.3)
#> htmltools 0.3.6 2017-04-28 CRAN (R 3.4.3)
#> knitr 1.19 2018-01-29 cran (@1.19)
#> lazyeval 0.2.1 2017-10-29 CRAN (R 3.4.3)
#> magrittr 1.5 2014-11-22 CRAN (R 3.4.3)
#> memoise 1.1.0 2017-04-21 CRAN (R 3.4.3)
#> methods * 3.4.3 2017-12-01 local
#> munsell 0.4.3 2016-02-13 CRAN (R 3.4.3)
#> pillar 1.1.0 2018-01-14 cran (@1.1.0)
#> plyr 1.8.4 2016-06-08 CRAN (R 3.4.3)
#> Rcpp 0.12.15 2018-01-20 cran (@0.12.15)
#> rlang 0.1.6.9003 2018-01-29 Github (tidyverse/rlang@a8c15c6)
#> rmarkdown 1.8 2017-11-17 CRAN (R 3.4.3)
#> rprojroot 1.3-2 2018-01-03 CRAN (R 3.4.3)
#> scales 0.5.0.9000 2018-01-29 Github (hadley/scales@d767915)
#> sf * 0.6-0 2018-01-06 CRAN (R 3.4.3)
#> stats * 3.4.3 2017-12-01 local
#> stringi 1.1.6 2017-11-17 CRAN (R 3.4.3)
#> stringr 1.2.0 2017-02-18 CRAN (R 3.4.3)
#> tibble 1.4.2 2018-01-22 cran (@1.4.2)
#> tools 3.4.3 2017-12-01 local
#> udunits2 0.13 2016-11-17 CRAN (R 3.4.3)
#> units 0.5-1 2018-01-08 CRAN (R 3.4.3)
#> utils * 3.4.3 2017-12-01 local
#> withr 2.1.1.9000 2018-01-29 Github (jimhester/withr@df18523)
#> yaml 2.1.16 2017-12-12 CRAN (R 3.4.3)
最佳答案
您的休息时间必须为负数,因为您位于西半球:
ggplot(data) +
geom_sf() +
scale_x_continuous(breaks = c(-79.085, -79.055))
使用coord_sf
直接从ggplot更改crs也很容易:
ggplot(data) +
geom_sf() +
coord_sf(datum = st_crs(data)) +
scale_x_continuous(breaks = c(712500, 715500))
关于r - geom_sf : scale_*_continuous has no effect,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48510238/
我正在使用 R (3.0.1) 和 ggplot2 (ggplot2_0.9.3.1) 与 geom_tile和 scale_fill_gradient .我正在使用' limits ' scale_
目标 使用 ggplot2::scale_*_time 以特定方式格式化时间轴(使用最新版本的 ggplot2)。 最小 Reprex # Example data tib1 % dplyr:
以下将 scale_x_continuous 与 geom_sf 结合使用可完全删除 x 轴标签。我假设指定的中断实际上并不存在于 ggplot 对象中,因此根本不会显示任何中断。 这是由coord_
我想创建一个具有不同于默认刻度线的主题,以避免每次创建自定义绘图时都重复 + scale_x_continuous。 让我们举一个简单的例子,我只想要极限处的刻度线: A = 1; f = 5; p
我正在尝试为我的一个绘图中的颜色创建一个手动比例。我的数据范围从 0 到 10,而且我有很多非常小的数字。重要的是我想要两种颜色渐变。一个用于值 = 1 的点。由于我有很多非常小的数字,我希望颜色渐变
我有例如两个数据集,第一个包含计算点,第二个包含网格坐标。我想使用 ggplot 绘制它们,我希望图例如下所示: 数据 df1% bind_rows(.id = "df") 比将变量映射到美学。
我是一名优秀的程序员,十分优秀!