From 3886082ccde974fbf35d8f53ade5a04747bee1d7 Mon Sep 17 00:00:00 2001 From: Simon Christ Date: Fri, 1 Apr 2022 10:58:56 +0200 Subject: [PATCH] add series_permutation --- src/args.jl | 1 + src/backends.jl | 5 +++++ src/pipeline.jl | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/src/args.jl b/src/args.jl index 2afec51f..9376b30d 100644 --- a/src/args.jl +++ b/src/args.jl @@ -400,6 +400,7 @@ const _series_defaults = KW( :stride => (1, 1), # array stride for wireframe/surface, the first element is the row stride and the second is the column stride. :connections => nothing, # tuple of arrays to specifiy connectivity of a 3d mesh :z_order => :front, # one of :front, :back or integer in 1:length(sp.series_list) + :series_permutation => :none, # tuple of two symbols to be permuted :extra_kwargs => Dict(), ) diff --git a/src/backends.jl b/src/backends.jl index 083ed939..f2778bd2 100644 --- a/src/backends.jl +++ b/src/backends.jl @@ -241,6 +241,7 @@ const _base_supported_args = [ :projection, :show_empty_bins, :z_order, + :series_permutation, ] function merge_with_base_supported(v::AVec) @@ -948,6 +949,7 @@ const _unicodeplots_seriestype = [ :heatmap, :contour, # :contour3d, + :series_permutation, :spy, :surface, :wireframe, @@ -1022,6 +1024,7 @@ const _hdf5_attr = merge_with_base_supported([ :titlelocation, :titlefont, :window_title, + :series_permutation, :guide, :lims, :ticks, @@ -1124,6 +1127,7 @@ const _inspectdr_attr = merge_with_base_supported([ :window_title, :guide, :lims, + :series_permutation, :scale, #:ticks, :flip, :rotation, :titlefontfamily, :titlefontsize, @@ -1227,6 +1231,7 @@ const _pgfplotsx_attr = merge_with_base_supported([ :lims, :ticks, :scale, + :series_permutation, :flip, :titlefontfamily, :titlefontsize, diff --git a/src/pipeline.jl b/src/pipeline.jl index 786d8523..32e18127 100644 --- a/src/pipeline.jl +++ b/src/pipeline.jl @@ -338,6 +338,10 @@ RecipesPipeline.is_seriestype_supported(plt::Plot, st) = is_seriestype_supported function RecipesPipeline.add_series!(plt::Plot, plotattributes) sp = _prepare_subplot(plt, plotattributes) + if plotattributes[:series_permutation] != :none + letter1, letter2 = plotattributes[:series_permutation] + plotattributes[letter1], plotattributes[letter2] = plotattributes[letter2], plotattributes[letter1] + end _expand_subplot_extrema(sp, plotattributes, plotattributes[:seriestype]) _update_series_attributes!(plotattributes, plt, sp) _add_the_series(plt, sp, plotattributes)