From c1bcca9bc72502cf81d28265056d3c293481a856 Mon Sep 17 00:00:00 2001 From: Christoph Groth <christoph.groth@cea.fr> Date: Tue, 6 Feb 2018 16:23:25 +0100 Subject: [PATCH] fix streamline color if no lines are blended Matplotlib backends like PDF cannot display arbitrarily thin lines. That's why kwant.plotter.streamplot simulates thinner lines by blending them into the background. Previously if no lines were blended, i.e. all had the same color value 1, the background color would be used for drawing them instead of the line color. --- kwant/plotter.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kwant/plotter.py b/kwant/plotter.py index b591d585..2f38fa9c 100644 --- a/kwant/plotter.py +++ b/kwant/plotter.py @@ -2115,7 +2115,8 @@ def streamplot(field, box, cmap=None, bgcolor=None, linecolor='k', ax.streamplot(X, Y, field[:,:,0], field[:,:,1], density=density, linewidth=linewidth, - color=color, cmap=line_cmap, arrowstyle='->') + color=color, cmap=line_cmap, arrowstyle='->', + norm=matplotlib.colors.Normalize(0, 1)) ax.set_xlim(*box[0]) ax.set_ylim(*box[1]) -- GitLab