-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a style_categories method (#261)
- Loading branch information
Showing
5 changed files
with
189 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
""" | ||
================================ | ||
Highlighting selected categories | ||
================================ | ||
Demonstrates use of the `style_categories` method to mark some | ||
categories differently. | ||
""" | ||
|
||
from matplotlib import pyplot as plt | ||
|
||
from upsetplot import UpSet, generate_counts | ||
|
||
example = generate_counts() | ||
|
||
|
||
########################################################################## | ||
# Categories can be shaded by name with the ``shading_`` parameters. | ||
|
||
upset = UpSet(example) | ||
upset.style_categories("cat2", shading_edgecolor="darkgreen", shading_linewidth=1) | ||
upset.style_categories( | ||
"cat1", | ||
shading_facecolor="lavender", | ||
) | ||
upset.plot() | ||
plt.suptitle("Shade or edge a category with color") | ||
plt.show() | ||
|
||
|
||
########################################################################## | ||
# Category total bars can be styled with the ``bar_`` parameters. | ||
# You can also specify categories using a list of names. | ||
|
||
upset = UpSet(example) | ||
upset.style_categories( | ||
["cat2", "cat1"], bar_facecolor="aqua", bar_hatch="xx", bar_edgecolor="black" | ||
) | ||
upset.plot() | ||
plt.suptitle("") | ||
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters