|
9 | 9 | #md # These examples are available as Jupyter notebooks. |
10 | 10 | #md # You can execute them online with [binder](https://mybinder.org/) or just view them with [nbviewer](https://nbviewer.jupyter.org/) by clicking on the badges above! |
11 | 11 |
|
12 | | -# These examples were slightly modified from some of [the GR examples in the Plots.jl documentation](http://docs.juliaplots.org/latest/examples/gr/) and can be used as both a tutorial or as a series of test for the UnitfulRecipes package |
| 12 | +# These examples were slightly modified from some of [the examples in the Plots.jl documentation](https://github.com/JuliaPlots/Plots.jl/blob/master/src/examples.jl) and can be used as both a tutorial or as a series of test for the UnitfulRecipes package |
13 | 13 | # (they are essentially the same except we have added some units to the data). |
14 | 14 |
|
15 | 15 | # First we need to tell Julia we are using Plots, Unitful, and UnitfulRecipes |
@@ -75,6 +75,35 @@ n = length(styles) |
75 | 75 | y = cumsum(randn(20, n), dims=1) * u"km" |
76 | 76 | plot(y, line=(5, styles), label=map(string, styles), legendtitle="linestyle") |
77 | 77 |
|
| 78 | + |
| 79 | +# ## Ribbons |
| 80 | +# |
| 81 | +# Ribbons can be added to lines via the `ribbon` keyword; |
| 82 | +# you can pass: |
| 83 | +#* a single Array (for symmetric ribbons) |
| 84 | +#* a Function |
| 85 | +#* or a number. |
| 86 | +#Currently unsupported: a tuple of arrays (upper and lower bounds) |
| 87 | +# |
| 88 | +x = y = (0:10)*u"m" |
| 89 | +plot( |
| 90 | + #plot((0:10)*u"m"; ribbon = (LinRange(0, 2, 11)*u"m", LinRange(0, 1, 11)*u"m")), |
| 91 | + plot(x,y; ribbon = (0:0.5:5)*u"m", label = "Vector"), |
| 92 | + plot(x,y; ribbon = sqrt, label = "Function"), |
| 93 | + plot(x,y; ribbon = 1u"m", label = "Constant"), link=:all |
| 94 | +) |
| 95 | + |
| 96 | +# ## Fillrange |
| 97 | +# the fillrange keyword defines a second line and fills between it and the y data. |
| 98 | +# Note: ribbons are fillranges |
| 99 | +x = y = (0:10)*u"m" |
| 100 | +plot( |
| 101 | + plot(x,y; fillrange = (0:0.5:5)*u"m", label = "Vector"), |
| 102 | + plot(x,y; fillrange = sin, label = "Function"), |
| 103 | + plot(x,y; fillrange = 0u"m", label = "Constant"), link = :all |
| 104 | +) |
| 105 | + |
| 106 | + |
78 | 107 | # ## Marker types |
79 | 108 |
|
80 | 109 | markers = intersect(Plots._shape_keys, Plots.supported_markers()) |
|
0 commit comments