Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

The 'lines.markeredgecolor' now doesn't interfere on the color of errorbar caps#29895

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

useidemaisachola
Copy link
Contributor

PR summary

-This change was necessary to resolve a bug:Fixes#29780
-Color of errorbar caps now it's not affected by 'lines.markeredgecolor'.

  • The reason behind the implementation is as follows:
    The initial issue arose when the caps of the error bars were unintentionally adopting the color red, which was set globally in mpl.rcParams under the 'lines.markeredgecolor' parameter. This global setting was being applied to all markers, including the caps of error bars, causing the caps to appear red even when that wasn't intended.
    The root cause of the problem was that the marker edge color defined globally (mpl.rcParams['lines.markeredgecolor']) was being inherited by the caps as part of the error bar plot. This caused the color of the caps to match the global red color, even when only the error bars were supposed to be red (through the ecolor parameter).
    To solve this, we needed to ensure that the caps would use the specified ecolor independently of the global mpl.rcParams['lines.markeredgecolor']. This was achieved by setting the marker edge color for the caps separately, rather than relying on the global configuration.
    The files that suffered alterations were _axes.py and test_axes.py.

PR checklist

…olorTo solve this, we needed to ensure that the caps would use thespecified ecolor independently of the globalmpl.rcParams['lines.markeredgecolor']. This was achieved bysetting the marker edge color for the caps separately, rather than relying on the global configuration.
@tacaswell
Copy link
Member

The default value oflines.markeredgecolor'auto' which means "follow the color", but when setting it to a color it stops following the color of the line.

This is the correct fix.

@tacaswell
Copy link
Member

@useidemaisachola Thank you for this fix and the test! If you can clean up the linting/whitespace issues I think this can be merged straight away.

@tacaswelltacaswell added this to thev3.10.2 milestoneApr 11, 2025
@useidemaisachola
Copy link
ContributorAuthor

@tacaswell ok, i can solve them! One question as this is my first PR - after i resolve the problems with the spaces i have to commit and open another PR? Or it's possible to still use this one?

@QuLogic
Copy link
Member

You should continue on your branch, and pushing it here will update this PR.

@useidemaisachola
Copy link
ContributorAuthor

@QuLogic Ok, thank you!

@useidemaisachola
Copy link
ContributorAuthor

@tacaswell I resolved the problem with the spaces! Now it's giving some kind of error with the version of python on windows... It is something that i have to change?

@rcomer
Copy link
Member

@useidemaisachola that Azure Windows test can be flakey. The failure is not caused by your change. I have re-run it to see if we can be lucky the second time.

@useidemaisachola
Copy link
ContributorAuthor

so, now i have to resolve the conflits?

@rcomer
Copy link
Member

rcomer commentedApr 25, 2025
edited
Loading

so, now i have to resolve the conflits?

Yes, but if you are not comfortable doing that we can handle it for you. It looks like you and and another recent PR have added new tests in the same place, so it's just a case of making sure we keep both.

@useidemaisachola
Copy link
ContributorAuthor

Already resolved the conflit but I guess i leaved an extra line at the end of the file or something like that, because it's failing one test... it's that?

@timhoffm
Copy link
Member

I took the liberty to remove the extra line at the end. Tests should pass now.

Comment on lines 9757 to 9762
y = np.sin(x)
yerr = 0.1
mpl.rcParams['lines.markeredgecolor'] = 'green'

fig, ax = plt.subplots()
errorbars = ax.errorbar(x, y, yerr=yerr, fmt='o', capsize=5)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

As above:

Suggested change
y=np.sin(x)
yerr=0.1
mpl.rcParams['lines.markeredgecolor']='green'
fig,ax=plt.subplots()
errorbars=ax.errorbar(x,y,yerr=yerr,fmt='o',capsize=5)
mpl.rcParams['lines.markeredgecolor']='green'
fig,ax=plt.subplots()
errorbars=ax.errorbar(x,np.sin(x),yerr=0.1)

@useidemaisachola
Copy link
ContributorAuthor

ok, thank you for the tips and the help!

@ksundenksunden modified the milestones:v3.10.2,v3.10.3May 2, 2025
@useidemaisachola
Copy link
ContributorAuthor

I have to enter the suggestion that you told me or it´s already changed in the repository?

@QuLogic
Copy link
Member

You'll have to apply it yourself, either locally and push, or using the UI here.

Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
@useidemaisachola
Copy link
ContributorAuthor

ok, it gave an error but I will fix it.

@useidemaisachola
Copy link
ContributorAuthor

I think everything it´s ok now.

@useidemaisachola
Copy link
ContributorAuthor

Now i have to do close or something like that?

@timhoffm
Copy link
Member

No. You don't have to do anything. We have policy that each PR needs two approvals by core developers. So, we're just waiting for a second review.

@useidemaisachola
Copy link
ContributorAuthor

useidemaisachola commentedMay 14, 2025
edited
Loading

Ok, thank you.

@QuLogicQuLogic merged commit20bdd72 intomatplotlib:mainMay 15, 2025
40 checks passed
@QuLogic
Copy link
Member

Thanks@useidemaisachola! Congratulations on your first PR to Matplotlib 🎉 We hope to hear from you again.

@lumberbot-appLumberbot (App)
Copy link

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
git checkout v3.10.xgit pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
git cherry-pick -x -m1 20bdd72d3cb9a4a93657091d80fdeb9d0089609c
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
git commit -am "Backport PR #29895: The 'lines.markeredgecolor' now doesn't interfere on the color of errorbar caps "
  1. Push to a named branch:
git push YOURFORK v3.10.x:auto-backport-of-pr-29895-on-v3.10.x
  1. Create a PR against branch v3.10.x, I would have named this PR:

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

And apply the correct labels and milestones.

Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon!

Remember to remove theStill Needs Manual Backport label once the PR gets merged.

If these instructions are inaccurate, feel free tosuggest an improvement.

@useidemaisachola
Copy link
ContributorAuthor

@QuLogic Thank you so much! So can I delete already the branch? The lumberbot gave some kind of feedback...

@rcomer
Copy link
Member

@useidemaisachola you can safely delete your branch. Your work is now in Matplotlib'smain branch and lumberbot is here to help us get it also into ourv3.10.x branch (which we will use for the next micro release).
https://matplotlib.org/devdocs/devel/pr_guide.html#backport-strategy

@useidemaisachola
Copy link
ContributorAuthor

Ok, thank you!

@useidemaisacholauseidemaisachola deleted the bugfix-for-issue-29780 branchMay 15, 2025 15:46
QuLogic pushed a commit to QuLogic/matplotlib that referenced this pull requestMay 15, 2025
@QuLogicQuLogic changed the titleThe 'lines.markeredgecolor' now doesn't interfere on the color of errorbar capsThe 'lines.markeredgecolor' now doesn't interfere on the color of errorbar capsMay 15, 2025
dstansby added a commit that referenced this pull requestMay 17, 2025
…3.10.xBackport PR#29895 on branch v3.10.x (The 'lines.markeredgecolor' now doesn't interfere on the color of errorbar caps)"
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@QuLogicQuLogicQuLogic approved these changes

@timhoffmtimhoffmtimhoffm approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
v3.10.4
Development

Successfully merging this pull request may close these issues.

[Bug]: Setting 'lines.markeredgecolor' affects color of errorbar caps.
6 participants
@useidemaisachola@tacaswell@QuLogic@rcomer@timhoffm@ksunden

[8]ページ先頭

©2009-2025 Movatter.jp