function house2()
trace1 = scatter()
_p = string("M 2 1 L 2 5.5 L 5.5 9.6 L 9 5.5 L 9 1 L 2 1 ",
"M 2 5.5 L 9 5.5 ",
"M 5 1 L 5 4 L 6 4 L 6 1 Z")
plot([trace1],
Layout(;shapes=[path(_p)], xaxis_range=(1, 10), yaxis_range=(0, 10)))
end
house2()
function vlines1()
# one scalar argument produces one line. Need to wrap in an array because
# layout.shapes should be an array
trace1 = scatter(;x=1:10, y=(1:10).^2)
shapes = [vline(2)]
plot([trace1], Layout(;shapes=shapes))
end
vlines1()
function vlines2()
# one argument draws a vertical line up the entire plot
trace1 = scatter(;x=1:10, y=(1:10).^2)
shapes = vline([2, 6])
plot([trace1], Layout(;shapes=shapes))
end
vlines2()
function vlines3()
# yref paper makes the 2nd and 3rd arguments on a (0, 1) scale vertically
# so 0.5 is 1/2 through the plot regardless of the values on y-axis
trace1 = scatter(;x=1:10, y=(1:10).^2)
shapes = vline([2, 6], 0, 0.5; yref="paper")
plot([trace1], Layout(;shapes=shapes))
end
vlines3()
function vlines4()
# Whichever argument is a scalar is repeated
trace1 = scatter(;x=1:10, y=(1:10).^2)
shapes = vline([2, 6], 0, [0.5, 0.75]; yref="paper")
plot([trace1], Layout(;shapes=shapes))
end
vlines4()
function vlines5()
# we can also set arbitrary line attributes line color and dash
trace1 = scatter(;x=1:10, y=(1:10).^2)
shapes = vline([2, 6], 0, [0.5, 0.75]; yref="paper",
line_color="green", line_dash="dashdot")
plot([trace1], Layout(;shapes=shapes))
end
vlines5()
function hlines1()
# one scalar argument produces one line. Need to wrap in an array because
# layout.shapes should be an array
trace1 = scatter(;x=1:10, y=(1:10).^2)
shapes = [hline(2)]
plot([trace1], Layout(;shapes=shapes))
end
hlines1()
function hlines2()
# one argument draws a horizontal line across the entire plot
trace1 = scatter(;x=1:10, y=(1:10).^2)
shapes = hline([25, 81])
plot([trace1], Layout(;shapes=shapes))
end
hlines2()
function hlines3()
# xref paper makes the 2nd and 3rd arguments on a (0, 1) scale horizontally
# so 0.5 is 1/2 through the plot regardless of the values on x-axis
trace1 = scatter(;x=1:10, y=(1:10).^2)
shapes = hline([25, 81], 0, 0.5; xref="paper")
plot([trace1], Layout(;shapes=shapes))
end
hlines3()
function hlines4()
# Whichever argument is a scalar is repeated
trace1 = scatter(;x=1:10, y=(1:10).^2)
shapes = hline([25, 81], 0, [0.5, 0.75]; xref="paper")
plot([trace1], Layout(;shapes=shapes))
end
hlines4()
function hlines5()
# we can also set arbitrary line attributes line color and dash
trace1 = scatter(;x=1:10, y=(1:10).^2)
shapes = hline([25, 81], 0, [0.5, 0.75]; xref="paper",
line_color="green", line_dash="dashdot")
plot([trace1], Layout(;shapes=shapes))
end
hlines5()
Settings
This document was generated with Documenter.jl on Thursday 20 August 2020. Using Julia version 1.5.0.