How can I import styling into Jupyter-Notebook using Matplotlib using plt.style.use?

Question:

I have the following import which I am trying to use for styling but I keep receiving the following error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In [1], line 3
      1 import numpy as np
      2 import matplotlib.pyplot as plt
----> 3 plt.style.use('science', 'notebook','dark_background')

TypeError: use() takes 1 positional argument but 3 were given

I am using Macbook Pro ARM – not sure if that is the reason, but I have tried everything…

Asked By: Droneship

||

Answers:

According to matplotlib.style.use, the input to the method should be a str, dict, Path or list.

Your current input to the method however is neither of them. Thus, pass them as a list to the method: plt.style.use(['science', 'notebook','dark_background']).

Answered By: medium-dimensional