plotly / plotly/plotly.R

color/symbol mapping breaks `transforms` filter

Open
#1,502 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug difficulty: medium priority: medium
Dominant language
R
Stars
2.7k
Forks
641
PR merge metrics
No merged PRs in 30d

Description

Issue

transforms filter plus color/symbol mapping seems to break the transforms filter.

Reprex

Sample data

df <- data.frame(
    x = c(1:10, 1:10),
    y = c(1:10, 10:1),
    z = c(rep("up", 10), rep("down", 10)))

The idea is to only show data where z = "up" through a transforms filter.

Case 1: transforms filter without color mapping

This works

plot_ly(
    df,
    x = ~x, y = ~y, text = ~z,
    type = "scatter", mode = "markers+text",
    marker = list(size = 10, opacity = 0.8),
    transforms = list(
        list(
            type = "filter",
            target = ~z,
            operation = "=",
            value = "up")))

Screen Shot 2019-03-21 at 3 58 58 pm

Case 2: transforms filter with color mapping

This does not work

plot_ly(
    df,
    x = ~x, y = ~y, text = ~z, color = ~z,
    type = "scatter", mode = "markers+text",
    marker = list(size = 10, opacity = 0.8),
    transforms = list(
        list(
            type = "filter",
            target = ~z,
            operation = "=",
            value = "up")))

Screen Shot 2019-03-21 at 3 59 35 pm

Summary

In both cases the transforms filter is the same and should select only those entries where z = "up"; however, when a color (or symbol) mapping is added, for some reason only entries where z = "down" are shown.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the two plot_ly() reprexes in the issue and compare the generated behavior with and without color = ~z or symbol mapping. Reproduce the transforms filter using the supplied data, then trace the relevant plotly.R mapping and transform handling; done means the filter consistently shows only rows where z = "up" with color or symbol mapping enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.