-
-
Notifications
You must be signed in to change notification settings - Fork 358
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
abline! #125
Comments
Just to be clear, how would you create the line |
Also you can do |
Or better yet: |
Okay, so I just misunderstod the "could be done manually of course". So I guess something like function abline!(a, b, ...)
fetch x limits
plot!([xmin, xmax], x-> b+a*x)
end I can do a PR if this would be useful to have. |
Sure if you want to give it a go... this probably belongs in recipes.jl On Tue, Feb 2, 2016 at 10:53 AM, Patrick Kofod Mogensen <
|
Please merge the PR into the dev branch, not master. It makes my flow a On Tue, Feb 2, 2016 at 11:03 AM, Tom Breloff [email protected] wrote:
|
Could there be a method for plotting a function which takes the x limits from the current plot? It's a common use case, and a little more flexible than abline. |
@joshday how should we then choose how to sample the domain? |
I'm not sure I understand the question. Maybe my comment needs clarification. This already works: scatter(randn(100))
plot!(x -> .5 + .1x, 0, 100) Intuitively, I'd expect this to work: scatter(randn(100))
plot!(x -> .5 + .1x) The second two arguments for |
My bad! I get it. |
Josh this is a nice idea. To implement, you should implement this existing function: https://github.com/tbreloff/Plots.jl/blob/master/src/plot.jl#L415 Look at the other methods defined nearby if you get confused, but you just need to call the same method with an x-value.
|
Should I add something like xmin(plt::Plot) = minimum([minimum(plt.seriesargs[i][:x]) for i = 1:length(plt.seriesargs)])
xmax(plt::Plot) = maximum([maximum(plt.seriesargs[i][:x]) for i = 1:length(plt.seriesargs)]) in #126 if @joshday is going to look up the minimum and maximum value as well in his addition? So we avoid several different approaches of finding the min and max throughout the code. |
That sounds good. It might look nicer as:
(Sorry I'm such a nitpicker)
|
Much better, please nitpick - it's partly why I like to contribute where I cannot just commit myself - to learn from and be inspired by others more skilled than me. |
Cool. And to add to the convenience, maybe implement "Base.extrema(plt::Plot) = ..."
|
abline! Is now on the dev branch @diegozea . |
The relevant PR is #126. |
¡That's great! Thanks @pkofod :D |
remove DataFrames dependency
Hi!
It would be great to have an
abline
function, similar to R.Best,
The text was updated successfully, but these errors were encountered: