From ad2eaf7aef672fb9081ce4c632432704162babb8 Mon Sep 17 00:00:00 2001 From: JackDevine Date: Tue, 15 Aug 2017 20:10:02 +1200 Subject: [PATCH 1/5] Add stride to wireframe/surface I only have this for PyPlot at the moment, I would be more than happy to add other backends if people find it useful. Also, if people have any ideas for aliases, then I would be happy to do that too. --- src/args.jl | 2 ++ src/backends/pyplot.jl | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/args.jl b/src/args.jl index ea4f8627..f60e782c 100644 --- a/src/args.jl +++ b/src/args.jl @@ -214,6 +214,8 @@ const _series_defaults = KW( :primary => true, # when true, this "counts" as a series for color selection, etc. the main use is to allow # one logical series to be broken up (path and markers, for example) :hover => nothing, # text to display when hovering over the data points + :rstride => 1, # array row stride for wireframe/surface + :cstride => 1, # array column stride for wireframe/surface ) diff --git a/src/backends/pyplot.jl b/src/backends/pyplot.jl index d67abfcd..ed3d5c95 100644 --- a/src/backends/pyplot.jl +++ b/src/backends/pyplot.jl @@ -31,6 +31,8 @@ const _pyplot_attr = merge_with_base_supported([ :inset_subplots, :dpi, :colorbar_title, + :rstride, + :cstride, ]) const _pyplot_seriestype = [ :path, :steppre, :steppost, :shape, @@ -702,8 +704,8 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series) handle = ax[st == :surface ? :plot_surface : :plot_wireframe](x, y, z; label = series[:label], zorder = series[:series_plotindex], - rstride = 1, - cstride = 1, + rstride = series[:rstride], + cstride = series[:cstride], linewidth = py_dpi_scale(plt, series[:linewidth]), edgecolor = py_linecolor(series), extrakw... From 177d380092f65bcff318f67b92d2c127841db2cc Mon Sep 17 00:00:00 2001 From: JackDevine Date: Wed, 16 Aug 2017 10:18:26 +1200 Subject: [PATCH 2/5] Added suggestions Changed the interface to stride, which is a tuple. Also added aliases and a docstring in arg_desc. --- src/arg_desc.jl | 1 + src/args.jl | 4 ++-- src/backends/pyplot.jl | 7 +++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/arg_desc.jl b/src/arg_desc.jl index f244ff99..b7af05d9 100644 --- a/src/arg_desc.jl +++ b/src/arg_desc.jl @@ -48,6 +48,7 @@ const _arg_desc = KW( :series_annotations => "AbstractVector of String or PlotText. These are annotations which are mapped to data points/positions.", :primary => "Bool. Does this count as a 'real series'? For example, you could have a path (primary), and a scatter (secondary) as 2 separate series, maybe with different data (see sticks recipe for an example). The secondary series will get the same color, etc as the primary.", :hover => "nothing or vector of strings. Text to display when hovering over each data point.", +:stride => "(1,1). Array row and column strides. Used in surface/wireframe." # plot args :plot_title => "String. Title for the whole plot (not the subplots) (Note: Not currently implemented)", diff --git a/src/args.jl b/src/args.jl index f60e782c..a72183b0 100644 --- a/src/args.jl +++ b/src/args.jl @@ -214,8 +214,7 @@ const _series_defaults = KW( :primary => true, # when true, this "counts" as a series for color selection, etc. the main use is to allow # one logical series to be broken up (path and markers, for example) :hover => nothing, # text to display when hovering over the data points - :rstride => 1, # array row stride for wireframe/surface - :cstride => 1, # array column stride for wireframe/surface + :stride, => (1,1), # array stride for wireframe/surface, the first element is the row stride and the second is the column stride. ) @@ -471,6 +470,7 @@ add_aliases(:series_annotations, :series_ann, :seriesann, :series_anns, :seriesa add_aliases(:html_output_format, :format, :fmt, :html_format) add_aliases(:orientation, :direction, :dir) add_aliases(:inset_subplots, :inset, :floating) +add_aliases(:stride, :wirefame_stride, :surface_stride, :surf_str, :str) # add all pluralized forms to the _keyAliases dict diff --git a/src/backends/pyplot.jl b/src/backends/pyplot.jl index ed3d5c95..ecac853a 100644 --- a/src/backends/pyplot.jl +++ b/src/backends/pyplot.jl @@ -31,8 +31,7 @@ const _pyplot_attr = merge_with_base_supported([ :inset_subplots, :dpi, :colorbar_title, - :rstride, - :cstride, + :stride, ]) const _pyplot_seriestype = [ :path, :steppre, :steppost, :shape, @@ -704,8 +703,8 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series) handle = ax[st == :surface ? :plot_surface : :plot_wireframe](x, y, z; label = series[:label], zorder = series[:series_plotindex], - rstride = series[:rstride], - cstride = series[:cstride], + rstride = series[:stride][1], + cstride = series[:stride][2], linewidth = py_dpi_scale(plt, series[:linewidth]), edgecolor = py_linecolor(series), extrakw... From d1dcd536f58d54a30009102fc63f201844c4df9f Mon Sep 17 00:00:00 2001 From: JackDevine Date: Wed, 16 Aug 2017 10:41:19 +1200 Subject: [PATCH 3/5] I forgot a comma --- src/arg_desc.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arg_desc.jl b/src/arg_desc.jl index b7af05d9..50cf0a45 100644 --- a/src/arg_desc.jl +++ b/src/arg_desc.jl @@ -48,7 +48,7 @@ const _arg_desc = KW( :series_annotations => "AbstractVector of String or PlotText. These are annotations which are mapped to data points/positions.", :primary => "Bool. Does this count as a 'real series'? For example, you could have a path (primary), and a scatter (secondary) as 2 separate series, maybe with different data (see sticks recipe for an example). The secondary series will get the same color, etc as the primary.", :hover => "nothing or vector of strings. Text to display when hovering over each data point.", -:stride => "(1,1). Array row and column strides. Used in surface/wireframe." +:stride => "(1,1). Array row and column strides. Used in surface/wireframe.", # plot args :plot_title => "String. Title for the whole plot (not the subplots) (Note: Not currently implemented)", From 774187257808bb7438da44416edccba8fbbbc5cc Mon Sep 17 00:00:00 2001 From: JackDevine Date: Wed, 16 Aug 2017 11:20:04 +1200 Subject: [PATCH 4/5] Comma in the wrong place --- src/args.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/args.jl b/src/args.jl index a72183b0..223e7484 100644 --- a/src/args.jl +++ b/src/args.jl @@ -214,7 +214,7 @@ const _series_defaults = KW( :primary => true, # when true, this "counts" as a series for color selection, etc. the main use is to allow # one logical series to be broken up (path and markers, for example) :hover => nothing, # text to display when hovering over the data points - :stride, => (1,1), # array stride for wireframe/surface, the first element is the row stride and the second is the column stride. + :stride => (1,1), # array stride for wireframe/surface, the first element is the row stride and the second is the column stride. ) From 654fa0426b1947259830f449756260d35ae10793 Mon Sep 17 00:00:00 2001 From: JackDevine Date: Sun, 3 Sep 2017 12:53:49 +1200 Subject: [PATCH 5/5] Remove documentation --- src/arg_desc.jl | 1 - 1 file changed, 1 deletion(-) diff --git a/src/arg_desc.jl b/src/arg_desc.jl index 50cf0a45..f244ff99 100644 --- a/src/arg_desc.jl +++ b/src/arg_desc.jl @@ -48,7 +48,6 @@ const _arg_desc = KW( :series_annotations => "AbstractVector of String or PlotText. These are annotations which are mapped to data points/positions.", :primary => "Bool. Does this count as a 'real series'? For example, you could have a path (primary), and a scatter (secondary) as 2 separate series, maybe with different data (see sticks recipe for an example). The secondary series will get the same color, etc as the primary.", :hover => "nothing or vector of strings. Text to display when hovering over each data point.", -:stride => "(1,1). Array row and column strides. Used in surface/wireframe.", # plot args :plot_title => "String. Title for the whole plot (not the subplots) (Note: Not currently implemented)",