This gave me decent dark background plot without adding too much code.
import matplotlib.pyplot as plt
# run backtest...
plt.style.use('dark_background') # call before plotting
cerebro.plot(
loc='grey', # changes color for 'line on close' plot otherwise it will plot black on black
grid=False # the default gridlines didn't look good w/ dark background
)
fig = plt.gcf()
# this will make the value tags at end of the lines readable. Otherwise it will plot white on white
for ax in fig.axes:
for text in ax.texts:
text.set_color('black')
plt.show()
Backtrader plots using matplotlib so if you're familiar with it you can always plot with cerebro.plot(), get the current figure with fig = plt.gcf(), and alter the figure's elements from there.