`setRCParams` is now `plt.style.use`
**TL;DR:** replace `niceplots.setRCParams()` with `plt.style.use(niceplots.get_style())` and replace `niceplots.setRCParams(dark_mode=True, set_dark_background=True)` with `plt.style.use(niceplots.get_style("doumont-dark"))`
We replaced the `setRCParams` function that set the niceplots style with a series of matplotlib [stylesheets](https://matplotlib.org/stable/tutorials/introductory/customizing.html#customizing-with-style-sheets). There are now 4 available NicePlots styles:
- `doumont-light`
- `doumont-dark`
- `james-light`
- `james-dark`
The two Doumont styles are mostly equivalent to the styles that used to be set by `setRCParams()` although we have tweaked them a little, so we can't guarantee your plots will look *exactly* like they used to with NicePlots v1.
We don't store the niceplots stylesheets in a place matplotlib can normally find them, so to use them you will need to call `niceplots.get_style(<style name>)`, whose output can be passed to `plt.style.use` or `plt.style.context`. To enable you to easily switch between NicePlots and matplotlib styles, `get_style` also accepts the name of any matplotlib style.
If you just want a drop-in replacement for `niceplots.setRCParams()`, use `plt.style.use(niceplots.get_style())`, since the `doumont-light` theme is returned by default.
By switching to style sheets, you can now compose NicePlots' styles with your own. For example, if you wanted to start off with the `james-dark` theme and then make a few adjustments, put your adjustments in your own style sheet and then call:
python
plt.style.use([niceplots.get_style("james-dark"), <path to your stylesheet>])
`get_niceColors` is now `get_colors`/`get_colors_list`
`get_colors_list()` returns the currently set color cycle as a list, it is identical to calling `plt.rcParams["axes.prop_cycle"].by_key()["color"]`. `get_colors()` returns the current style's colors as a dictionary, it includes some additional colors that aren't in the color cycle but are used by the style, for example, the `"Axis"` and `"Background"` colors. Unfortunately, `get_colors()` only works while you're using a NicePlots style, but why would you ever not be?
We picked a naming convention
Previously the method names in NicePlots were all over the place, we had `setRCParams()`, `parula_map` and even `get_niceColors()`. Everything has now been converted to `snake_case`, which means you might need to make the following changes to your old scripts:
- `plotOptProb` -> `plot_opt_prob`
- `plotColoredLine` -> `plot_colored_line`
- `plotNestedPie` -> `plot_nested_pie`
PRs
All of the above changes were implemented in the PR below
* Switch to using stylesheets by eytanadler in https://github.com/mdolab/niceplots/pull/30
**Full Changelog**: https://github.com/mdolab/niceplots/compare/v1.3.0...v2.0.0