| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1b2a3c9 commit 20d7d81
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -724,7 +724,7 @@ def __init__(self, ax, *args, | |||
| 724 | 724 | hatches=(None,), alpha=None, origin=None, extent=None, | |
| 725 | 725 | cmap=None, colors=None, norm=None, vmin=None, vmax=None, | |
| 726 | 726 | extend='neither', antialiased=None, nchunk=0, locator=None, | |
| 727 | - transform=None, | ||
| 727 | + transform=None, negative_linestyles=None, | ||
| 728 | 728 | **kwargs): | |
| 729 | 729 | """ | |
| 730 | 730 | Draw contour lines or filled regions, depending on | |
@@ -809,6 +809,13 @@ def __init__(self, ax, *args, | |||
| 809 | 809 | ||
| 810 | 810 | self._transform = transform | |
| 811 | 811 | ||
| 812 | + self.negative_linestyles = negative_linestyles | ||
| 813 | + # If negative_linestyles was not defined as a kwarg, | ||
| 814 | + # define negative_linestyles with rcParams | ||
| 815 | + if self.negative_linestyles is None: | ||
| 816 | + self.negative_linestyles = \ | ||
| 817 | + mpl.rcParams['contour.negative_linestyle'] | ||
| 818 | + | ||
| 812 | 819 | kwargs = self._process_args(*args, **kwargs) | |
| 813 | 820 | self._process_levels() | |
| 814 | 821 | ||
@@ -1299,11 +1306,10 @@ def _process_linestyles(self): | |||
| 1299 | 1306 | if linestyles is None: | |
| 1300 | 1307 | tlinestyles = ['solid'] * Nlev | |
| 1301 | 1308 | if self.monochrome: | |
| 1302 | - neg_ls = mpl.rcParams['contour.negative_linestyle'] | ||
| 1303 | 1309 | eps = - (self.zmax - self.zmin) * 1e-15 | |
| 1304 | 1310 | for i, lev in enumerate(self.levels): | |
| 1305 | 1311 | if lev < eps: | |
| 1306 | - tlinestyles[i] = neg_ls | ||
| 1312 | + tlinestyles[i] = self.negative_linestyles | ||
| 1307 | 1313 | else: | |
| 1308 | 1314 | if isinstance(linestyles, str): | |
| 1309 | 1315 | tlinestyles = [linestyles] * Nlev | |
@@ -1764,6 +1770,18 @@ def _initialize_x_y(self, z): | |||
| 1764 | 1770 | iterable is shorter than the number of contour levels | |
| 1765 | 1771 | it will be repeated as necessary. | |
| 1766 | 1772 | ||
| 1773 | + negative_linestyles : *None* or str, optional | ||
| 1774 | + {'solid', 'dashed', 'dashdot', 'dotted'} | ||
| 1775 | + *Only applies to* `.contour`. | ||
| 1776 | + | ||
| 1777 | + If *negative_linestyles* is *None*, the default is 'dashed' for | ||
| 1778 | + negative contours. | ||
| 1779 | + | ||
| 1780 | + *negative_linestyles* can also be an iterable of the above | ||
| 1781 | + strings specifying a set of linestyles to be used. If this | ||
| 1782 | + iterable is shorter than the number of contour levels | ||
| 1783 | + it will be repeated as necessary. | ||
| 1784 | + | ||
| 1767 | 1785 | hatches : list[str], optional | |
| 1768 | 1786 | *Only applies to* `.contourf`. | |
| 1769 | 1787 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments