PyPlot KeyError with simple plot in Julia 0.6


julia> using Plots
julia> pyplot()
julia> Pkg.status(“PyPlot”)

  • PyPlot 2.3.2

julia> plot(rand(10), [rand(10), rand(10)])
Error showing value of type Plots.Plot{Plots.PyPlotBackend}:
ERROR: KeyError: key “set_facecolor” not found


I suspect you have an outdated matplotlib version. Try

import Conda; Conda.update()


I have 1.5.3. Does it need something newer? The latest seems to be 2.0.x.


Yes, it looks like Plots.jl currently requires Matplotlib 2.0 (

It sounds like you are not using Conda.jl’s Python at all, but are rather using some other Python on your system that has an outdated Matplotlib. (Run using PyCall; PyCall.python to see what Python you configured PyCall to use). You can either upgrade Matplotlib in your system’s Python or switch to using Julia’s “own” Python distro via Conda.jl (which installs a private Anaconda distro for Julia) by running ENV["PYTHON"]="";"PyCall") and re-launching Julia.


Thanks. I am using a system-wide Python 2.7, and corresponding
matplotlib 1.5.3 package, on FreeBSD. The 2.0.x matplotlib package is
not available yet.

The Conda approach seems heavyweight to me …

I normally use the plotly backend. My main reason for the PyPlot backend
is that I want to export plots to pdf, etc. PlotlyJS, which provides
this functionality, unfortunately doesn’t work on FreeBSD because of its
dependence on Electron. (Which also seems heavyweight to me.)


That’s totally understandable. Your other options are (a) use PyPlot directly (rather than via Plots) or (b) patch Plots.jl to fix #978.


Thanks, I patched Plots/src/backends/pyplot.jl and things work now.


I’m sure the Plots.jl authors would appreciate a PR.