2

I have a custom matplotlibrc file with matplotlib configuration options, following the procedure here. When I first start up Jupyter QtConsole (through the terminal, if that matters), the file is being read—plots use the options I've set, such as dashed grid lines:

%matplotlib inline

plt.plot([1, 2, 3])
Out[2]: [<matplotlib.lines.Line2D at 0x9d2fe80>]

enter image description here

The matplotlibrc file is here:

mpl.matplotlib_fname()
Out[4]: 'C:\\Users\\my_username\\.matplotlib\\matplotlibrc'

But then if I import seaborn:

import seaborn as sns

plots then switch to seaborn style:

plt.plot([1, 2, 3])
Out[6]: [<matplotlib.lines.Line2D at 0xceb9cc0>]

enter image description here

Is it possible to retain the original plotting style while also importing seaborn? I'd like to use its capabilities, such as seaborn.heatmap, but not its styles.

Arya McCarthy
  • 8,554
  • 4
  • 34
  • 56
Brad Solomon
  • 38,521
  • 31
  • 149
  • 235

1 Answers1

5

Instead of:

import seaborn as sns

Use:

import seaborn.apionly as sns

You get the API, without the styling. The developer included this option for people who wanted Seaborn's features without its custom appearance.

Arya McCarthy
  • 8,554
  • 4
  • 34
  • 56