Skip to content

Backport PR #29895 on branch v3.10.x (The 'lines.markeredgecolor' now doesn't interfere on the color of errorbar caps)" #30057

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
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
2 changes: 1 addition & 1 deletion lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3780,7 +3780,7 @@ def _upcast_err(err):
'zorder', 'rasterized'):
if key in kwargs:
eb_cap_style[key] = kwargs[key]
eb_cap_style['color'] = ecolor
eb_cap_style["markeredgecolor"] = ecolor

barcols = []
caplines = {'x': [], 'y': []}
Expand Down
26 changes: 26 additions & 0 deletions lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -9618,3 +9618,29 @@ def test_axes_set_position_external_bbox_unchanged(fig_test, fig_ref):
ax_test.set_position([0.25, 0.25, 0.5, 0.5])
assert (bbox.x0, bbox.y0, bbox.width, bbox.height) == (0.0, 0.0, 1.0, 1.0)
ax_ref = fig_ref.add_axes([0.25, 0.25, 0.5, 0.5])


def test_caps_color():
# Creates a simple plot with error bars and a specified ecolor
x = np.linspace(0, 10, 10)
mpl.rcParams['lines.markeredgecolor'] = 'green'
ecolor = 'red'

fig, ax = plt.subplots()
errorbars = ax.errorbar(x, np.sin(x), yerr=0.1, ecolor=ecolor)

# Tests if the caps have the specified color
for cap in errorbars[2]:
assert mcolors.same_color(cap.get_edgecolor(), ecolor)


def test_caps_no_ecolor():
# Creates a simple plot with error bars without specifying ecolor
x = np.linspace(0, 10, 10)
mpl.rcParams['lines.markeredgecolor'] = 'green'
fig, ax = plt.subplots()
errorbars = ax.errorbar(x, np.sin(x), yerr=0.1)

# Tests if the caps have the default color (blue)
for cap in errorbars[2]:
assert mcolors.same_color(cap.get_edgecolor(), "blue")
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy