PyPlot set facecolor

Can anyone get this code to work?

using Plots
pyplot()
fig, ax = PyPlot.subplots(facecolor=(0.5,0.2,0.5)) 
ax.plot(rand(10))
fig 

This code runs without any error message, but for some reason the background color for the fig object does not change.

I’m using Atom and Julia version 1.4.0 and using latest version of all the packages. MatPlotlib from PyCall shows version 3.0.3. If anybody could help with this issue, it would be great.

Two ideas for you:

  1. Using Plots and the PyPlot backend:
using Plots
pyplot()
plot(rand(10), background_color =RGB(0.5,0.2,0.5))
  1. Using PyPlot directly:
using PyPlot
fig, ax = PyPlot.subplots() 
ax.set_facecolor((0.5,0.2,0.5))
ax.plot(rand(10))
fig