-
Notifications
You must be signed in to change notification settings - Fork 251
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
353 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
```@meta | ||
Author = "Mattriks" | ||
``` | ||
|
||
# Guide.shapekey | ||
|
||
`Guide.shapekey` enables control of the fields of the auto-generated shapekey. Currently, you can change the shapekey title, the item labels, and position the shapekey inside the plot. The fields can be named e.g. `Guide.shapekey(title="Group", labels=["A","B"], pos=[0w,0h])`, or given in order e.g. `Guide.shapekey("Group", ["A","B"], [0w,0h])`. | ||
|
||
## Arguments | ||
* `title`: Legend title | ||
* `labels`: Legend item labels | ||
* `pos`: [x,y] position of the shapekey inside the plot. Setting `Guide.shapekey(pos=)` will override the `Theme(key_position=)` setting. Setting `Theme(key_position=:inside)` without setting `pos` will place the key in the lower right quadrant of the plot. | ||
|
||
## Examples | ||
|
||
```@setup 1 | ||
using RDatasets | ||
using Compose | ||
using Gadfly | ||
Gadfly.set_default_plot_size(16cm, 8cm) | ||
``` | ||
|
||
```@example 1 | ||
Dsleep = dataset("ggplot2", "msleep") | ||
Dsleep = dropmissing!(Dsleep[[:Vore, :Name,:BrainWt,:BodyWt, :SleepTotal]]) | ||
Dsleep[:SleepTime] = Dsleep[:SleepTotal] .> 8 | ||
plot(Dsleep, x=:BodyWt, y=:BrainWt, Geom.point, color=:Vore, shape=:SleepTime, | ||
Guide.colorkey(pos=[0.05w, -0.25h]), | ||
Guide.shapekey(title="Sleep (hrs)", labels=[">8","≤8"], pos=[0.18w,-0.315h]), | ||
Scale.x_log10, Scale.y_log10, | ||
Theme(point_size=2mm, key_swatch_color="slategrey", point_shapes=[Shape.utriangle, Shape.dtriangle]), | ||
) | ||
``` |
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.