Skip to content

geom_line becomes invisible when color aesthetic applied #3205

Closed
@wolfeclw

Description

@wolfeclw

I am attempting to apply a gradient color scale to a line in a ggplot object. When I create the plotly chart, the plotted line is not visible. Hovering over the plot area shows the values of the variables if the cursor is where the line is located, even though the line is not visible.

If I do not apply a color aesthetic, the line is visible.

I have download the most recent plotly package from Github.

Here is some example code of the issue:

library(tidyverse)

df <- tibble(
x = rnorm(100, 7, 1),
y = rnorm(100, 4, 1),
z = rnorm(100, 5, 1))

plot <- ggplot(df) +
geom_line(aes(x, y, color = z),
lwd = 1.5) +
scale_color_gradient(low = "red",
high = "blue")

plot
ggplot_ex

plotly::plotly_build(plot)

plotly_ex

Activity

alexcjohnson

alexcjohnson commented on Nov 1, 2018

@alexcjohnson
Collaborator

@cpsievert would you prefer this over at https://github.com/ropensci/plotly ?
Presumably this is #581 - note our (as yet unimplemented) plan to allow line color/width arrays only in scattergl

cpsievert

cpsievert commented on Nov 1, 2018

@cpsievert

Ohhh, yea, if you can transfer that'd be great -- super stoked to see this in scattergl!

wolfeclw

wolfeclw commented on Nov 1, 2018

@wolfeclw
Author

Yes, I had meant to post this over there. Thanks for the tip!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

        Participants

        @cpsievert@alexcjohnson@wolfeclw

        Issue actions

          geom_line becomes invisible when color aesthetic applied · Issue #3205 · plotly/plotly.js