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
This commit is contained in:
Cosimo Lupo 2019-02-27 14:08:14 -08:00
parent cd58eb3276
commit cbb7528395

View File

@ -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.)