AllanCameron / geomtextpath

Create curved text paths in ggplot2
https://allancameron.github.io/geomtextpath
Other
624 stars 24 forks source link

Ignoring unknown parameters: text_smoothing #77

Open j-sirgo opened 2 years ago

j-sirgo commented 2 years ago

I am using geomtextpath_0.1.0.9000 in R and I get:

Ignoring unknown parameters: text_smoothing

My code:

ggplot(dt, aes(x = year, y = val)) + 
    scale_color_brewer(palette="Set1") +
    geom_textline(aes(label = Series, color = Series), vjust = -0.5, hjust = "ymax", linewidth = 2, text_smoothing = 30)

What seems to be the issue? My session info below:

> sessionInfo() 
R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

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

other attached packages:
 [1] remotes_2.4.2           ggstream_0.1.0          ggh4x_0.2.1            
 [4] ggrepel_0.9.1           ggforce_0.3.3           forcats_0.5.1          
 [7] geomtextpath_0.1.0.9000 RColorBrewer_1.1-3      scales_1.1.1           
[10] ggtext_0.1.1            ggplot2_3.3.5           fstcore_0.9.12         
[13] fst_0.9.8               dplyr_1.0.8             data.table_1.14.2
AllanCameron commented 2 years ago

Thanks for writing.

Are you able to provide a reproducible example?

Using your code with a made-up data set of the same variables gives me the expected result:

set.seed(1234)

dt <- data.frame(year = rep(2015:2020, 3),
                 val = c(replicate(3, runif(6))),
                 Series = factor(paste("Series", rep(1:3, each = 6))))

library(geomtextpath)
#> Loading required package: ggplot2

ggplot(dt, aes(x = year, y = val)) + 
    scale_color_brewer(palette="Set1") +
    geom_textline(aes(label = Series, color = Series), vjust = -0.8, size = 6,
                  hjust = "ymax", linewidth = 2, text_smoothing = 30)

Created on 2022-05-04 by the reprex package (v2.0.1)

j-sirgo commented 2 years ago

Thanks for responding. I just tried your working example and I still get:

Warning message:
Ignoring unknown parameters: text_smoothing

Could it be the version of R or or another package?

AllanCameron commented 2 years ago

I don't know of another function called geom_textline - can you show the output of just typing geom_textlinein the console to ensure it is the correct version? Obviously a restart of Rstudio and a clean workspace are worth a try too.

j-sirgo commented 2 years ago

Here is the output:

> geom_textline
function (mapping = NULL, data = NULL, stat = "identity", 
    position = "identity", na.rm = FALSE, orientation = NA, 
    show.legend = NA, inherit.aes = TRUE, ...) 
{
    layer(data = data, mapping = mapping, stat = stat, geom = GeomTextLine, 
        position = position, show.legend = show.legend, inherit.aes = inherit.aes, 
        params = list(na.rm = na.rm, orientation = orientation, 
            ...))
}
<bytecode: 0x00000000159e17c8>
<environment: namespace:geomtextpath>
AllanCameron commented 2 years ago

And running without other packages attached ? (except ggplot2 obviously)

j-sirgo commented 2 years ago

No. But I dropped

library(forcats)
library(ggforce)
library(ggrepel)
library(ggh4x)
library(ggstream)

And it did not produce the error. Perhaps one of these creates some confusion.

AllanCameron commented 2 years ago

Thanks for that. There must be a clash somewhere with one of these packages. I'll investigate and keep you posted.

teunbrand commented 2 years ago

Judging by the function body, this might be from an older version of geomtextpath. Do you run into the same error with the current version on github? (remotes::install_github("AllanCameron/geomtextpath", quiet = TRUE))

j-sirgo commented 2 years ago

I am using the latest from GitHub geomtextpath_0.1.0.9000

teunbrand commented 2 years ago

In that case I don't understand why the function body you printed contains params = list(na.rm = na.rm whereas the github version has the following:

https://github.com/AllanCameron/geomtextpath/blob/f11e256bb74ebe8b88de026f67262430ca3b8d2d/R/geom_textpath.R#L311