Open
Description
A simple function for a multicolor line (à la http://matplotlib.org/examples/pylab_examples/multicolored_line.html) could be helpful, as the recipe is not that trivial. Shoehorning this into plot
is probably going to be difficult, so I'd suggest something like
def plot_multicolor(
x, y, *,
line_data=None, line_vmin=None, line_vmax=None, line_norm=None, line_cmap=None,
point_data=None, point_vmin=None, point_vmax=None, point_norm=None, point_cmap=None,
vmin=None, vmax=None, norm=None, cmap=None, **properties): ...
(so that both line colors and marker colors can be set; the last line of properties provide defaults if only one of them has to be set, mostly for convenience).
Thoughts?
Activity
tacaswell commentedon Feb 22, 2016
Please do not try to shoe-horn it into plot. There are already too much complexity / magic in that method.
Instead of having a third set of
vmin
, ... maybe allow the point set of them to take'line'
as a valid input and'marker'
for the line version. If everything isNone
, just fall back toplot
?anntzer commentedon Feb 24, 2016
Yup, I wouldn't want to touch
plot
with a ten foot pole. Perhaps something likewhere
line
andmarker
can be dicts with a (required)"data"
entry (of the correct size, i.e.len(x)
formarker
butlen(x) - 1
forline
) and additional entries corresponding respectively to line or marker props, which would override the defaults set in**line_and_marker_properties
?WeatherGod commentedon Feb 24, 2016
Remember, we still support python 2.7, so required kwargs aren't available
to us (not having that in
__future__
is my biggest gripe about the2.x->3.x transition).
On Wed, Feb 24, 2016 at 2:35 AM, Antony Lee notifications@github.com
wrote:
anntzer commentedon Feb 24, 2016
Yup, this is just to discuss the API, if we go this route we can always use kwargs-popping.
dopplershift commentedon Feb 24, 2016
I have an implementation of something like this over in MetPy. I'm not saying it's bullet proof, but I'll offer it as a starting point of the implementation:
Then again, maybe
stride_tricks
is a bit too much magic to bite off...tacaswell commentedon Feb 24, 2016
I would also add that there was some discussion about making a new python3 only module and this seems like a good candidate to be the first thing in there.
anntzer commentedon Jun 1, 2016
I noticed that
LineCollection
has a much worse performance than a normal plot.plot
can handle hundreds of thousands of points instantly, but just creating theLineCollection
is already pretty slow:mostly because it needs to create a bunch of
Path
objects.efiring commentedon Jun 1, 2016
Nevertheless, if you can find a more efficient way to accomplish the colored_line functionality, that would be great. You might be able to take advantage of path simplification in the case where there are too many data points for the available resolution.
10 remaining items