shape linetype; supported in gadfly; gadfly cleanup
This commit is contained in:
parent
16799d8b75
commit
7531c48e38
@ -11,7 +11,7 @@ const _3dTypes = [:path3d, :scatter3d, :surface, :wireframe]
|
|||||||
const _allTypes = vcat([
|
const _allTypes = vcat([
|
||||||
:none, :line, :path, :steppre, :steppost, :sticks, :scatter,
|
:none, :line, :path, :steppre, :steppost, :sticks, :scatter,
|
||||||
:heatmap, :hexbin, :hist, :hist2d, :hist3d, :density, :bar, :hline, :vline, :ohlc,
|
:heatmap, :hexbin, :hist, :hist2d, :hist3d, :density, :bar, :hline, :vline, :ohlc,
|
||||||
:contour, :pie
|
:contour, :pie, :shape
|
||||||
], _3dTypes)
|
], _3dTypes)
|
||||||
@compat const _typeAliases = Dict(
|
@compat const _typeAliases = Dict(
|
||||||
:n => :none,
|
:n => :none,
|
||||||
@ -35,6 +35,9 @@ const _allTypes = vcat([
|
|||||||
:line3d => :path3d,
|
:line3d => :path3d,
|
||||||
:surf => :surface,
|
:surf => :surface,
|
||||||
:wire => :wireframe,
|
:wire => :wireframe,
|
||||||
|
:shapes => :shape,
|
||||||
|
:poly => :shape,
|
||||||
|
:polygon => :shape,
|
||||||
)
|
)
|
||||||
|
|
||||||
ishistlike(lt::Symbol) = lt in (:hist, :density)
|
ishistlike(lt::Symbol) = lt in (:hist, :density)
|
||||||
@ -801,5 +804,3 @@ function getSeriesArgs(pkg::AbstractBackend, plotargs::Dict, kw, commandIndex::I
|
|||||||
|
|
||||||
d
|
d
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -81,7 +81,7 @@ supportedArgs(::GadflyBackend) = [
|
|||||||
supportedAxes(::GadflyBackend) = [:auto, :left]
|
supportedAxes(::GadflyBackend) = [:auto, :left]
|
||||||
supportedTypes(::GadflyBackend) = [:none, :line, :path, :steppre, :steppost, :sticks,
|
supportedTypes(::GadflyBackend) = [:none, :line, :path, :steppre, :steppost, :sticks,
|
||||||
:scatter, :hist2d, :hexbin, :hist, :bar,
|
:scatter, :hist2d, :hexbin, :hist, :bar,
|
||||||
:hline, :vline, :contour]
|
:hline, :vline, :contour, :shape]
|
||||||
supportedStyles(::GadflyBackend) = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot]
|
supportedStyles(::GadflyBackend) = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot]
|
||||||
supportedMarkers(::GadflyBackend) = vcat(_allMarkers, Shape)
|
supportedMarkers(::GadflyBackend) = vcat(_allMarkers, Shape)
|
||||||
supportedScales(::GadflyBackend) = [:identity, :ln, :log2, :log10, :asinh, :sqrt]
|
supportedScales(::GadflyBackend) = [:identity, :ln, :log2, :log10, :asinh, :sqrt]
|
||||||
@ -770,4 +770,3 @@ supportedStyles(::PGFPlotsBackend) = [:auto, :solid] #, :dash, :dot, :dashdot, :
|
|||||||
supportedMarkers(::PGFPlotsBackend) = [:none, :auto, :ellipse] #, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5] #vcat(_allMarkers, Shape)
|
supportedMarkers(::PGFPlotsBackend) = [:none, :auto, :ellipse] #, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star5] #vcat(_allMarkers, Shape)
|
||||||
supportedScales(::PGFPlotsBackend) = [:identity] #, :log, :log2, :log10, :asinh, :sqrt]
|
supportedScales(::PGFPlotsBackend) = [:identity] #, :log, :log2, :log10, :asinh, :sqrt]
|
||||||
subplotSupported(::PGFPlotsBackend) = false
|
subplotSupported(::PGFPlotsBackend) = false
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,9 @@ immutable Shape
|
|||||||
vertices::AVec
|
vertices::AVec
|
||||||
end
|
end
|
||||||
|
|
||||||
|
get_xs(shape::Shape) = Float64[v[1] for v in shape.vertices]
|
||||||
|
get_ys(shape::Shape) = Float64[v[2] for v in shape.vertices]
|
||||||
|
|
||||||
"get an array of tuples of points on a circle with radius `r`"
|
"get an array of tuples of points on a circle with radius `r`"
|
||||||
function partialcircle(start_θ, end_θ, n = 20, r=1)
|
function partialcircle(start_θ, end_θ, n = 20, r=1)
|
||||||
@compat(Tuple{Float64,Float64})[(r*cos(u),r*sin(u)) for u in linspace(start_θ, end_θ, n)]
|
@compat(Tuple{Float64,Float64})[(r*cos(u),r*sin(u)) for u in linspace(start_θ, end_θ, n)]
|
||||||
|
|||||||
31
src/plot.jl
31
src/plot.jl
@ -444,6 +444,37 @@ function createKWargsList{T<:Real}(plt::AbstractPlot, x::AMat{T}, y::AMat{T}, zm
|
|||||||
createKWargsList(plt, Any[x], Any[y]; d...) #kw..., z = surf, linetype = :contour)
|
createKWargsList(plt, Any[x], Any[y]; d...) #kw..., z = surf, linetype = :contour)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# plotting arbitrary shapes/polygons
|
||||||
|
function createKWargsList(plt::AbstractPlot, shape::Shape; kw...)
|
||||||
|
x, y = unzip(shape.vertices)
|
||||||
|
createKWargsList(plt, x, y; linetype = :shape, kw...)
|
||||||
|
end
|
||||||
|
|
||||||
|
function shape_coords(shapes::AVec{Shape})
|
||||||
|
xs = map(get_xs, shapes)
|
||||||
|
ys = map(get_ys, shapes)
|
||||||
|
x, y = unzip(shapes[1].vertices)
|
||||||
|
for shape in shapes[2:end]
|
||||||
|
tmpx, tmpy = unzip(shape.vertices)
|
||||||
|
x = vcat(x, NaN, tmpx)
|
||||||
|
y = vcat(y, NaN, tmpy)
|
||||||
|
end
|
||||||
|
x, y
|
||||||
|
end
|
||||||
|
|
||||||
|
function createKWargsList(plt::AbstractPlot, shapes::AVec{Shape}; kw...)
|
||||||
|
x, y = shape_coords(shapes)
|
||||||
|
createKWargsList(plt, x, y; linetype = :shape, kw...)
|
||||||
|
end
|
||||||
|
function createKWargsList(plt::AbstractPlot, shapes::AMat{Shape}; kw...)
|
||||||
|
x, y = [], []
|
||||||
|
for j in 1:size(shapes, 2)
|
||||||
|
tmpx, tmpy = shape_coords(vec(shapes[:,j]))
|
||||||
|
push!(x, tmpx)
|
||||||
|
push!(y, tmpy)
|
||||||
|
end
|
||||||
|
createKWargsList(plt, x, y; linetype = :shape, kw...)
|
||||||
|
end
|
||||||
|
|
||||||
function createKWargsList(plt::AbstractPlot, surf::Surface; kw...)
|
function createKWargsList(plt::AbstractPlot, surf::Surface; kw...)
|
||||||
createKWargsList(plt, 1:size(surf.surf,1), 1:size(surf.surf,2), convert(Matrix{Float64}, surf.surf); kw...)
|
createKWargsList(plt, 1:size(surf.surf,1), 1:size(surf.surf,2), convert(Matrix{Float64}, surf.surf); kw...)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user