@@ -372,24 +372,42 @@ Set parameters for your style sheet by:
3723721. creating your own [`matplotlibrc` file](https://matplotlib.org/stable/tutorials/introductory/customizing.html#defining-your-own-style), or
3733732. updating values stored in the dictionary-like variable `plt.rcParams`
374374375-Let's change the style of our overlaid density lines
375+Let's change the style of our overlaid density lines using the second method
376376377377```{code-cell} python3
378378from cycler import cycler
379379380380# set to the default style sheet
381381plt.style.use('default')
382382383-#set default figure size
384-plt.rcParams['figure.figsize'] = (10, 6)
385-# update linewidth
383+# You can update single values using keys:
384+385+# Set the font style to italic
386+plt.rcParams['font.style'] = 'italic'
387+388+# Update linewidth
386389plt.rcParams['lines.linewidth'] = 2
387-# add horizontal grid lines
388-plt.rcParams['axes.grid'] = True
389-plt.rcParams['axes.grid.axis'] = 'y'
390-# update colors for density lines
391-plt.rcParams['axes.prop_cycle'] = cycler('color',
392- ['dimgray', 'slategrey', 'darkgray'])
390+391+392+# You can also update many values at once using the update() method:
393+394+parameters = {
395+396+ # Change default figure size
397+ 'figure.figsize': (5, 4),
398+399+ # Add horizontal grid lines
400+ 'axes.grid': True,
401+ 'axes.grid.axis': 'y',
402+403+ # Update colors for density lines
404+ 'axes.prop_cycle': cycler('color',
405+ ['dimgray', 'slategrey', 'darkgray'])
406+}
407+408+plt.rcParams.update(parameters)
409+410+393411```
394412395413```{note}
@@ -418,7 +436,7 @@ Apply the `default` style sheet again to change your style back to default
418436419437plt.style.use('default')
420438421-#set default figure size
439+# Reset default figure size
422440plt.rcParams['figure.figsize'] = (10, 6)
423441424442```