X and y axis equal scaling

How do I make the x and y axis have equal scaling?
If can cheat it with size = (800,800), for example, but then if I add labels or a title, or change the axis limits, this requires a lot of adjusting. Is there any way I can make it automatic?

using Plots

x(u) = u
y(u) = sqrt(u)
y2(u) = -sqrt(u)
plot(x, [y, y2], 0, 5,
    framestyle = :origin,
    legend = :none,
    linecolor = :blue,
    xlim = [-6, 6],
    ylim = [-6, 6],
    ticks = -6:1:6,
    xlabel = "y"
)

Use the keyword argument aspect_ratio = 1.

3 Likes