-
Notifications
You must be signed in to change notification settings - Fork 1
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
Remove odd errorbar shifting #1
base: master
Are you sure you want to change the base?
Conversation
Hi Kyle, indeed, i wrote the code on an old version of MATLAB (v. 7.9 R2009b). It's unfortunate that I can't test the code on more recent versions of the software. Perhaps you could try and implement an if/then statement taking into account the MATLAB version? |
Did you see the lines I removed? Upon removing those lines, it works on newer versions of matlab. Can you test this version with my edits on your version of matlab and see if I broke it? If you did, let me know what didn't work and I can update it with a new version of matlab. I also cannot tell why those lines were necessary on older versions of matlab. I never encountered bugs in older matlab versions that necessitated such odd alterations. From what I can tell, you were only moving the errorbars for the 4, 5, 7, and 8 errorbars to the location of the first errorbar, but just offset by a particular amount. It might have made sense to me if it was all errorbars being shifted to get to the center of the errorbars, but these lines of code result in moving the errorbars from one location to the location of the 1st set of error bars. Is that what was intended? |
This portion of the code allows controlling the width of the error bars for versions of MATLAB earlier than 8.4. Removing those lines prevents this in those older MATLAB versions. There are a few pointers on how to control the width of error bars here: https://ch.mathworks.com/matlabcentral/answers/100333-how-do-i-change-the-width-of-the-horizontal-lines-at-top-and-bottom-of-error-bars-in-my-errorbar-plo. I don't want to implement these changes to the code "blindly", i.e. without being able to test them myself to check that they are indeed doing what they should. But perhaps you can try it on your side? |
Does that even work correctly in older matlab versions? The code in errorbar_groups doesn't match the link that you provided. I have tested this version on newer matlab versions, so I can verify that, and it doesn't have any issues. I'm just not seeing how your code doesn't have issues for older plots. People are reporting issues when you generate a plot with more than 3 in each group. Can you make a plot with your version with 5 in each group? I think the same problem will exist from these lines on newer and older Matlab versions because of these lines I removed. |
Yes, it does. If you care to understand how error bar graphic objects were referenced to in older versions of matlab, please refer to the matlab answers link I posted previously. Now, I in fact won't update the code until I can test it for myself. Hopefully, I'll get access to an up-to-date version of matlab before year's end. Thanks for your efforts. |
Deleted lines 244-259. It seems that for some reason, the centers of some errorbars were being shifted for only a few of the bars. Perhaps for some older matlab functionality?? Either way, it didn't seem to make sense since it only happened for bars 4, 5, 7, and 8, and they were always moved to the location of the 1st bar, not their respectively correct bars. Removed those lines of code to have proper functionality in Matlab 9.1. However, may have broken some sort of older functionality, but if that is the case then I would imagine another solution would be better to solve that problem. Happy to discuss why those lines were there and how they could be fixed.
If they really are necessary, I'd suggest it being just an "if" statement, with everything necessary inside of the if statement. Remove the else portions and changes there for any later matlab versions.