From cbb75283954921420824d18f340dc688b4548bbb Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Wed, 27 Feb 2019 14:08:14 -0800 Subject: [PATCH] varLib.plot: fix IndexError when specifying anonymous locations on the commandline Don't write title with the source's name where we don't have one --- Lib/fontTools/varLib/plot.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Lib/fontTools/varLib/plot.py b/Lib/fontTools/varLib/plot.py index b03744e91..c8ba7666f 100644 --- a/Lib/fontTools/varLib/plot.py +++ b/Lib/fontTools/varLib/plot.py @@ -35,7 +35,7 @@ def plotLocationsSurfaces(locations, fig, names=None, **kwargs): assert len(locations[0].keys()) == 2 if names is None: - names = [''] + names = [None] * len(locations) n = len(locations) cols = math.ceil(n**.5) @@ -45,10 +45,11 @@ def plotLocationsSurfaces(locations, fig, names=None, **kwargs): names = [names[model.reverseMapping[i]] for i in range(len(names))] ax1, ax2 = sorted(locations[0].keys()) - for i, (support,color, name) in enumerate(zip(model.supports, cycle(pyplot.cm.Set1.colors), cycle(names))): + for i, (support, color ,name) in enumerate(zip(model.supports, cycle(pyplot.cm.Set1.colors), cycle(names))): axis3D = fig.add_subplot(rows, cols, i + 1, projection='3d') - axis3D.set_title(name) + if name is not None: + axis3D.set_title(name) axis3D.set_xlabel(ax1) axis3D.set_ylabel(ax2) pyplot.xlim(-1.,+1.)