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

improve interface for error bar plots #5

Open
Vindaar opened this issue May 17, 2018 · 2 comments
Open

improve interface for error bar plots #5

Vindaar opened this issue May 17, 2018 · 2 comments

Comments

@Vindaar
Copy link
Member

Vindaar commented May 17, 2018

As discussed in PR #4, the current user interface to use error bar plots is maybe not optimal. It currently depends on a set of newErrorBar procs, which need to be called manually, while there are certainly many typical use cases in which that can be simplified.
Taken basically from the PR mentioned above:

Ideally there would be a way to allow for handing the Trace simply:

  • a constant error value
  • a high and a low value
  • a seq matching the data seq
  • 2 seqs matching the data seqs

without any need to create a full ErrorBar object on the user side, I'd say. In that case the error bars would inherit the colors from the marker for example.

One could additionally introduce a setXErrorBar(tr: Trace, ...) proc, which can then e.g. be called

d.setXErrorBar(1.5)
d.setXErrorBar((0.5, 1.5))
d.setXErrorBar(@[seq of # elements of data])
d.setXErrorBar((seq1, seq2))

which does just that maybe? These could also get arguments for percent, thickness, width etc.

It's probably a good idea to look at other plotting libraries (matplotlib, gnuplot, R, etc.) to see how error bars are handled there as a reference.

@brentp
Copy link
Collaborator

brentp commented May 17, 2018

I think minimizing the "surface area" of the API should also be a concern given the size of the plotly api. I'm always annoyed when there are so many definitions that I can't find what I need. E.g. above you have added 4 new methods. That may be necessary to match the underlying plotly utility.

@Vindaar
Copy link
Member Author

Vindaar commented May 17, 2018

Yes, I agree. I think it's always a balance between an intuitive interface (in which case several overloaded procedures may not hurt) and too many similar, yet different procedures.

In the example above (not saying that's exactly how it should be of course), I think it's nice to provide an interface that allows for a "natural" way to hand errors, which will either be constant or array like, symmetric or asymmetric. So that for 95% of the cases one can define error bars in a single line.

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

2 participants