Skip to content

Commit

Permalink
Update gallery plots
Browse files Browse the repository at this point in the history
Derived from the suggestions and examples of @Mattriks.
  • Loading branch information
CiaranOMara committed Nov 22, 2019
1 parent 6ed43cf commit 6b9749a
Showing 1 changed file with 30 additions and 12 deletions.
42 changes: 30 additions & 12 deletions docs/src/gallery/geometries.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,35 @@ p2 = plot(D, x=:x, y=:y, Geom.point, Scale.x_asinh, Scale.y_log,
hstack(p1, p2)
```

## [`Geom.band`](@ref), [`Geom.hband`](@ref), [`Geom.vband`](@ref)


```@example
using Colors, Gadfly, RDatasets
Dp = dataset("ggplot2","presidential")[3:end,:]
De = dataset("ggplot2","economics")
De[:Unemploy] /= 10^3
plot(De, x=:Date, y=:Unemploy, Geom.line,
layer(Dp, xmin=:Start, xmax=:End, Geom.vband, color=:Party),
Scale.color_discrete_manual("deepskyblue", "lightcoral"),
Coord.cartesian(xmin=Date("1965-01-01"), ymax=12),
Guide.xlabel("Time"), Guide.ylabel("Unemployment (x10³)"), Guide.colorkey(title=""),
Theme(default_color="black", key_position=:top))
```

```@example
using Gadfly, RDatasets
p1 = plot(dataset("datasets", "iris"), x="SepalLength", y="SepalWidth", Geom.point,
layer(xmin=[5.0, 7.0], xmax=[6.5, 8.0] , Geom.vband, Theme(default_color="green")));
p2 = plot(dataset("datasets", "iris"), x="SepalLength", y="SepalWidth", Geom.point,
layer(ymin=[2.5, 3.6], ymax=[3.0, 4.0], Geom.hband, Theme(default_color="red")));
hstack(p1, p2)
```

## [`Geom.bar`](@ref)

Expand Down Expand Up @@ -128,7 +157,7 @@ using Gadfly, RDatasets, Distributions
set_default_plot_size(14cm, 8cm)
dist = MixtureModel(Normal, [(0.5, 0.2), (1, 0.1)])
xs = rand(dist, 10^5)
plot(layer(x=xs, Geom.density, Theme(default_color="orange")),
plot(layer(x=xs, Geom.density, Theme(default_color="orange")),
layer(x=xs, Geom.density(bandwidth=0.0003), Theme(default_color="green")),
layer(x=xs, Geom.density(bandwidth=0.25), Theme(default_color="purple")),
Guide.manual_color_key("bandwidth", ["auto", "bw=0.0003", "bw=0.25"],
Expand Down Expand Up @@ -235,17 +264,6 @@ pb = plot(x=s.*(x.^2), y=x, color=string.(s),
hstack(pa, pb)
```

## [`Geom.hband`](@ref), [`Geom.vband`](@ref)

```@example
using Gadfly, RDatasets
set_default_plot_size(21cm, 8cm)
p1 = plot(dataset("datasets", "iris"), x="SepalLength", y="SepalWidth", Geom.point,
layer(xmin=[5.0, 7.0], xmax=[6.5, 8.0] , Geom.vband(color="green")))
p2 = plot(dataset("datasets", "iris"), x="SepalLength", y="SepalWidth", Geom.point,
layer(ymin=[2.5, 3.5], ymax=[3.0, 4.0], Geom.hband(color="red")))
hstack(p1,p2)
```

## [`Geom.hexbin`](@ref)

Expand Down

0 comments on commit 6b9749a

Please sign in to comment.