In place of %matplotlib notebook, with current JupyterLab or Jupyter Notebook 7+, you generally want to install and use ipympl. Note that you have to first install ipympl in your environment. This is very important. Restart everything, too. Restarting the kernel only is insufficient. (OP says clearing cache of browser helped. I've seen refreshing the browser Jupyter page sometimes be enough; however, honestly restarting machine or at least Jupyter and the browser is advised.)
Then following successful installation and refresh, %matplotlib ipympl will work much like %matplotlib notebook did with the older tech. See documentation here where it says:
"To activate the ipympl backend all you need to do is include the %matplotlib ipympl magic in the notebook."
%matplotlib notebook isn't for current JupyterLab or Jupyter Notebook 7+. Jupyter Notebook 7+ uses a lot of the same tech as JupyterLab, and so you want to look for things that work with that.
Finally, if you prefer the older way with %matplotlib notebook, you can continue to use NbClassic at this time, see here.
%matplotlib notebookisn't for current JupyterLab or Jupyter Notebook 7+. Jupyter Notebook 7+ uses a lot of the same tech as JupyterLab and so you want to look for things that work with that. In place of%matplotlib notebookwith current JupyterLab or Jupyter Notebook 7+, you generally want to install and use ipympl. Note that you have to install it. Very important. Then%matplotlib ipymplwill work. See documentation here where it says, ...ipymplbackend all you need to do is include the%matplotlib ipymplmagic in the notebook."%matplotlib notebook; however, what are you seeing when you run%matplotlib inline? That should still work.