Skip to content

Error in textplot (wordlayout) when plotting only 1 point #2

@l0ka

Description

@l0ka

When I try to plot only 1 point, the following error message appears:
Error in if (sdx == 0) sdx <- 1 : missing value where TRUE/FALSE needed

The issue relies in the wordlayout functions, when computing the standard deviation:
sdx <- sd(x, na.rm = TRUE)
sdy <- sd(y, na.rm = TRUE)
If x and y refer to only 1 point, sdx and sdy result in NA and this causes the above error message.

Steps to reproduce the issue:
library(wordcloud)
df = data.frame(id = 'sample', x = 0.2, y = 0.4)
plot(x = df$x, y = df$y)
textplot(x = df$x, y = df$y, words = df$id, new = F)

Informations about system:
OS: Debian 9.3 - linux-image-4.9.0-5-amd64
R version 3.4.3 (CRAN Repository)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions