-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Minor example updates #7559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minor example updates #7559
Changes from 1 commit
a4f4747
9c8b7e6
f328fe6
2b5c486
41c5f9f
e30af98
e6ce528
33873c5
28b8040
7de832c
94f47da
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
10000
|
@@ -113,7 +113,7 @@ def curvelinear_test2(fig): | |
# A parasite axes with given transform | ||
ax2 = ParasiteAxesAuxTrans(ax1, tr, "equal") | ||
# note that ax2.transData == tr + ax1.transData | ||
# Anthing you draw in ax2 will match the ticks and grids of ax1. | ||
# Anything you draw in ax2 will match the ticks and grids of ax1. | ||
ax1.parasites.append(ax2) | ||
intp = cbook.simple_linear_interpolation | ||
ax2.plot(intp(np.array([0, 30]), 50), | ||
|
F438
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ | |
datafile = cbook.get_sample_data('goog.npy') | ||
try: | ||
# Python3 cannot load python2 .npy files with datetime(object) arrays | ||
# unless the encoding is set to bytes. Hovever this option was | ||
# unless the encoding is set to bytes. However this option was | ||
# not added until numpy 1.10 so this example will only work with | ||
# python 2 or with numpy 1.10 and later | ||
price_data = np.load(datafile, encoding='bytes').view(np.recarray) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you regenerate the npy under a recent py3, can you cover all cases? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not having luck with it: $ ipython3
In [1]: import numpy as np
In [2]: np.__version__
Out[2]: '1.11.2'
In [3]: i = np.load('lib/matplotlib/mpl-data/sample_data/goog.npy', encoding='bytes')
In [4]: np.save('goog.npy', i)
$ python2
>>> import numpy as np
>>> np.__version__
'1.11.2'
>>> i = np.load('goog.npy')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python2.7/site-packages/numpy/lib/npyio.py", line 406, in load
pickle_kwargs=pickle_kwargs)
File "/usr/lib64/python2.7/site-packages/numpy/lib/format.py", line 637, in read_array
array = pickle.load(fp, **pickle_kwargs)
ValueError: non-string names in Numpy dtype unpickling
>>> i = np.load('goog.npy', encoding='bytes')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python2.7/site-packages/numpy/lib/npyio.py", line 406, in load
pickle_kwargs=pickle_kwargs)
File "/usr/lib64/python2.7/site-packages/numpy/lib/format.py", line 637, in read_array
array = pickle.load(fp, **pickle_kwargs)
ValueError: non-string names in Numpy dtype unpickling What would probably be the most portable is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. np.datetime64 has been a mess from the start. It is marginally usable now that we require numpy 1.7, so we do need to add support as best we can. Maybe someone will want to take that on for 2.1. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This example doesn't use dates or times in any form! It is just plotting random-looking numbers that happen to come from some stock statistics. As a plotting example, it doesn't need to read data in from a file at all. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, but there are a couple others (just search for this same typo message in this PR) that do use the file and do use the dates, so I was mainly referring to them. |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about just "Errorbar subsampling"?