Skip to content
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

Errorbars/Ribbons #143

Closed
tbreloff opened this issue Feb 17, 2016 · 12 comments
Closed

Errorbars/Ribbons #143

tbreloff opened this issue Feb 17, 2016 · 12 comments

Comments

@tbreloff
Copy link
Member

I am planning to add a new keyword argument: :errorbars. Some notes:

  • I'll probably alias err, error, errorbar.
  • I want these to be closely linked to "ribbons", where there is a filled area surrounding the line. I need to decide if ribbon should be its own keyword arg, or if I can somehow use errorbars for both.
  • I also need to decide if fillrange overlaps here. Should one pass the numerical values into fillrange, then errorbars could be the "style", for example: plot(y, fillrange=std(y), errorbars = :ribbon)

If anyone has good ideas and/or opinions on how they'd like the interface to look, please post here.

@tbreloff tbreloff mentioned this issue Feb 17, 2016
@diegozea
Copy link
Contributor

It would be great to have this for both axis (x and y) and supporting symmetric and asymmetric errors.

@tbreloff
Copy link
Member Author

would be great to have this for both axis

So I don't forget... it would be good to use the existing orientation argument for this purpose, which is currently only used for Plotly histograms.

@tbreloff
Copy link
Member Author

tbreloff commented Apr 8, 2016

@tbreloff tbreloff closed this as completed Apr 8, 2016
@diegozea
Copy link
Contributor

diegozea commented Apr 8, 2016

@tbreloff Is it possible to plot error for y and x in the same plot? i. e.

@tbreloff
Copy link
Member Author

tbreloff commented Apr 8, 2016

Yes it's easy, but need to decide on the right API. Could pass a tuple, or have a separate xerror, or something else? Type out the command you'd like to write to make this happen ;)

@diegozea
Copy link
Contributor

diegozea commented Apr 8, 2016

I was looking at the code... At the moment only symmetric errors are supported, aren't they? Maybe tuples can be used for asymmetric errors (lower and upper limits), and add xerror (since error is yerror).

@tbreloff
Copy link
Member Author

tbreloff commented Apr 8, 2016

Yeah that's a good idea. Alias error to yerror and add xerror. Then I could remove the need for orientation, and keep access to asymmetric errors. I'll do this next.

On Apr 8, 2016, at 11:01 AM, Diego Javier Zea notifications@github.com wrote:

I was looking at the code... At the moment only symmetric errors are supported, aren't they? Maybe tuples can be used for asymmetric errors (lower and upper limits), and add xerror (since error is yerror).


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub

@tbreloff
Copy link
Member Author

tbreloff commented Apr 8, 2016

Thanks for the API suggestions. I haven't implemented asymmetric errors yet but it should be an easy extension.

using Plots
pyplot(leg=false, size=(500,300))
n = 10
x = [(rand()+1) * randn(n) + 2i for i in 1:5]
y = [(rand()+1) * randn(n) + i for i in 1:5]

f(v) = 1.96std(v) / sqrt(n)
xerr = map(f, x)
yerr = map(f, y)
x = map(mean, x)
y = map(mean, y)

plot(x, y, xerr = xerr, yerr = yerr, marker = stroke(2, :orange))

tmp

@tbreloff
Copy link
Member Author

tbreloff commented Apr 8, 2016

All too easy ;)

plot(x, y, xerr = (0.5xerr,2xerr), yerr = (0.5yerr,2yerr), marker = stroke(2, :orange))

tmp

@diegozea
Copy link
Contributor

diegozea commented Apr 8, 2016

Awesome! You're welcome :D

@AsimHDar
Copy link
Contributor

In case someone is looking here for single scatter points and asymmetric error bars (inputs to xerr and yerr need to be arrays):

x = 10
y = 4
xe = (2,3) 
ye=  (2,1)

scatter((x,y), yerr=([ye[1]],ye[2]), xerr=([xe[1]],xe[2]) )

@jabruniessner
Copy link

Hi there!

After reading all this, I still do not understand. Is it possible to represent the xerror as a ribbon as well somehow?

I would really like to do this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants