-
Notifications
You must be signed in to change notification settings - Fork 33
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
ENH Errorbars in the middle of the bins (1D-plots) #428
Comments
Hey @sjjamsa thanks for using this package in a journal paper! Please do reach back when it is accepted and published and we'll add it to the publication list 🎉 But to the plotting issue at hand. The short answer is there isn't an easy way to do this, because we fall back to For a short-term fix, you're probably going to have to implement this on your own. You could use our routines to draw the plot without errorbars, and then manually define the new x positions that corresponds to the midpoint of each bin. You can imagine how that could get complicated, trying to handle log or linear scaling, where the numeric midpoint may not be the visual midpoint of the bin as it is plotted. ExtraThere's some really good discussion by the MPL developers in some similar-but-not-really-related issues matplotlib/matplotlib#15065 and matplotlib/matplotlib#18275 if you want to dig a little deeper into maybe making this a PR for MPL |
Thank you @drewejohnson! I looked into the serpentTools implementation, and found out serpentTools uses the There are probably multiple ways this could be fixed, but the code would definitley become more complex. So here is my work-around:
So do you want to close this ticket and wait for someone in upstream matplotlib to implement exactly what we want? |
I'll think on this some more, but your solution does indeed plot the errorbars at the midpoint of the bin. And the code would become a bit more complicated, but we've attempted to market this project as a way to get publication quality plots with ease. Having MPL handle this upstream would be great, but I think we can shoulder the burden in a few select cases. Our plot methods also know if we're plotting on a log-x scale, so we can place the errorbars in the logarithmic midpoint rather than arithmetic midpoint (as you've done here). Requires a little more logic, but that would place the errorbars directly in the center of the bin as it was drawn (e.g. the value 75 would appear closer to the value 50 than 100 if plotted on a log scale) I'm good to leave this open for a time, both as a note to potential visitors, and also as a reminder to add this for at least the spectrum plot. No timeline at the moment though |
Dear Serpent Toolers,
I've included some 1D-plots produced with serpent tools to my journal article. My reviewer wrote:
The solution I'd like
A keyword argument to move the errorbars to the middle of the bins.
I can start digging and implementing this myself.
But, if there are any guidelines, tips, tricks, or historical developments, I would love to hear it before I waste my time on something stupid or unacceptable.
Thank you.
The text was updated successfully, but these errors were encountered: