teunbrand / ggh4x

ggplot extension: options for tailored facets, multiple colourscales and miscellaneous
https://teunbrand.github.io/ggh4x/
Other
542 stars 33 forks source link

Linepiece colours in geom_pointpath() #15

Closed teunbrand closed 4 years ago

teunbrand commented 4 years ago

Sometimes they are coloured incorrectly:

library(ggplot2)
library(ggh4x)

df <- data.frame(
    x = rep(1:5, 2),
    y = c(1:5, (1:5)^2),
    z = rep(LETTERS[1:2], each = 5)
)

ggplot(df, aes(x, y, colour = z)) +
    geom_pointpath()

teunbrand commented 4 years ago

More thoughts about this:

teunbrand commented 4 years ago

Should now be able to do this:

library(ggplot2)
library(ggh4x)

df <- data.frame(
  x = rep(1:5, 2),
  y = c((2:6)^1.5, (1:5)^2),
  z = rep(LETTERS[1:2], each = 5)
)

ggplot(df, aes(x, y, colour = z)) +
  geom_pointpath() +
  coord_polar()

Created on 2020-07-01 by the reprex package (v0.3.0)