Skip to content

ggplotly / barplot : Error in if (is.character(new.mode) && !is.na(new.mode)) #250

Closed
@giacomovagni

Description

@giacomovagni

I am trying to plot a simple barplot with ggplot and ggplotly but I get this message error

Error in if (is.character(new.mode) && !is.na(new.mode)) { : missing value where TRUE/FALSE needed

I have no idea how to solve this issue.

Here is my ggplot code
a.
dta2 <- dta %>% melt %>% group_by(Var2, value) %>% summarise(count = n( )/nrow(dta))
b.
ggplot(dta2, aes(x = Var2, y = as.numeric(count), fill = factor(value))) + scale_fill_manual(values=rainbow(20)) + geom_bar(stat='identity', width = 1, position = "stack") + theme_minimal()
c.
ggplotly()

Error in if (is.character(new.mode) && !is.na(new.mode)) { : missing value where TRUE/FALSE needed

barplotggplot

Any idea ?

Here is my reproductible data

dta = structure(c(7L, 2L, 6L, 48L, 56L, 7L, 7L, 7L, 46L, 7L, 7L, 24L, 7L, 19L, 7L, 30L, 7L, 24L, 42L, 67L, 7L, 2L, 27L, 48L, 56L, 7L, 7L, 7L, 67L, 7L, 7L, 24L, 7L, 20L, 7L, 30L, 7L, 67L, 42L, 23L, 7L, 2L, 27L, 48L, 56L, 7L, 7L, 7L, 67L, 7L, 7L, 24L, 7L, 20L, 7L, 30L, 7L, 67L, 42L, 23L, 7L, 2L, 27L, 48L, 56L, 7L, 7L, 7L, 67L, 7L, 7L, 24L, 7L, 20L, 7L, 30L, 7L, 67L, 42L, 23L, 7L, 2L, 27L, 48L, 56L, 7L, 7L, 7L, 67L, 7L, 7L, 24L, 7L, 20L, 7L, 30L, 7L, 67L, 42L, 23L, 7L, 2L, 27L, 48L, 56L, 7L, 7L, 7L, 67L, 7L, 7L, 24L, 7L, 20L, 7L, 30L, 7L, 67L, 42L, 23L, 7L, 2L, 27L, 48L, 56L, 7L, 7L, 7L, 67L, 7L, 7L, 24L, 7L, 20L, 7L, 30L, 7L, 67L, 42L, 23L, 7L, 2L, 27L, 48L, 56L, 7L, 7L, 7L, 67L, 7L, 7L, 24L, 7L, 20L, 7L, 30L, 7L, 67L, 42L, 23L, 7L, 2L, 27L, 48L, 56L, 7L, 7L, 7L, 67L, 7L, 7L, 24L, 7L, 20L, 7L, 30L, 7L, 67L, 42L, 23L, 7L, 2L, 27L, 48L, 56L, 7L, 7L, 7L, 67L, 7L, 7L, 24L, 7L, 20L, 7L, 30L, 7L, 67L, 42L, 23L), .Dim = c(20L, 10L), .Dimnames = list( c("1013662", "1024583", "1024812", "1025491", "1036642", "1037551", "1037552", "1037991", "1037992", "1040291", "1040292", "1041101", "1041212", "1041651", "104221", "104222", "104331", "104332", "104992", "1052571"), c("400", "401", "402", "403", "404", "405", "406", "407", "408", "409")))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions