Releases: mdolab/niceplots
v2.5.1
v2.5.0
v2.4.1
v2.4.0
v2.3.0
What's Changed
- Add ability to get colors from style that is not active by @eytanadler in #35
Full Changelog: v2.2.0...v2.3.0
v2.2.0
What's Changed
- Plot smooth lines between data points by @eytanadler in #33
- Update niceplots.yml by @A-CGray in #34
Full Changelog: v2.1.0...v2.2.0
v2.1.0
v2.0.0
What's Changed
NicePlots 2.0 is still mostly the same, but there have been some small backwards incompatible changes to the API, checkout our updated examples documentation to see the new API in action:
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. 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:
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 #30
Full Changelog: v1.3.0...v2.0.0
v1.3.0
What's Changed
- Updated draggable legend kwargs by @marcomangano in #28
New Contributors
- @marcomangano made their first contribution in #28 🎉
Full Changelog: v1.2.1...v1.3.0