fixing markers
This commit is contained in:
parent
f674bba861
commit
168b77326b
@ -61,7 +61,7 @@ const examples = PlotExample[
|
||||
[:(styles = setdiff(supportedStyles(), [:auto])), :(plot(rand(20,length(styles)); linestyle=:auto, labels=map(string,styles)))]),
|
||||
PlotExample("Supported marker types",
|
||||
"All options: (:none, :auto, :ellipse, :rect, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star1, :star2, :hexagon)",
|
||||
[:(markers = setdiff(supportedMarkers(), [:none,:auto])), :(plot([fill(i-1,10) for i=1:length(markers)]; marker=:auto, labels=map(string,markers), markersize=10))]),
|
||||
[:(markers = setdiff(supportedMarkers(), [:none,:auto])), :(plot(0.5:9.5, [fill(i-0.5,10) for i=length(markers):-1:1]; marker=:auto, labels=map(string,markers), markersize=10))]),
|
||||
PlotExample("Bar",
|
||||
"x is the midpoint of the bar. (todo: allow passing of edges instead of midpoints)",
|
||||
[:(bar(randn(1000)))]),
|
||||
|
||||
@ -82,9 +82,36 @@ function diamond(xs::AbstractArray, ys::AbstractArray, rs::AbstractArray)
|
||||
end
|
||||
|
||||
|
||||
|
||||
function cross(xs::AbstractArray, ys::AbstractArray, rs::AbstractArray)
|
||||
n = max(length(xs), length(ys), length(rs))
|
||||
|
||||
polys = Vector{Vector{Tuple{Compose.Measure, Compose.Measure}}}(n)
|
||||
for i in 1:n
|
||||
x = Compose.x_measure(xs[mod1(i, length(xs))])
|
||||
y = Compose.y_measure(ys[mod1(i, length(ys))])
|
||||
r = rs[mod1(i, length(rs))]
|
||||
u = 0.4r
|
||||
|
||||
# make a "plus sign"
|
||||
polys[i] = Tuple{Compose.Measure, Compose.Measure}[
|
||||
(x-r, y-u), (x-r, y+u), # L edge
|
||||
(x-u, y+u), # BL inside
|
||||
(x-u, y+r), (x+u, y+r), # B edge
|
||||
(x+u, y+u), # BR inside
|
||||
(x+r, y+u), (x+r, y-u), # R edge
|
||||
(x+u, y-u), # TR inside
|
||||
(x+u, y-r), (x-u, y-r), # T edge
|
||||
(x-u, y-u) # TL inside
|
||||
]
|
||||
end
|
||||
|
||||
return Gadfly.polygon(polys)
|
||||
end
|
||||
|
||||
function xcross(xs::AbstractArray, ys::AbstractArray, rs::AbstractArray)
|
||||
n = max(length(xs), length(ys), length(rs))
|
||||
|
||||
polys = Vector{Vector{Tuple{Compose.Measure, Compose.Measure}}}(n)
|
||||
s = 1/sqrt(5)
|
||||
for i in 1:n
|
||||
@ -104,33 +131,6 @@ function cross(xs::AbstractArray, ys::AbstractArray, rs::AbstractArray)
|
||||
end
|
||||
|
||||
|
||||
function xcross(xs::AbstractArray, ys::AbstractArray, rs::AbstractArray)
|
||||
n = max(length(xs), length(ys), length(rs))
|
||||
|
||||
polys = Vector{Vector{Tuple{Compose.Measure, Compose.Measure}}}(n)
|
||||
for i in 1:n
|
||||
x = Compose.x_measure(xs[mod1(i, length(xs))])
|
||||
y = Compose.y_measure(ys[mod1(i, length(ys))])
|
||||
r = rs[mod1(i, length(rs))]
|
||||
u = 0.4r
|
||||
|
||||
# make a "plus"
|
||||
polys[i] = Tuple{Compose.Measure, Compose.Measure}[
|
||||
(x-r, y-u), (x-r, y+u), # L edge
|
||||
(x-u, y+u), # BL inside
|
||||
(x-u, y+r), (x+u, y+r), # B edge
|
||||
(x+u, y+u), # BR inside
|
||||
(x+r, y+u), (x+r, y-u), # R edge
|
||||
(x+u, y-u), # TR inside
|
||||
(x+u, y-r), (x-u, y-r), # T edge
|
||||
(x-u, y-u) # TL inside
|
||||
]
|
||||
end
|
||||
|
||||
return Gadfly.polygon(polys)
|
||||
end
|
||||
|
||||
|
||||
function utriangle(xs::AbstractArray, ys::AbstractArray, rs::AbstractArray, scalar = 1)
|
||||
n = max(length(xs), length(ys), length(rs))
|
||||
|
||||
|
||||
@ -11,8 +11,8 @@ pyplot!() = plotter!(:pyplot)
|
||||
supportedArgs(::PyPlotPackage) = setdiff(ARGS, [:reg, :heatmap_c, :fillto, :pos])
|
||||
supportedAxes(::PyPlotPackage) = ALL_AXES
|
||||
supportedTypes(::PyPlotPackage) = [:none, :line, :step, :stepinverted, :sticks, :scatter, :heatmap, :hexbin, :hist, :bar]
|
||||
supportedStyles(::PyPlotPackage) = setdiff(ALL_STYLES, [:dashdotdot])
|
||||
supportedMarkers(::PyPlotPackage) = setdiff(ALL_MARKERS, [:star2])
|
||||
supportedStyles(::PyPlotPackage) = [:auto, :solid, :dash, :dot, :dashdot]
|
||||
supportedMarkers(::PyPlotPackage) = [:none, :auto, :rect, :ellipse, :diamond, :utriangle, :dtriangle, :cross, :xcross, :star1, :hexagon]
|
||||
subplotSupported(::PyPlotPackage) = false
|
||||
|
||||
# convert colorant to 4-tuple RGBA
|
||||
@ -37,8 +37,8 @@ function getPyPlotMarker(marker::Symbol)
|
||||
marker == :diamond && return "D"
|
||||
marker == :utriangle && return "^"
|
||||
marker == :dtriangle && return "v"
|
||||
marker == :cross && return "x"
|
||||
marker == :xcross && return "+"
|
||||
marker == :cross && return "+"
|
||||
marker == :xcross && return "x"
|
||||
marker == :star1 && return "*"
|
||||
# marker == :star2 && return "*"
|
||||
marker == :hexagon && return "h"
|
||||
|
||||
@ -16,27 +16,28 @@ const winston_linestyle = Dict(:solid=>"solid",
|
||||
:dash=>"dash",
|
||||
:dot=>"dotted",
|
||||
:dashdot=>"dotdashed",
|
||||
:dashdotdot=>"dotdashed")
|
||||
# :dashdotdot=>"dotdashed"
|
||||
)
|
||||
|
||||
const winston_marker = Dict(:none=>".",
|
||||
:ellipse=>"circle",
|
||||
:rect => "square",
|
||||
:ellipse=>"circle",
|
||||
:diamond=>"diamond",
|
||||
:utriangle=>"triangle",
|
||||
:dtriangle=>"down-triangle",
|
||||
:cross => "cross",
|
||||
:xcross => "cross",
|
||||
# :xcross => "cross",
|
||||
:star1 => "asterisk",
|
||||
:star2 => "filled circle",
|
||||
:hexagon => "asterisk"
|
||||
# :star2 => "filled circle",
|
||||
# :hexagon => "asterisk"
|
||||
)
|
||||
|
||||
|
||||
supportedArgs(::WinstonPackage) = setdiff(ARGS, [:heatmap_c, :fillto, :pos, :markercolor, :background_color])
|
||||
supportedAxes(::WinstonPackage) = [:auto, :left]
|
||||
supportedTypes(::WinstonPackage) = [:none, :line, :sticks, :scatter, :hist, :bar]
|
||||
supportedStyles(::WinstonPackage) = unshift!(collect(keys(winston_linestyle)), :auto) # vcat(:auto, keys(winston_linestyle))
|
||||
supportedMarkers(::WinstonPackage) = unshift!(collect(keys(winston_marker)), :auto) # vcat(:auto, collect(keys(winston_marker)))
|
||||
supportedStyles(::WinstonPackage) = [:auto, :solid, :dash, :dot, :dashdot]
|
||||
supportedMarkers(::WinstonPackage) = [:none, :auto, :rect, :ellipse, :diamond, :utriangle, :dtriangle, :cross, :star1]
|
||||
subplotSupported(::WinstonPackage) = false
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user