@@ -255,6 +255,38 @@ def setp(*args, **kwargs):
255255 draw_if_interactive ()
256256 return ret
257257
258+ def xkcd ():
259+ """
260+ Turns on `xkcd <xkcd.com>`_ sketch-style drawing mode. This will
261+ only have effect on things drawn after this function is called.
262+
263+ For best results, the "Humor Sans" font should be installed: it is
264+ not included with matplotlib.
265+
266+ This function works by setting a whole slew of rcParams, so it will
267+ probably override others you have set before.
268+ """
269+ from matplotlib import patheffects
270+ rcParams ['text.usetex' ] = False
271+ rcParams ['font.family' ] = 'fantasy'
272+ rcParams ['font.fantasy' ] = ['Humor Sans' , 'Comic Sans MS' ]
273+ rcParams ['font.size' ] = 14.0
274+ rcParams ['path.sketch' ] = (1 , 100 , 2 )
275+ rcParams ['path.effects' ] = [
276+ patheffects .withStroke (linewidth = 4 , foreground = "w" )]
277+ rcParams ['axes.linewidth' ] = 1.5
278+ rcParams ['lines.linewidth' ] = 2.0
279+ rcParams ['figure.facecolor' ] = 'white'
280+ rcParams ['grid.linewidth' ] = 0.0
281+ rcParams ['axes.unicode_minus' ] = False
282+ rcParams ['axes.color_cycle' ] = ['b' , 'r' , 'c' , 'm' ]
283+ # rcParams['axes.clip'] = False
284+ rcParams ['xtick.major.size' ] = 8
285+ rcParams ['xtick.major.width' ] = 3
286+ rcParams ['ytick.major.size' ] = 8
287+ rcParams ['ytick.major.width' ] = 3
288+
289+
258290## Figures ##
259291
260292
@@ -1790,7 +1822,7 @@ def colormaps():
17901822 for nominal data that has no inherent ordering, where color is used
17911823 only to distinguish categories
17921824
1793- The base colormaps are derived from those of the same name provided
1825+ The base colormaps are derived from those of the same name provided
17941826 with Matlab:
17951827
17961828 ========= =======================================================
@@ -1942,14 +1974,14 @@ def colormaps():
19421974 rainbow spectral purple-blue-green-yellow-orange-red colormap
19431975 with diverging luminance
19441976 seismic diverging blue-white-red
1945- nipy_spectral black-purple-blue-green-yellow-red-white spectrum,
1977+ nipy_spectral black-purple-blue-green-yellow-red-white spectrum,
19461978 originally from the Neuroimaging in Python project
19471979 terrain mapmaker's colors, blue-green-yellow-brown-white,
19481980 originally from IGOR Pro
19491981 ============= =======================================================
19501982
19511983 The following colormaps are redundant and may be removed in future
1952- versions. It's recommended to use the names in the descriptions
1984+ versions. It's recommended to use the names in the descriptions
19531985 instead, which produce identical output:
19541986
19551987 ========= =======================================================
@@ -1980,11 +2012,11 @@ def colormaps():
19802012 Color-Scale Images
19812013 <http://www.mathworks.com/matlabcentral/fileexchange/2662-cmrmap-m>`_
19822014 by Carey Rappaport
1983-
2015+
19842016 .. [#] Changed to distinguish from ColorBrewer's *Spectral* map.
1985- :func:`spectral` still works, but
2017+ :func:`spectral` still works, but
19862018 ``set_cmap('nipy_spectral')`` is recommended for clarity.
1987-
2019+
19882020
19892021 """
19902022 return sorted (cm .cmap_d .keys ())
0 commit comments