subplot layout fix; closes #202

This commit is contained in:
Thomas Breloff 2016-04-25 12:00:43 -04:00
parent 77c2d7d846
commit 096064ac09
3 changed files with 10 additions and 136 deletions

View File

@ -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

View File

@ -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))

View File

@ -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