PyTuflow: Difference between revisions

Content deleted Content added
No edit summary
Line 762:
# add legend to plot
lines, labs = ax.get_legend_handles_labels()
 
ax.legend(lines, labs)
# filter duplicate legend items
# for example if there is more than one pipe or culvert we only want that to appear once in the legend
unique_lines = []
unique_labels = []
for i, label in enumerate(labs):
if label not in unique_labels:
unique_labels.append(label)
unique_lines.append(lines[i])
ax.legend(linesunique_lines, labsunique_labels)
# show plot
Line 821 ⟶ 830:
# did not load correctly, print error message to console
print(message)
</pre>
 
==load==