Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion curlyBrace.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,8 @@ def curlyBrace(fig, ax, p1, p2, k_r=0.1, bool_auto=True, str_text='', int_line_n
pass

# plot arcs
ax.plot(arc1x, arc1y, **kwargs)
l, = ax.plot(arc1x, arc1y, **kwargs)
kwargs["color"] = l.get_color()
ax.plot(arc2x, arc2y, **kwargs)
ax.plot(arc3x, arc3y, **kwargs)
ax.plot(arc4x, arc4y, **kwargs)
Expand Down
27 changes: 27 additions & 0 deletions exp_color.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""Simple example of curlyBrace with automatic colors.

Author: Markus Reinert
Last Modified: 2022-03-23
"""

import matplotlib.pyplot as plt

from curlyBrace import curlyBrace


save_figure = False


fig, ax = plt.subplots()
ax.set_ylim(2, 12)
ax.set_xlim(-1, 1)
for i in range(12):
# The color of the curlyBrace is not given explicitly,
# but determined automatically by matplotlib's color rotation
curlyBrace(fig, ax, (-1, i), (1, i))

if save_figure:
import os
fig.savefig(os.path.basename(__file__).replace(".py", ".png"))

plt.show()