Skip to content

Commit

Permalink
Merge pull request #1325 from Mattriks/Segment_docs
Browse files Browse the repository at this point in the history
Gallery example for Geom.segment
  • Loading branch information
tlnagy authored Oct 7, 2019
2 parents aa4855c + 36cadac commit f8b63b0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
Cairo = "159f3aea-2a34-519c-b102-8c37f9878175"
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
ColorSchemes = "35d6a980-a343-548e-a6ea-1d62b119f2f4"
Compose = "a81c6b42-2e10-5240-aca2-a61377ecd94b"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
Expand Down
15 changes: 15 additions & 0 deletions docs/src/gallery/geometries.md
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,21 @@ p2 = plot(vcat(Db...), x = :x, y=:ymax, ymin = :ymin, ymax = :ymax,
hstack(p1,p2)
```

## [`Geom.segment`](@ref)
```@example
using Gadfly, DataFrames, ColorSchemes
set_default_plot_size(14cm, 14cm)
n = 1000
x, y = cumsum(randn(n)), cumsum(randn(n))
D = DataFrame(x1=x[1:end-1], y1=y[1:end-1], x2=x[2:end], y2=y[2:end], colv=1:n-1)
palettef(c::Float64) = get(ColorSchemes.viridis, c)
plot(D, x=:x1, y=:y1, xend=:x2, yend=:y2,
color = :colv, Geom.segment, Coord.cartesian(aspect_ratio=1.0),
Scale.color_continuous(colormap=palettef, minvalue=0, maxvalue=1000)
)
```


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

Expand Down

0 comments on commit f8b63b0

Please sign in to comment.