I am plotting a triangle mesh with vertex colors given by the x-coordinate of each vertex, along with a collection of line segments with colors given by the x-coordinate of each midpoint. The triangle mesh in question is an “angle bracket shape with a circular cut-away” and the line segments are the boundary of the circular cut-away. I get the following image:
Note the color mismatch between the line segment collection and the triangles in the triangle mesh immediately adjacent to it. The image is generated by this pseudocode
plt.figure()
T = Triangulation(bracket_vertices[:,0], bracket_vertices[:,1], bracket_triangles)
c = plt.tripcolor(T, bracket_vertices[:,0])
line_collection = LineCollection(circle_vertices[circle_segments,:], circle_midpoints[:,0])
plt.gca().add_collection(line_collection)
plt.colorbar(mappable=c)
plt.show()
where
bracket_vertices is an array of size nbverts x 2
bracket_triangles is an array of size nbtris x 3 of indices referencing into the above
circle_vertices is an array of size ncverts x 2
circle_segments is an array of size ncsegs x 2 of indices referencing into the above
circle_midpoints is an array of size ncsegs x 2
I feel that the color mismatch that I’m seeing in this image is a bit too big. My question is: is this color-mismatch an artifact of the way matplotlib assigns colors, or am I mis-using the color specifications in some way? I hope the above pseudocode is sufficiently clear to debug the issue, at least conceptually. Thanks very much for your help.