_shape_keys for consistent shape ordering

This commit is contained in:
Thomas Breloff 2016-06-13 16:57:26 -04:00
parent 10d218089f
commit 9fd09924eb
3 changed files with 27 additions and 4 deletions

View File

@ -86,7 +86,7 @@ const _allStyles = [:auto, :solid, :dash, :dot, :dashdot, :dashdotdot]
:ddd => :dashdotdot,
)
const _allMarkers = vcat(:none, :auto, sort(collect(keys(_shapes))))
const _allMarkers = vcat(:none, :auto, _shape_keys) #sort(collect(keys(_shapes))))
@compat const _markerAliases = KW(
:n => :none,
:no => :none,

View File

@ -100,6 +100,27 @@ function makearrowhead(angle; h = 2.0, w = 0.4)
from_polar(angle + 0.5π, w) - tip, (0,0)])
end
const _shape_keys = Symbol[
:circle,
:rect,
:star5,
:diamond,
:hexagon,
:cross,
:xcross,
:utriangle,
:dtriangle,
:pentagon,
:heptagon,
:octagon,
:star4,
:star6,
:star7,
:star8,
:vline,
:hline,
]
const _shapes = KW(
:circle => makeshape(20),
:rect => makeshape(4, offset=-0.25),

View File

@ -115,15 +115,17 @@ PlotExample("Line types",
PlotExample("Line styles",
"",
[:(begin
styles = setdiff(supported_styles(), [:auto])'
plot(cumsum(randn(20,length(styles)),1), style=:auto, label=map(string,styles), w=5)
styles = filter(s -> s in supported_styles(), [:solid, :dash, :dot, :dashdot, :dashdotdot])'
n = length(styles)
y = cumsum(randn(20,n),1)
plot(y, line = (5, styles), label = map(string,styles))
end)]
),
PlotExample("Marker types",
"",
[:(begin
markers = setdiff(supported_markers(), [:none,:auto,Shape])'
markers = filter(m -> m in supported_markers(), Plots._shape_keys)'
n = length(markers)
x = linspace(0,10,n+2)[2:end-1]
y = repmat(reverse(x)', n, 1)