From 199a3306db73c29bce2dd8e96d2e1762ed38d776 Mon Sep 17 00:00:00 2001 From: Tom Breloff Date: Wed, 11 Jan 2017 10:37:54 -0500 Subject: [PATCH] fix support for fill_z in pyplot --- src/backends/pyplot.jl | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/backends/pyplot.jl b/src/backends/pyplot.jl index b1f7e2c0..84ea6718 100644 --- a/src/backends/pyplot.jl +++ b/src/backends/pyplot.jl @@ -18,8 +18,7 @@ const _pyplot_attr = merge_with_base_supported([ :guide, :lims, :ticks, :scale, :flip, :rotation, :tickfont, :guidefont, :legendfont, :grid, :legend, :colorbar, - :marker_z, - :line_z, + :marker_z, :line_z, :fill_z, :levels, :ribbon, :quiver, :arrow, :orientation, @@ -124,8 +123,8 @@ end py_colormap(c) = py_colormap(cgrad()) -function py_shading(c, z, α=nothing) - cmap = py_colormap(c, α) +function py_shading(c, z) + cmap = py_colormap(c) ls = pycolors.pymember("LightSource")(270,45) ls[:shade](z, cmap, vert_exag=0.1, blend_mode="soft") end @@ -668,21 +667,16 @@ function py_add_series(plt::Plot{PyPlotBackend}, series::Series) x = repmat(x', length(y), 1) y = repmat(y, 1, length(series[:x])) end - # z = z' z = transpose_z(series, z) if st == :surface - if series[:marker_z] != nothing - extrakw[:facecolors] = py_shading(series[:fillcolor], series[:marker_z], series[:fillalpha]) + if series[:fill_z] != nothing + # the surface colors are different than z-value + extrakw[:facecolors] = py_shading(series[:fillcolor], transpose_z(series, series[:fill_z].surf)) extrakw[:shade] = false - clims = sp[:clims] - if is_2tuple(clims) - isfinite(clims[1]) && (extrakw[:vmin] = clims[1]) - isfinite(clims[2]) && (extrakw[:vmax] = clims[2]) - end else extrakw[:cmap] = py_fillcolormap(series) - needs_colorbar = true end + needs_colorbar = true end handle = ax[st == :surface ? :plot_surface : :plot_wireframe](x, y, z; label = series[:label],