Skip to content

Contours fail with options(OutDec= ",") #5555

Closed
@eliocamp

Description

@eliocamp

This probably hast o do with how ggplot2 is deriving the level variable from isoband's names.

Reprex:

library(ggplot2)

options(OutDec= ".")
ggplot(faithfuld, aes(waiting, eruptions, z = density)) +
  geom_contour_filled()

ggplot(faithfuld, aes(waiting, eruptions, z = density)) +
  geom_contour(aes(color = after_stat(factor(level))))

options(OutDec= ",")
ggplot(faithfuld, aes(waiting, eruptions, z = density)) +
  geom_contour_filled()
#> Warning in pretty_isoband_levels(names(isobands)): NAs introduced by coercion

#> Warning in pretty_isoband_levels(names(isobands)): NAs introduced by coercion
#> Warning: Computation failed in `stat_contour_filled()`
#> Caused by error in `levels<-`:
#> ! factor level [3] is duplicated

ggplot(faithfuld, aes(waiting, eruptions, z = density)) +
  geom_contour(aes(color = after_stat(factor(level))))
#> Warning in compute_group(...): NAs introduced by coercion
#> Warning in min(x): no non-missing arguments to min; returning Inf
#> Warning in max(x): no non-missing arguments to max; returning -Inf
#> Error: Must request at least one colour from a hue palette.

Created on 2023-12-01 with reprex v2.0.2

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