Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

size parameter not working #89

Closed
carterprince opened this issue Feb 23, 2024 · 1 comment · Fixed by #90
Closed

size parameter not working #89

carterprince opened this issue Feb 23, 2024 · 1 comment · Fixed by #90
Assignees
Labels
documentation Improvements or additions to documentation
Milestone

Comments

@carterprince
Copy link

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):

  • Platform: Fedora Linux
  • version output:
> version
              _                           
platform       x86_64-redhat-linux-gnu     
arch           x86_64                      
os             linux-gnu                   
system         x86_64, linux-gnu           
status                                     
major          4                           
minor          3.2                         
year           2023                        
month          10                          
day            31                          
svn rev        85441                       
language       R                           
version.string R version 4.3.2 (2023-10-31)
nickname       Eye Holes                   
  • sessionInfo() output:
> sessionInfo()
R version 4.3.2 (2023-10-31)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Fedora Linux 39 (Workstation Edition)

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.

@carterprince carterprince added the bug A bug or issue that should be resolved label Feb 23, 2024
@pdil
Copy link
Owner

pdil commented Feb 28, 2024

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.

@pdil pdil added documentation Improvements or additions to documentation and removed bug A bug or issue that should be resolved labels Feb 28, 2024
@pdil pdil self-assigned this Feb 28, 2024
@pdil pdil added this to the v0.8.0 milestone Feb 28, 2024
@pdil pdil closed this as completed in #90 Mar 7, 2024
pdil added a commit that referenced this issue Mar 7, 2024
* `size` was erroneously left in the documentation after the `ggplot2
3.4.0` update.
  * It has been replaced with `linewidth`.
* Fix legend in theme after the `ggplot2 v3.5.0`
* Update tests to use 3rd edition of `testthat` 

fixes #89
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants