fixes and examples
@ -1,10 +1,10 @@
|
|||||||
# Examples for backend: gadfly
|
# Examples for backend: gadfly
|
||||||
|
|
||||||
- Supported arguments: `annotation`, `background_color`, `color`, `color_palette`, `fillrange`, `fillcolor`, `group`, `label`, `layout`, `legend`, `linestyle`, `linetype`, `linewidth`, `markershape`, `markercolor`, `markersize`, `n`, `nbins`, `nc`, `nr`, `reg`, `show`, `size`, `title`, `windowtitle`, `x`, `xlabel`, `xlims`, `xticks`, `y`, `ylabel`, `ylims`, `yticks`, `xscale`, `yscale`, `xflip`, `yflip`, `z`
|
- Supported arguments: `annotation`, `background_color`, `color`, `color_palette`, `fillrange`, `fillcolor`, `foreground_color`, `group`, `label`, `layout`, `legend`, `linestyle`, `linetype`, `linewidth`, `markershape`, `markercolor`, `markersize`, `n`, `nbins`, `nc`, `nr`, `smooth`, `show`, `size`, `title`, `windowtitle`, `x`, `xlabel`, `xlims`, `xticks`, `y`, `ylabel`, `ylims`, `yticks`, `xscale`, `yscale`, `xflip`, `yflip`, `z`, `tickfont`, `guidefont`, `legendfont`
|
||||||
- Supported values for axis: `:auto`, `:left`
|
- Supported values for axis: `:auto`, `:left`
|
||||||
- Supported values for linetype: `:none`, `:line`, `:path`, `:steppost`, `:sticks`, `:scatter`, `:heatmap`, `:hexbin`, `:hist`, `:bar`, `:hline`, `:vline`, `:ohlc`
|
- Supported values for linetype: `:none`, `:line`, `:path`, `:steppre`, `:steppost`, `:sticks`, `:scatter`, `:heatmap`, `:hexbin`, `:hist`, `:bar`, `:hline`, `:vline`, `:ohlc`
|
||||||
- Supported values for linestyle: `:auto`, `:solid`, `:dash`, `:dot`, `:dashdot`, `:dashdotdot`
|
- Supported values for linestyle: `:auto`, `:solid`, `:dash`, `:dot`, `:dashdot`, `:dashdotdot`
|
||||||
- Supported values for marker: `:none`, `:auto`, `:rect`, `:ellipse`, `:diamond`, `:utriangle`, `:dtriangle`, `:cross`, `:xcross`, `:star1`, `:star2`, `:hexagon`, `:octagon`
|
- Supported values for marker: `:none`, `:auto`, `:cross`, `:diamond`, `:dtriangle`, `:ellipse`, `:heptagon`, `:hexagon`, `:octagon`, `:pentagon`, `:rect`, `:star4`, `:star5`, `:star6`, `:star7`, `:star8`, `:utriangle`, `:xcross`, `:Plots.Shape`
|
||||||
- Is `subplot`/`subplot!` supported? Yes
|
- Is `subplot`/`subplot!` supported? Yes
|
||||||
|
|
||||||
### Initialize
|
### Initialize
|
||||||
@ -150,8 +150,11 @@ plot(cumsum(randn(20,length(styles)),1); style=:auto,label=map(string,styles),w=
|
|||||||
|
|
||||||
|
|
||||||
```julia
|
```julia
|
||||||
markers = setdiff(supportedMarkers(),[:none,:auto])'
|
markers = setdiff(supportedMarkers(),[:none,:auto,Shape])'
|
||||||
scatter(0.5:9.5,[fill(i - 0.5,10) for i = length(markers):-1:1]; marker=:auto,label=map(string,markers),ms=12)
|
n = length(markers)
|
||||||
|
x = (linspace(0,10,n + 2))[2:end - 1]
|
||||||
|
y = repmat(reverse(x)',n,1)
|
||||||
|
scatter(x,y,m=(12,:auto),lab=map(string,markers),bg=:linen)
|
||||||
```
|
```
|
||||||
|
|
||||||

|

|
||||||
@ -209,30 +212,14 @@ subplot!(fakedata(100,10))
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
### Open/High/Low/Close
|
|
||||||
|
|
||||||
Create an OHLC chart. Pass in a vector of OHLC objects as your `y` argument. Adjust the tick width with arg `markersize`.
|
|
||||||
|
|
||||||
```julia
|
|
||||||
n = 20
|
|
||||||
hgt = rand(n) + 1
|
|
||||||
bot = randn(n)
|
|
||||||
openpct = rand(n)
|
|
||||||
closepct = rand(n)
|
|
||||||
y = [OHLC(openpct[i] * hgt[i] + bot[i],bot[i] + hgt[i],bot[i],closepct[i] * hgt[i] + bot[i]) for i = 1:n]
|
|
||||||
ohlc(y; markersize=8)
|
|
||||||
```
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### Annotations
|
### Annotations
|
||||||
|
|
||||||
Currently only text annotations are supported. Pass in a tuple or vector-of-tuples: (x,y,text). `annotate!(ann)` is shorthand for `plot!(; annotation=ann)`
|
Currently only text annotations are supported. Pass in a tuple or vector-of-tuples: (x,y,text). `annotate!(ann)` is shorthand for `plot!(; annotation=ann)`
|
||||||
|
|
||||||
```julia
|
```julia
|
||||||
y = rand(10)
|
y = rand(10)
|
||||||
plot(y,ann=(3,y[3],"this is #3"))
|
plot(y,ann=(3,y[3],text("this is #3",:left)))
|
||||||
annotate!([(5,y[5],"this is #5"),(9,y[10],"this is #10")])
|
annotate!([(5,y[5],text("this is #5",16,:red,:center)),(10,y[10],text("this is #10",:right,20,"courier"))])
|
||||||
```
|
```
|
||||||
|
|
||||||

|

|
||||||
|
|||||||
BIN
examples/meetup/cart-before-the-horse.jpg
Executable file
|
After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 66 KiB |
|
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 68 KiB |
|
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 51 KiB |
|
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 137 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 66 KiB |
|
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 97 KiB |
|
Before Width: | Height: | Size: 98 KiB After Width: | Height: | Size: 118 KiB |
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 106 KiB |
|
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 84 KiB |
|
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 56 KiB |
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 41 KiB |
|
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 61 KiB |
|
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 59 KiB |
@ -534,15 +534,11 @@ function getGadflyMappings(plt::Plot, i::Integer)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Base.getindex(plt::Plot{GadflyPackage}, i::Integer)
|
function Base.getindex(plt::Plot{GadflyPackage}, i::Integer)
|
||||||
# data = getGadflyContext(plt).layers[end-i+1].mapping
|
|
||||||
# data[:x], data[:y]
|
|
||||||
mapping = getGadflyMappings(plt, i)[1]
|
mapping = getGadflyMappings(plt, i)[1]
|
||||||
mapping[:x], mapping[:y]
|
mapping[:x], mapping[:y]
|
||||||
end
|
end
|
||||||
|
|
||||||
function Base.setindex!(plt::Plot{GadflyPackage}, xy::Tuple, i::Integer)
|
function Base.setindex!(plt::Plot{GadflyPackage}, xy::Tuple, i::Integer)
|
||||||
# data = getGadflyContext(plt).layers[end-i+1].mapping
|
|
||||||
# data[:x], data[:y] = xy
|
|
||||||
for mapping in getGadflyMappings(plt, i)
|
for mapping in getGadflyMappings(plt, i)
|
||||||
mapping[:x], mapping[:y] = xy
|
mapping[:x], mapping[:y] = xy
|
||||||
end
|
end
|
||||||
|
|||||||
@ -61,19 +61,30 @@ end
|
|||||||
|
|
||||||
# accessors for x/y data
|
# accessors for x/y data
|
||||||
|
|
||||||
function Base.getindex(plt::Plot{ImmersePackage}, i::Int)
|
# function Base.getindex(plt::Plot{ImmersePackage}, i::Int)
|
||||||
data = plt.o[2].layers[end-i+1].mapping
|
# data = plt.o[2].layers[end-i+1].mapping
|
||||||
data[:x], data[:y]
|
# data[:x], data[:y]
|
||||||
|
# end
|
||||||
|
|
||||||
|
# function Base.setindex!(plt::Plot{ImmersePackage}, xy::Tuple, i::Integer)
|
||||||
|
# data = plt.o[2].layers[end-i+1].mapping
|
||||||
|
# data[:x], data[:y] = xy
|
||||||
|
# plt
|
||||||
|
# end
|
||||||
|
|
||||||
|
function Base.getindex(plt::Plot{ImmersePackage}, i::Integer)
|
||||||
|
mapping = getGadflyMappings(plt, i)[1]
|
||||||
|
mapping[:x], mapping[:y]
|
||||||
end
|
end
|
||||||
|
|
||||||
function Base.setindex!(plt::Plot{ImmersePackage}, xy::Tuple, i::Integer)
|
function Base.setindex!(plt::Plot{ImmersePackage}, xy::Tuple, i::Integer)
|
||||||
data = plt.o[2].layers[end-i+1].mapping
|
for mapping in getGadflyMappings(plt, i)
|
||||||
data[:x], data[:y] = xy
|
mapping[:x], mapping[:y] = xy
|
||||||
|
end
|
||||||
plt
|
plt
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ----------------------------------------------------------------
|
# ----------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||