The seaborn styles shipped by Matplotlib are deprecated since 3.6

Question:

The seaborn styles shipped by Matplotlib are deprecated since 3.6,
as they no longer correspond to the styles shipped by seaborn.
However, they will remain available as ‘seaborn-v0_8-<style>’. Alternatively, directly use the seaborn API instead.

I have tried this:

# use seaborn style
plt.style.use("seaborn")

but it is deprecated, and I want to remove this warning when I use the cmd in windows

Asked By: David Emad

||

Answers:

This warning is telling you that seaborn styles in matplotlib do not match current seaborn styles, since the latest have been updated.

This is why you should set the style as follow:

plt.style.use("seaborn-v0_8")

You can specify a theme by replacing <style> with one the following:

  • white
  • dark
  • whitegrid
  • darkgrid
  • ticks

Just like this:

plt.style.use("seaborn-v0_8-whitegrid")

Alternatively, if you want to use the latest seaborn styles, use their library directly

Answered By: Tranbi

I can confirm that adding the version to the use function, just as Tranbi described, works and removes the warning.
From the additional themes the one called "darkgrid" is almost the same as if I do not specify any.

Answered By: Vojta Baránek