Skip to content

Colored segments with manual group assignment breaks geom_path line endings #727

@bmorledge-hampton19

Description

@bmorledge-hampton19

I am trying to use geom_path to create a plot with multiple, continuous segments of different colors, joined by round line endings. Here is an example of some code that I would expect to achieve this:

import pandas
from plotnine import *

df = pandas.DataFrame({'x': [1, 2, 3, 4, 5, 6, 7],
                       'y': [18, 22, 19, 14, 14, 11, 20],
                       "color": ["blue", "green", "blue", "blue", "green", "green", "blue"]})

(
    ggplot(df, aes(x = 'x', y = 'y', color = "color", group = 1)) +
    geom_path(size = 2, lineend = "round") +
    scale_color_identity()
)

Unfortunately, using different colors in combination with the manual group assignment appears to break the line endings so that they are the default "butt":

image

This seems to me to be a bug, as I have used this pattern in R ggplot before and it produces the proper line endings as expected. Am I missing something obvious here? Is there a simple fix, or is this a problem that will need to be addressed in a future release?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions