From 096064ac093bfb63da15dd5eca2e148f9bad6089 Mon Sep 17 00:00:00 2001 From: Thomas Breloff Date: Mon, 25 Apr 2016 12:00:43 -0400 Subject: [PATCH] subplot layout fix; closes #202 --- src/args.jl | 133 ----------------------------------------- src/backends/pyplot.jl | 6 +- src/subplot.jl | 7 ++- 3 files changed, 10 insertions(+), 136 deletions(-) diff --git a/src/args.jl b/src/args.jl index eb95d488..78f5e836 100644 --- a/src/args.jl +++ b/src/args.jl @@ -327,139 +327,6 @@ add_aliases(:quiver, :velocity, :quiver2d, :gradient) add_aliases(:normalize, :norm, :normed, :normalized) - -# Alternate args - -# @compat const _keyAliases = KW( - # :c => :seriescolor, - # :color => :seriescolor, - # :colour => :seriescolor, - # :alpha => :seriesalpha, - # :α => :seriesalpha, - # :opacity => :seriesalpha, - # :lc => :linecolor, - # :lcolor => :linecolor, - # :lcolour => :linecolor, - # :lab => :label, - # :l => :line, - # :w => :linewidth, - # :width => :linewidth, - # :lw => :linewidth, - # :la => :linealpha, - # :lalpha => :linealpha, - # :lineopacity => :linealpha, - # :type => :linetype, - # :lt => :linetype, - # :t => :linetype, - # :seriestype => :linetype, - # :style => :linestyle, - # :s => :linestyle, - # :ls => :linestyle, - # :m => :marker, - # :mark => :marker, - # :shape => :markershape, - # :mc => :markercolor, - # :mcolor => :markercolor, - # :markercolour => :markercolor, - # :ms => :markersize, - # :msize => :markersize, - # :ma => :markeralpha, - # :malpha => :markeralpha, - # :mopacity => :markeralpha, - # :markeropacity => :markeralpha, - # :zcolor => :marker_z, - # :f => :fill, - # :area => :fill, - # :fillrng => :fillrange, - # :fc => :fillcolor, - # :fcolor => :fillcolor, - # :fillcolour => :fillcolor, - # :fa => :fillalpha, - # :falpha => :fillalpha, - # :fillopacity => :fillalpha, - # :g => :group, - # :nb => :nbins, - # :nbin => :nbins, - # :rib => :ribbon, - # :ann => :annotation, - # :anns => :annotation, - # :annotate => :annotation, - # :annotations => :annotation, - # :xlab => :xlabel, - # :ylab => :ylabel, - # :zlab => :zlabel, - # :yrlab => :yrightlabel, - # :ylabr => :yrightlabel, - # :y2lab => :yrightlabel, - # :ylab2 => :yrightlabel, - # :ylabelright => :yrightlabel, - # :ylabel2 => :yrightlabel, - # :y2label => :yrightlabel, - # :leg => :legend, - # :key => :legend, - # :cbar => :colorbar, - # :cb => :colorbar, - # :bg => :background_color, - # :bgcolor => :background_color, - # :bg_color => :background_color, - # :background => :background_color, - # :background_colour => :background_color, - # :fg => :foreground_color, - # :fgcolor => :foreground_color, - # :fg_color => :foreground_color, - # :foreground => :foreground_color, - # :foreground_colour => :foreground_color, - # :bglegend => :background_color_legend, - # :bg_legend => :background_color_legend, - # :bgcolor_legend => :background_color_legend, - # :background_legend => :background_color_legend, - # :bglegend => :background_color_legend, - # :regression => :smooth, - # :reg => :smooth, - # :nlevels => :levels, - # :nlev => :levels, - # :levs => :levels, - # :xlim => :xlims, - # :xlimit => :xlims, - # :xlimits => :xlims, - # :ylim => :ylims, - # :ylimit => :ylims, - # :ylimits => :ylims, - # :zlim => :zlims, - # :zlimit => :zlims, - # :zlimits => :zlims, - # :xtick => :xticks, - # :ytick => :yticks, - # :windowsize => :size, - # :wsize => :size, - # :wtitle => :windowtitle, - # :gui => :show, - # :display => :show, - # :palette => :color_palette, - # :xlink => :linkx, - # :ylink => :linky, - # :nrow => :nr, - # :nrows => :nr, - # :ncol => :nc, - # :ncols => :nc, - # :clf => :overwrite_figure, - # :clearfig => :overwrite_figure, - # :overwrite => :overwrite_figure, - # # :reuse => :overwrite_figure, - # :err => :yerror, - # :errorbar => :yerror, - # :xerr => :xerror, - # :xerrorbar => :xerror, - # :yerr => :yerror, - # :yerrorbar => :yerror, - # :velocity => :quiver, - # :quiver2d => :quiver, - # :gradient => :quiver, - # :norm => :normalize, - # :normed => :normalize, - # :normalized => :normalize, - # ) - # add all pluralized forms to the _keyAliases dict for arg in keys(_seriesDefaults) _keyAliases[makeplural(arg)] = arg diff --git a/src/backends/pyplot.jl b/src/backends/pyplot.jl index 9e8cf32f..b672bc6d 100644 --- a/src/backends/pyplot.jl +++ b/src/backends/pyplot.jl @@ -992,8 +992,10 @@ function subplot(plts::AVec{Plot{PyPlotBackend}}, layout::SubplotLayout, d::KW) n = sum([plt.n for plt in plts]) pkg = PyPlotBackend() - plt.plotargs[:subplot] = true - newplts = Plot{PyPlotBackend}[_create_plot(pkg, plt.plotargs) for plt in plts] + newplts = Plot{PyPlotBackend}[begin + plt.plotargs[:subplot] = true + _create_plot(pkg, plt.plotargs) + end for plt in plts] subplt = Subplot(nothing, newplts, PyPlotBackend(), p, n, layout, d, true, false, false, (r,c) -> (nothing,nothing)) diff --git a/src/subplot.jl b/src/subplot.jl index 554cdd2c..153cbaf0 100644 --- a/src/subplot.jl +++ b/src/subplot.jl @@ -81,7 +81,12 @@ end # grid layout function subplot{P}(plt1::Plot{P}, plts::Plot{P}...; kw...) d = KW(kw) - layout = subplotlayout(length(plts)+1, get(d, :nr, -1), get(d, :nc, -1)) + layout = if haskey(d, :layout) + subplotlayout(d[:layout]) + else + subplotlayout(length(plts)+1, get(d, :nr, -1), get(d, :nc, -1)) + end + # layout = subplotlayout(length(plts)+1, get(d, :nr, -1), get(d, :nc, -1)) subplot(vcat(plt1, plts...), layout, d) end