Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6c5e961

Browse filesBrowse files
committed
Turn get_sample_data into a much simpler function that merely returns files from an installed sample_data directory. Include the sample data locally. Remove sample data that is no longer used.
1 parent 94c53e1 commit 6c5e961
Copy full SHA for 6c5e961
Expand file treeCollapse file tree

31 files changed

+6271
-329
lines changed

‎MANIFEST.in

Copy file name to clipboardExpand all lines: MANIFEST.in
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ include lib/matplotlib/mpl-data/images/*
1313
include lib/matplotlib/mpl-data/fonts/ttf/*
1414
include lib/matplotlib/mpl-data/fonts/pdfcorefonts/*
1515
include lib/matplotlib/mpl-data/fonts/afm/*
16+
recursive-include lib/matplotlib/mpl-data/sample_data/*
1617
recursive-include license LICENSE*
1718
recursive-include examples *
1819
recursive-include doc *

‎examples/misc/sample_data_test.py

Copy file name to clipboardExpand all lines: examples/misc/sample_data_test.py
-27Lines changed: 0 additions & 27 deletions
This file was deleted.

‎examples/pylab_examples/centered_ticklabels.py

Copy file name to clipboardExpand all lines: examples/pylab_examples/centered_ticklabels.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import matplotlib.pyplot as plt
2222

2323
# load some financial data; apple's stock price
24-
fh = cbook.get_sample_data('aapl.npy')
24+
fh = cbook.get_sample_data('aapl.npy.gz')
2525
r = np.load(fh); fh.close()
2626
r = r[-250:] # get the last 250 days
2727

‎examples/pylab_examples/data_helper.py

Copy file name to clipboard
100644100755
Expand all lines: examples/pylab_examples/data_helper.py
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ def get_two_stock_data():
1111
"""
1212
ticker1, ticker2 = 'INTC', 'AAPL'
1313

14-
file1 = cbook.get_sample_data('INTC.dat', asfileobj=False)
15-
file2 = cbook.get_sample_data('AAPL.dat', asfileobj=False)
16-
M1 = fromstring( open(file1, 'rb').read(), '<d')
14+
file1 = cbook.get_sample_data('INTC.dat.gz')
15+
file2 = cbook.get_sample_data('AAPL.dat.gz')
16+
M1 = fromstring( file1.read(), '<d')
1717

1818
M1 = resize(M1, (M1.shape[0]/2,2) )
1919

20-
M2 = fromstring( open(file2, 'rb').read(), '<d')
20+
M2 = fromstring( file2.read(), '<d')
2121
M2 = resize(M2, (M2.shape[0]/2,2) )
2222

2323
d1, p1 = M1[:,0], M1[:,1]

‎examples/pylab_examples/image_demo2.py

Copy file name to clipboardExpand all lines: examples/pylab_examples/image_demo2.py
+2-4Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66

77
w, h = 512, 512
88

9-
datafile = cbook.get_sample_data('ct.raw', asfileobj=False)
10-
print ('loading %s' % datafile)
11-
s = open(datafile, 'rb').read()
9+
datafile = cbook.get_sample_data('ct.raw.gz', asfileobj=True)
10+
s = datafile.read()
1211
A = fromstring(s, uint16).astype(float)
1312
A *= 1.0/max(A)
1413
A.shape = w, h
@@ -35,4 +34,3 @@
3534
setp(gca(), 'xticklabels', [])
3635

3736
show()
38-

‎examples/pylab_examples/mri_demo.py

Copy file name to clipboardExpand all lines: examples/pylab_examples/mri_demo.py
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
from pylab import *
55
import matplotlib.cbook as cbook
66
# data are 256x256 16 bit integers
7-
dfile = cbook.get_sample_data('s1045.ima', asfileobj=False)
8-
print ('loading image %s' % dfile)
9-
im = np.fromstring(open(dfile, 'rb').read(), np.uint16).astype(float)
7+
dfile = cbook.get_sample_data('s1045.ima')
8+
im = np.fromstring(dfile.read(), np.uint16).astype(float)
109
im.shape = 256, 256
1110

1211
#imshow(im, ColormapJet(256))

‎examples/pylab_examples/mri_with_eeg.py

Copy file name to clipboardExpand all lines: examples/pylab_examples/mri_with_eeg.py
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@
1515

1616
if 1: # load the data
1717
# data are 256x256 16 bit integers
18-
dfile = cbook.get_sample_data('s1045.ima', asfileobj=False)
19-
print ('loading image %s' % dfile)
20-
im = np.fromstring(open(dfile, 'rb').read(), np.uint16).astype(float)
18+
dfile = cbook.get_sample_data('s1045.ima.gz')
19+
im = np.fromstring(dfile.read(), np.uint16).astype(float)
2120
im.shape = 256, 256
2221

2322
if 1: # plot the MRI in pcolor

‎lib/matplotlib/__init__.py

Copy file name to clipboardExpand all lines: lib/matplotlib/__init__.py
-14Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -813,20 +813,6 @@ def rc_params_from_file(fname, fail_on_error=False):
813813
# this is the instance used by the matplotlib classes
814814
rcParams = rc_params()
815815

816-
if rcParams['examples.directory']:
817-
# paths that are intended to be relative to matplotlib_fname()
818-
# are allowed for the examples.directory parameter.
819-
# However, we will need to fully qualify the path because
820-
# Sphinx requires absolute paths.
821-
if not os.path.isabs(rcParams['examples.directory']):
822-
_basedir, _fname = os.path.split(matplotlib_fname())
823-
# Sometimes matplotlib_fname() can return relative paths,
824-
# Also, using realpath() guarentees that Sphinx will use
825-
# the same path that matplotlib sees (in case of weird symlinks).
826-
_basedir = os.path.realpath(_basedir)
827-
_fullpath = os.path.join(_basedir, rcParams['examples.directory'])
828-
rcParams['examples.directory'] = _fullpath
829-
830816
rcParamsOrig = rcParams.copy()
831817

832818
rcParamsDefault = RcParams([ (key, default) for key, (default, converter) in \

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.