diff --git a/doc/_static/mpl.css b/doc/_static/mpl.css index d7bc46446c7f..1c75454512bf 100644 --- a/doc/_static/mpl.css +++ b/doc/_static/mpl.css @@ -19,7 +19,7 @@ body { } a { - color: #CA7900; + color: #CA7900 !important; text-decoration: none; } diff --git a/doc/conf.py b/doc/conf.py index 57ea9e99357d..5e5dba666a17 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -29,7 +29,7 @@ extensions = ['matplotlib.sphinxext.mathmpl', 'sphinxext.math_symbol_table', 'sphinx.ext.autodoc', 'matplotlib.sphinxext.only_directives', 'sphinx.ext.doctest', 'sphinx.ext.autosummary', - 'sphinx.ext.inheritance_diagram', + 'sphinx.ext.inheritance_diagram', 'sphinx.ext.intersphinx', 'sphinx_gallery.gen_gallery', 'matplotlib.sphinxext.plot_directive', 'sphinxext.github', @@ -88,6 +88,13 @@ def _check_deps(): autodoc_docstring_signature = True +intersphinx_mapping = { + 'python': ('https://docs.python.org/', None), + 'numpy': ('https://docs.scipy.org/doc/numpy/', None), + 'scipy': ('https://docs.scipy.org/doc/scipy/reference/', None), + 'pandas': ('http://pandas.pydata.org/pandas-docs/stable', None) + } + # Sphinx gallery configuration sphinx_gallery_conf = { diff --git a/examples/misc/keyword_plotting.py b/examples/misc/keyword_plotting.py new file mode 100644 index 000000000000..c7aa93e0f7b8 --- /dev/null +++ b/examples/misc/keyword_plotting.py @@ -0,0 +1,28 @@ +""" +====================== +Plotting with keywords +====================== + +There are some instances where you have data in a format that lets you +access particular variables with strings. For example, with +:class:`numpy.recarray` or :class:`pandas.DataFrame`. + +Matplotlib allows you provide such an object with the ``data`` keyword +argument. If provided, then you may generate plots with the strings +corresponding to these variables. +""" + +import numpy as np +import matplotlib.pyplot as plt +np.random.seed(19680801) + +data = {'a': np.arange(50), + 'c': np.random.randint(0, 50, 50), + 'd': np.random.randn(50)} +data['b'] = data['a'] + 10 * np.random.randn(50) +data['d'] = np.abs(data['d']) * 100 + +fig, ax = plt.subplots() +ax.scatter('a', 'b', c='c', s='d', data=data) +ax.set(xlabel='entry a', ylabel='entry b') +plt.show() diff --git a/tutorials/01_introductory/pyplot.py b/tutorials/01_introductory/pyplot.py index 236226153c26..36642516dfbb 100644 --- a/tutorials/01_introductory/pyplot.py +++ b/tutorials/01_introductory/pyplot.py @@ -93,6 +93,31 @@ plt.plot(t, t, 'r--', t, t**2, 'bs', t, t**3, 'g^') plt.show() +############################################################################### +# .. _plotting-with-keywords: +# +# Plotting with keyword strings +# ============================= +# +# There are some instances where you have data in a format that lets you +# access particular variables with strings. For example, with +# :class:`numpy.recarray` or :class:`pandas.DataFrame`. +# +# Matplotlib allows you provide such an object with +# the ``data`` keyword argument. If provided, then you may generate plots with +# the strings corresponding to these variables. + +data = {'a': np.arange(50), + 'c': np.random.randint(0, 50, 50), + 'd': np.random.randn(50)} +data['b'] = data['a'] + 10 * np.random.randn(50) +data['d'] = np.abs(data['d']) * 100 + +plt.scatter('a', 'b', c='c', s='d', data=data) +plt.xlabel('entry a') +plt.ylabel('entry b') +plt.show() + ############################################################################### # .. _controlling-line-properties: #