title: ribbon author: Daniel Jones part: Geometry order: 1014 ...
Draw a ribbon bounded above and below by ymin
and ymin
, respectively.
x
: X-axis positionymin
: Y-axis lower bound.ymax
: Y-axis upper bound.color
(optional): Group categorically by color.
using Gadfly, DataFrames
Gadfly.set_default_plot_size(14cm, 8cm)
xs = 0:0.1:20
df_cos = DataFrame(
x=xs,
y=cos(xs),
ymin=cos(xs) .- 0.5,
ymax=cos(xs) .+ 0.5,
f="cos"
)
df_sin = DataFrame(
x=xs,
y=sin(xs),
ymin=sin(xs) .- 0.5,
ymax=sin(xs) .+ 0.5,
f="sin"
)
df = vcat(df_cos, df_sin)
p = plot(df, x=:x, y=:y, ymin=:ymin, ymax=:ymax, color=:f, Geom.line, Geom.ribbon)