question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Let Scatter marker type be parameterizable

See original GitHub issue

I keep running into an issue with markers where there is a need to vary marker according to some attribute of the data. As far as I understand it, this can only be done by splitting the data up into different data sources and making separate GlyphRenderers for each marker. This is problematic for several reasons.

Take this example, where I’m varying color and marker according to a variable in the data:

screen shot 2017-02-16 at 6 21 44 pm

As illustrated above, one of the problems with breaking the data up and specifying multiple GlyphRenderers is that when you allow tap selection, the selection is restricted to only that group / marker. There are several related issues dealing with the various tools and callbacks when you want to think of the entire set of markers as a whole. The bigger issue is that it makes things a lot more complicated at the interface level for dealing this special case (in particular, it makes things pretty messy inside rbokeh).

To me, the ideal solution would be instead of individual classes “Circle”, “Square”, etc., having a class “Marker” that has an attribute “marker” that can be any one of: “Asterisk”, “Circle”, “CircleCross”, “CircleX”, “Cross”, “Diamond”, “DiamondCross”, “InvertedTriangle”, “Square”, “SquareCross”, “SquareX”, “Triangle”, “X”. As far as I understand, all of the current marker classes have the same attributes, so it seems like this would be possible.

So basically instead of having a specification with things like this:

{
  "type": "GlyphRenderer",
  "attributes": {
    "glyph": {
      "type": "Circle",
      ...
    }
  }
},
{
  "type": "Circle",
  "attributes": {
    "x": {
      "units": "data",
      "field": "x"
    },
    "y": {
      "units": "data",
      "field": "y"
    },
    ...
  }
}

{
  "type": "GlyphRenderer",
  "attributes": {
    "glyph": {
      "type": "Square",
      ...
    }
  }
},
{
  "type": "Square",
  "attributes": {
    "x": {
      "units": "data",
      "field": "x"
    },
    "y": {
      "units": "data",
      "field": "y"
    },
    ...
  }
},
...

With each having a separate ColumnDataSource. Instead, something like this would make life so much easier:

{
  "type": "GlyphRenderer",
  "attributes": {
    "glyph": {
      "type": "Marker",
      ...
    }
  }
},
{
  "type": "Marker",
  "attributes": {
    "x": {
      "units": "data",
      "field": "x"
    },
    "y": {
      "units": "data",
      "field": "y"
    },
    "marker": {
      "units": "data",
      "field": "m"
    },
    ...
  }
},
{
  "type": "ColumnDataSource",
  "attributes": {
    "column_names": ["x", "y", "m"],
    "data": {
      "x": [1, 2, 3],
      "y": [1, 2, 3],
      "m": ["Circle", "Square", "Triangle"],
      ...
    }
  }
},
...

Where here there is a single data source.

If this is not possible or not a priority, is there any way with the current structure of things that I can have a single ColumnDataSource with multiple markers?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
bryevdvcommented, Sep 25, 2018

FYI @hafen this is incoming:

screen shot 2018-09-25 at 18 22 31
2reactions
bryevdvcommented, Oct 18, 2017

OK, the newly linked issue has made me re-consider. In cases where folks want multiple lines and scatter glyphs together, not having a “multi glyph” can be quite slow.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dashboard Element 2: The Parameterized Scatter Plot
How to create a parameterized scatter plot in Tableau; Become a member ... First, you must set up a parameter with a data...
Read more >
Plotting with basic glyphs - Bokeh documentation
Bokeh's built-in scatter markers consist of a set of base markers, most of which can be combined with different kinds of additional visual...
Read more >
Changing marker style in scatter plot according to third variable
The problem is that marker can only be a single value and not a list of markers, as the color parmeter. You can...
Read more >
Scatter plot - MATLAB scatter - MathWorks
This MATLAB function creates a scatter plot with circular markers at the locations specified by the vectors x and y.
Read more >
Markers in Matplotlib - Brandon Rohrer
Here we created an array of sizes, one for each marker. scatterplot using circular markers of differing sizes. Change the marker style. Sometimes...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found