From 9fd09924ebf63209aa1ec43134ea9101e6b8b596 Mon Sep 17 00:00:00 2001 From: Thomas Breloff Date: Mon, 13 Jun 2016 16:57:26 -0400 Subject: [PATCH] _shape_keys for consistent shape ordering --- src/args.jl | 2 +- src/components.jl | 21 +++++++++++++++++++++ src/examples.jl | 8 +++++--- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/args.jl b/src/args.jl index e40b0216..628f435c 100644 --- a/src/args.jl +++ b/src/args.jl @@ -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, diff --git a/src/components.jl b/src/components.jl index d7d05902..ad31ef0d 100644 --- a/src/components.jl +++ b/src/components.jl @@ -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), diff --git a/src/examples.jl b/src/examples.jl index 784f87f3..23898bd2 100644 --- a/src/examples.jl +++ b/src/examples.jl @@ -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)