# PyPlot KeyError with simple plot in Julia 0.6

**URL:** <https://discourse.julialang.org/t/pyplot-keyerror-with-simple-plot-in-julia-0-6/4985>\
**Category:** Visualization\
**Created:** [July 20, 2017, 8:49pm UTC](https://discourse.julialang.org/t/pyplot-keyerror-with-simple-plot-in-julia-0-6/4985 "2017-07-20T20:49:59Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ko56](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ko56/32/2684_2.png) [@ko56](https://discourse.julialang.org/u/ko56)\
**Post date:** [July 20, 2017, 8:49pm UTC](https://discourse.julialang.org/t/pyplot-keyerror-with-simple-plot-in-julia-0-6/4985/1 "2017-07-20T20:49:59Z")

</div>

julia\> using Plots  
julia\> pyplot()  
Plots.PyPlotBackend()  
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

---

<div class="post-metadata">

**Author:** ![daschw](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/daschw/32/2926_2.png) [@daschw](https://discourse.julialang.org/u/daschw)\
**Post date:** [July 20, 2017, 10:37pm UTC](https://discourse.julialang.org/t/pyplot-keyerror-with-simple-plot-in-julia-0-6/4985/2 "2017-07-20T22:37:57Z")

</div>

I suspect you have an outdated matplotlib version. Try

```julia
import Conda; Conda.update()

```

---

<div class="post-metadata">

**Author:** ![ko56](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ko56/32/2684_2.png) [@ko56](https://discourse.julialang.org/u/ko56)\
**Post date:** [July 21, 2017, 1:13pm UTC](https://discourse.julialang.org/t/pyplot-keyerror-with-simple-plot-in-julia-0-6/4985/3 "2017-07-21T13:13:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [July 21, 2017, 1:48pm UTC](https://discourse.julialang.org/t/pyplot-keyerror-with-simple-plot-in-julia-0-6/4985/4 "2017-07-21T13:48:58Z")

</div>

> [@ko56](#):
>
> I have 1.5.3. Does it need something newer?

Yes, it looks like Plots.jl currently requires Matplotlib 2.0 ([requires Matplotlib 2? · Issue #978 · JuliaPlots/Plots.jl · GitHub](https://github.com/JuliaPlots/Plots.jl/issues/978)).

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"]=""; Pkg.build("PyCall")` and re-launching Julia.

---

<div class="post-metadata">

**Author:** ![ko56](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ko56/32/2684_2.png) [@ko56](https://discourse.julialang.org/u/ko56)\
**Post date:** [July 21, 2017, 3:02pm UTC](https://discourse.julialang.org/t/pyplot-keyerror-with-simple-plot-in-julia-0-6/4985/5 "2017-07-21T15:02:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [July 21, 2017, 3:42pm UTC](https://discourse.julialang.org/t/pyplot-keyerror-with-simple-plot-in-julia-0-6/4985/6 "2017-07-21T15:42:46Z")

</div>

> [@ko56](#):
>
> 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 …

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

---

<div class="post-metadata">

**Author:** ![ko56](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ko56/32/2684_2.png) [@ko56](https://discourse.julialang.org/u/ko56)\
**Post date:** [July 21, 2017, 5:51pm UTC](https://discourse.julialang.org/t/pyplot-keyerror-with-simple-plot-in-julia-0-6/4985/7 "2017-07-21T17:51:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [July 21, 2017, 9:11pm UTC](https://discourse.julialang.org/t/pyplot-keyerror-with-simple-plot-in-julia-0-6/4985/8 "2017-07-21T21:11:04Z")

</div>

> [@ko56](#):
>
> Thanks, I patched Plots/src/backends/pyplot.jl and things work now.

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