-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor docs to use docstrings and have a gallery
- Loading branch information
Showing
18 changed files
with
266 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# Geometries | ||
|
||
## Geom.point | ||
|
||
```@setup 1 | ||
using Gadfly, RDatasets | ||
Gadfly.set_default_plot_size(14cm, 8cm) # hide | ||
plot(dataset("datasets", "iris"), x="SepalLength", y="SepalWidth", Geom.point) | ||
``` | ||
|
||
```@example | ||
# Binding categorial data to the color aesthetic | ||
using Gadfly, RDatasets | ||
Gadfly.set_default_plot_size(14cm, 8cm) # hide | ||
plot(dataset("datasets", "iris"), x="SepalLength", y="SepalWidth", | ||
color="Species", Geom.point) | ||
``` | ||
|
||
```@example | ||
# Binding continuous data to the color aesthetic | ||
using Gadfly, RDatasets | ||
Gadfly.set_default_plot_size(14cm, 8cm) # hide | ||
plot(dataset("datasets", "iris"), x="SepalLength", y="SepalWidth", | ||
color="PetalLength", Geom.point) | ||
``` | ||
|
||
```@example | ||
# Binding categorial data to x | ||
using Gadfly, RDatasets | ||
Gadfly.set_default_plot_size(14cm, 8cm) # hide | ||
plot(dataset("lattice", "singer"), x="VoicePart", y="Height", Geom.point) | ||
``` | ||
|
||
```@example | ||
# Binding categorical data to the shape aesthetic | ||
using Gadfly, RDatasets | ||
Gadfly.set_default_plot_size(14cm, 8cm) # hide | ||
plot(dataset("datasets", "iris"), x="SepalLength", y="SepalWidth", | ||
shape="Species", color="Species", Geom.point) | ||
``` | ||
|
||
```@example | ||
# Different colored layers | ||
using Gadfly, Distributions | ||
Gadfly.set_default_plot_size(14cm, 8cm) # hide | ||
rdata = rand(MvNormal([0,0.],[1 0;0 1.]),100) | ||
bdata = rand(MvNormal([1,0.],[1 0;0 1.]),100) | ||
plot(layer(x=rdata[1,:], y=rdata[2,:], color=[colorant"red"], Geom.point), | ||
layer(x=bdata[1,:], y=bdata[2,:], color=[colorant"blue"], Geom.point)) | ||
``` | ||
|
||
## Geom.bar | ||
|
||
```@example | ||
using Gadfly, RDatasets | ||
set_default_plot_size(12cm, 8cm) # hide | ||
plot(dataset("HistData", "ChestSizes"), x="Chest", y="Count", Geom.bar) | ||
``` | ||
|
||
```@example | ||
using Gadfly, RDatasets | ||
set_default_plot_size(12cm, 8cm) # hide | ||
plot(by(dataset("datasets","HairEyeColor"),[:Eye,:Sex], d->sum(d[:Freq])), | ||
color="Eye", y="x1", x="Sex", | ||
Geom.bar(position=:dodge), Guide.ylabel("Freq")) | ||
``` | ||
|
||
```@example | ||
using Gadfly, RDatasets, DataFrames | ||
set_default_plot_size(14cm, 8cm) # hide | ||
D = by(dataset("datasets","HairEyeColor"), [:Eye,:Sex], d->sum(d[:Freq])) | ||
rename!(D, :x1, :Frequency) | ||
palette = ["blue","brown","green","tan"] # Is there a hazel color? | ||
pa= plot(D, x=:Sex, y=:Frequency, color=:Eye, Geom.bar(position=:stack), | ||
Scale.color_discrete_manual(palette...)) | ||
pb= plot(D, x=:Sex, y=:Frequency, color=:Eye, Geom.bar(position=:stack), | ||
Scale.color_discrete_manual(palette[4:-1:1]..., order=[4,3,2,1])) | ||
hstack(pa, pb) | ||
``` | ||
|
||
## Geom.line | ||
|
||
```@example 1 | ||
using Gadfly, RDatasets | ||
Gadfly.set_default_plot_size(14cm, 8cm) # hide | ||
plot(dataset("lattice", "melanoma"), x="Year", y="Incidence", Geom.line) | ||
``` | ||
|
||
```@example 1 | ||
using Gadfly, RDatasets | ||
Gadfly.set_default_plot_size(14cm, 8cm) # hide | ||
plot(dataset("Zelig", "approval"), x="Month", y="Approve", color="Year", Geom.line) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Guides | ||
|
||
## Guide.title | ||
|
||
```@example | ||
using Gadfly, RDatasets | ||
Gadfly.set_default_plot_size(14cm, 8cm) # hide | ||
plot(dataset("ggplot2", "diamonds"), x="Price", Geom.histogram, | ||
Guide.title("Diamond Price Distribution")) | ||
``` | ||
|
||
## Guide.xlabel | ||
|
||
```@example | ||
using Gadfly | ||
Gadfly.set_default_plot_size(14cm, 8cm) # hide | ||
plot(cos, 0, 2π, Guide.xlabel("Angle")) | ||
``` | ||
|
||
```@example | ||
using Gadfly | ||
Gadfly.set_default_plot_size(14cm, 8cm) # hide | ||
plot(cos, 0, 2π, Guide.xlabel("Angle", orientation=:vertical)) | ||
``` | ||
|
||
```@example | ||
using Gadfly | ||
Gadfly.set_default_plot_size(14cm, 8cm) # hide | ||
plot(cos, 0, 2π, Guide.xlabel(nothing)) | ||
``` | ||
|
||
## Guide.ylabel | ||
|
||
```@example | ||
using Gadfly | ||
Gadfly.set_default_plot_size(14cm, 8cm) # hide | ||
plot(cos, 0, 2π, Guide.ylabel("cos(x)")) | ||
``` | ||
|
||
```@example | ||
using Gadfly | ||
Gadfly.set_default_plot_size(14cm, 8cm) # hide | ||
plot(cos, 0, 2π, Guide.ylabel("cos(x)", orientation=:horizontal)) | ||
``` | ||
|
||
```@example | ||
using Gadfly | ||
Gadfly.set_default_plot_size(14cm, 8cm) # hide | ||
plot(cos, 0, 2π, Guide.ylabel(nothing)) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.