pdil / usmap

🗺 Create US maps including Alaska and Hawaii in R
https://usmap.dev/
GNU General Public License v3.0
74 stars 16 forks source link

size parameter not working #89

Closed carterprince closed 8 months ago

carterprince commented 8 months ago

Describe the bug The size parameter in plot_usmap does not affect the output as expected.

To Reproduce Run this script with the attached Excel file (poverty.xlsx):

library(usmap)
library(ggplot2)
library(readxl)

county_data <- read_excel("poverty.xlsx")

plot_usmap(data = county_data, values = "povrate", size = 0.01) +
  scale_fill_continuous(low = "white", high = "red", name = "Poverty rate (%)")

Observe the output: image

The county borders are thick.

Expected behavior The resulting PDF should have very thin county borders.

Environment (please complete the following information):

Matrix products: default BLAS/LAPACK: FlexiBLAS OPENBLAS-OPENMP; LAPACK version 3.11.0

locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

time zone: America/New_York tzcode source: system (glibc)

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

other attached packages: [1] readxl_1.4.3 ggplot2_3.4.4 usmap_0.7.0

loaded via a namespace (and not attached): [1] vctrs_0.6.5 cli_3.6.2 rlang_1.1.3 usmapdata_0.2.1
[5] KernSmooth_2.23-22 DBI_1.2.2 generics_0.1.3 sf_1.0-15
[9] labeling_0.4.3 glue_1.7.0 colorspace_2.1-0 e1071_1.7-14
[13] scales_1.3.0 fansi_1.0.6 grid_4.3.2 cellranger_1.1.0
[17] classInt_0.4-10 munsell_0.5.0 tibble_3.2.1 lifecycle_1.0.4
[21] compiler_4.3.2 dplyr_1.1.4 Rcpp_1.0.12 pkgconfig_2.0.3
[25] farver_2.1.1 R6_2.5.1 class_7.3-22 tidyselect_1.2.0
[29] utf8_1.2.4 pillar_1.9.0 magrittr_2.0.3 proxy_0.4-27
[33] tools_4.3.2 withr_3.0.0 gtable_0.3.4 units_0.8-5



**Additional context**
This worked a while ago, I'm pretty sure I'm doing it the same way.
pdil commented 8 months ago

As of ggplot2 v3.4.0 size has been replaced with linewidth for sizing the width of lines: https://www.tidyverse.org/blog/2022/11/ggplot2-3-4-0/#hello-linewidth

Therefore if you replace size = 0.01 with linewidth = 0.01 it should work.

I do have the documentation still referring to size though so I will update that.