enthought / enthought/mayavi

plotting_many_lines.py, vector_scatter: Something's still missing

Open
#162 0 comments 0 reactions 0 assignees View on GitHub
support
Dominant language
Python
Stars
1.4k
Forks
316
Avg merge
7h 44m
Merged PRs (30d)
5

Description

[plotting_many_lines.py](https://github.com/enthought/mayavi/blob/master/docs/source/mayavi/auto/plotting_many_lines.py) is a nice demonstration of something that one would think, _naively_, would be the function of `vector_scatter`. Alas, there does not appear to be any way to tell `vector_scatter` to just use a good ole line instead of a glyph, and we're left with what feels like a clunky solution.

Why clunky? Well, one compelling use-case for the `plot_many_lines` code is visualizing the edge weights of a weighted graph. The idea here is to color each edge according to some scalar value. Except that that appears to be basically impossible to do in a clean way. In particular, the `scalar_scatter` to `surface` trick sets up a pipeline that only respects the _point_ color; the edges end up multicolored, an interpolation between the two endpoint colors.

So, AFAIK, the only way to get a set of lines with one solid color on each line is to modify the `plot_many_lines` code to create redundant point data -- two separate points -- for each line segment. This is highly inefficient since some scatter points may serve as endpoints to multiple lines, and generally ruins the elegance of the `scalar_scatter`-to-`surface` solution.

Question: What is the canonical way of plotting many line segments, each one with it's own solid color?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.