R's abline draws a straight line parameterised by
y = ax+b on the x-y 2D coordinate plan.
What's Julia's equivalent of that in Plots.jl?
Plots.abline! which draws a straight line in the form of
ax+b respecting axis limits of the plot. So it will not actually go to infinity but does not require you to know what the axis limits are beforehand.
plot(x->((x^2+3x+2)/(x-2)), 6, 30, xlim=(6,30), size=(300,300)) # draw oblique asymptote to the above function (y=x+5) Plots.abline!(1, 5, line=:dash)
You can also plot a straight line using only two points that are on the line. This should also respect the axis limits.
plot!([x1, x2], [y1, y2], seriestype = :straightline, kwargs...)
- How to insert variables that might be `nothing` into strings in Julia?
- Access second to last element of array
- Julia: how to avoid boilerplate code when structs sharing attributes
- Comparitive operator not working in Julia script file when used in control flow with conditional operator
- Make a new array by repeating some rows of an old array in Julia
- Exporting all symbols in Julia
- In Julia assign the diagonal values of a matrix, get “error in method definition”
- How to zero out small values in an array?
- How to get a plot in Julia using Plots.jl to show?
- What is a “symbol” in Julia?