[Matplotlib-users] Vectorized version of text()

Brendan Barnwell brenbarn at brenbarn.net
Sun Sep 13 03:02:21 CEST 2015


	This is something that I constantly wish for and keep having to hack
around when I remember there's nothing to do it.  Or is there?  Am I
missing something?

	What I want is the ability to provide a vector of x, y, and text, so
that *with a single call* I can display specified bits of text at a
specified points.

	Currently text() only puts a single text at a single point, so to plot
multiple texts you have to call it in a loop.  This is especially
annoying because, when you have everything in a pandas DataFrame, the
points and text are often already aligned as separate columns.  I'd like
to be able to do pyplot.multitext(df.x, df.y, df.label) or whatever and
just have it work.  Better yet, just be able to pass an extra 
"pointlabel" argument directly to scatter, which would specify a 
sequence of labels, one for each point.  The labels could then be turned 
off with some method on the scatter artist (and perhaps a shortcut 
pyplot method as well).

	I seem to recall there are some performance issues with plotting many
different Text objects, but that doesn't seem reason enough in itself 
not to provide this, since lots of things can cause performance issues 
with large datasetrs.  Does anyone else think this would be worth adding?

-- Brendan Barnwell
"Do not follow where the path may lead. Go, instead, where there is no 
path, and leave a trail."


More information about the Matplotlib-users mailing list