Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
curly brackets dict
  • Loading branch information
choldgraf committed May 5, 2017
commit b7e31f34d558de94d9f61a2c2ff056fa9b68b37f
2 changes: 1 addition & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def _check_deps():
'python': ('https://docs.python.org/', None),
'numpy': ('https://docs.scipy.org/doc/numpy/', None),
'scipy': ('https://docs.scipy.org/doc/scipy/reference/', None),
'pandas': ('https://pandas.pydata.org/pandas-docs/stable', None)
'pandas': ('http://pandas.pydata.org/pandas-docs/stable', None)
}


Expand Down
14 changes: 7 additions & 7 deletions examples/misc/keyword_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@
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.
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 = dict([('a', np.arange(50)),
('c', np.random.randint(0, 50, 50)),
('d', np.random.randn(50))])
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, as much as it's more work in some ways, I feel like an example with a clear structure, so something like:

data = { 'a' : [1,2,3,4,5,5,6,7],
              'b' :[4,5, 6,2,3, 4, 5],
              'c': [3,1,2,3,4,5,6,3],
              'd':[1,2,3,4,5,6,7,8]}

might work better since the point of this is to really clearly see what the kwarg does.


fig, ax = plt.subplots()
ax.scatter('a', 'b', c='c', s='d', data=data)
ax.set(xlabel='a', ylabel='b')
ax.set(xlabel='entry a', ylabel='entry b')
plt.show()
12 changes: 6 additions & 6 deletions tutorials/01_introductory/pyplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@
# the ``data`` keyword argument. If provided, then you may generate plots with
# the strings corresponding to these variables.

data = dict([('a', np.arange(50)),
('c', np.random.randint(0, 50, 50)),
('d', np.random.randn(50))])
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.plot('a', 'b', color='c', data=data)
plt.xlabel('a')
plt.ylabel('b')
plt.scatter('a', 'b', c='c', s='d', data=data)
plt.xlabel('entry a')
plt.ylabel('entry b')
plt.show()

###############################################################################
Expand Down