From 44b533f50165db6d28eb3f62f25a53fdf4cbb997 Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Mon, 24 Jul 2017 10:02:44 +0200 Subject: [PATCH 1/2] allow matplotlib 1.5 usage --- src/backends/pyplot.jl | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/backends/pyplot.jl b/src/backends/pyplot.jl index 9f5e8a24..964fb049 100644 --- a/src/backends/pyplot.jl +++ b/src/backends/pyplot.jl @@ -83,6 +83,14 @@ function _initialize_backend(::PyPlotBackend) const pycollections = PyPlot.pywrap(PyPlot.pyimport("matplotlib.collections")) const pyart3d = PyPlot.pywrap(PyPlot.pyimport("mpl_toolkits.mplot3d.art3d")) + # "support" matplotlib v1.5 + const set_facecolor_sym = if PyPlot.version < v"2" + warning("You are using Matplotlib $(PyPlot.version), which is no longer officialy supported by the Plots community. To ensure smooth Plots.jl integration update your Matplotlib library to a version >= 2.0.0") + :set_axis_bgcolor + else + :set_facecolor + end + # we don't want every command to update the figure PyPlot.ioff() end @@ -985,7 +993,7 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend}) fig[:clear]() dpi = plt[:dpi] fig[:set_size_inches](w/dpi, h/dpi, forward = true) - fig[:set_facecolor](py_color(plt[:background_color_outside])) + fig[set_facecolor_sym](py_color(plt[:background_color_outside])) fig[:set_dpi](dpi) # resize the window @@ -1074,7 +1082,7 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend}) py_add_legend(plt, sp, ax) # this sets the bg color inside the grid - ax[:set_facecolor](py_color(sp[:background_color_inside])) + ax[set_facecolor_sym](py_color(sp[:background_color_inside])) end py_drawfig(fig) end @@ -1196,7 +1204,7 @@ function py_add_legend(plt::Plot, sp::Subplot, ax) # set some legend properties frame = leg[:get_frame]() - frame[:set_facecolor](py_color(sp[:background_color_legend])) + frame[set_facecolor_sym](py_color(sp[:background_color_legend])) frame[:set_edgecolor](fgcolor) end end From 6ecd30d42b810b4048e6effa13627e675bf9c150 Mon Sep 17 00:00:00 2001 From: Daniel Schwabeneder Date: Mon, 24 Jul 2017 14:55:28 +0200 Subject: [PATCH 2/2] warning --> warn --- src/backends/pyplot.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backends/pyplot.jl b/src/backends/pyplot.jl index 964fb049..aaa0effa 100644 --- a/src/backends/pyplot.jl +++ b/src/backends/pyplot.jl @@ -85,7 +85,7 @@ function _initialize_backend(::PyPlotBackend) # "support" matplotlib v1.5 const set_facecolor_sym = if PyPlot.version < v"2" - warning("You are using Matplotlib $(PyPlot.version), which is no longer officialy supported by the Plots community. To ensure smooth Plots.jl integration update your Matplotlib library to a version >= 2.0.0") + warn("You are using Matplotlib $(PyPlot.version), which is no longer officialy supported by the Plots community. To ensure smooth Plots.jl integration update your Matplotlib library to a version >= 2.0.0") :set_axis_bgcolor else :set_facecolor