matplotlib / AnatomyOfMatplotlib

Anatomy of Matplotlib -- tutorial developed for the SciPy conference
Other
1.21k stars 598 forks source link

Add knot to Ugly Tie shape #24

Closed TheAtomicOption closed 6 years ago

TheAtomicOption commented 6 years ago

Added geometry to the Ugly Tie polygon to look like a knot.

It remains a single polygon so color will affect both visible parts.

At large zooms/resolutions a connection between the right side of the knot and the main tie is visible because the points on right side of the knot are not perfectly in-line with the upper right corner of the tie where the two larger parts of the shape are visible. If this becomes an issue, doing some math to find evenly dividing, aligned points near the current values would make the connecting section of the polygon zero width.

WeatherGod commented 6 years ago

you can repeat the first point in the 5th position, then add np.nan to "jump" to the next coordinate. That'll get rid of the "seam" and also makes sure the polygons are closed.

TheAtomicOption commented 6 years ago

Just made the suggested change and tested it. Worked great!

WeatherGod commented 6 years ago

awesome! Thanks!