Skip to content

Commit f74b9b4

Browse files
committed
Cleanup sample_data.
- No need to have both Google's and Apple's stock prices, one is enough. - Replace ada.png (used once only) and grace_hopper.png by the 10x smaller grace_hopper.jpg. - Replace ct.raw.gz (CT scan example) by s1045.ima.gz (MRI example, smaller). - Remove unused None_vs_nearest-pdf.png (see also d35fc38), demodata.csv (there's still msft.csv as example csv file). Overall this make the sample_data directory ~4x smaller (down to 500K, which is smaller than nearly all the extension modules); we can perhaps now consider always shipping sample_data with Matplotlib instead of having its presence controlled by a flag.
1 parent 3b1be53 commit f74b9b4

File tree

12 files changed

+20
-23
lines changed

12 files changed

+20
-23
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
sample_data removals
2+
~~~~~~~~~~~~~~~~~~~~
3+
The sample datasets listed below have been removed. Suggested replacements for
4+
demonstration purposes are listed in parentheses.
5+
- ``None_vs_nearest-pdf.png``,
6+
- ``aapl.npz`` (use ``goog.npz``),
7+
- ``ada.png``, ``grace_hopper.png`` (use ``grace_hopper.jpg``),
8+
- ``ct.raw.gz`` (use ``s1045.ima.gz``),
9+
- ``damodata.csv`` (use ``msft.csv``).

examples/images_contours_and_fields/image_clip_path.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import matplotlib.cbook as cbook
1111

1212

13-
with cbook.get_sample_data('grace_hopper.png') as image_file:
13+
with cbook.get_sample_data('grace_hopper.jpg') as image_file:
1414
image = plt.imread(image_file)
1515

1616
fig, ax = plt.subplots()

examples/images_contours_and_fields/image_demo.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
# It is also possible to show images of pictures.
4444

4545
# A sample image
46-
with cbook.get_sample_data('ada.png') as image_file:
46+
with cbook.get_sample_data('grace_hopper.jpg') as image_file:
4747
image = plt.imread(image_file)
4848

4949
fig, ax = plt.subplots()
@@ -53,12 +53,11 @@
5353

5454
# And another image
5555

56-
w, h = 512, 512
57-
58-
with cbook.get_sample_data('ct.raw.gz') as datafile:
56+
# Data are 256x256 16-bit integers.
57+
w, h = 256, 256
58+
with cbook.get_sample_data('s1045.ima.gz') as datafile:
5959
s = datafile.read()
6060
A = np.frombuffer(s, np.uint16).astype(float).reshape((w, h))
61-
A /= A.max()
6261

6362
fig, ax = plt.subplots()
6463
extent = (0, 25, 0, 25)
@@ -68,7 +67,7 @@
6867
x, y = zip(*markers)
6968
ax.plot(x, y, 'o')
7069

71-
ax.set_title('CT density')
70+
ax.set_title('MRI')
7271

7372
plt.show()
7473

examples/text_labels_and_annotations/demo_annotation_box.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@
7878
ax.add_artist(ab)
7979

8080
# Annotate the 2nd position with another image (a Grace Hopper portrait)
81-
with get_sample_data("grace_hopper.png") as file:
82-
arr_img = plt.imread(file, format='png')
81+
with get_sample_data("grace_hopper.jpg") as file:
82+
arr_img = plt.imread(file)
8383

8484
imagebox = OffsetImage(arr_img, zoom=0.2)
8585
imagebox.image.axes = ax

examples/text_labels_and_annotations/demo_text_path.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def draw(self, renderer=None):
5252

5353
# EXAMPLE 1
5454

55-
arr = plt.imread(get_sample_data("grace_hopper.png"))
55+
arr = plt.imread(get_sample_data("grace_hopper.jpg"))
5656

5757
text_path = TextPath((0, 0), "!?", size=150)
5858
p = PathClippedImagePatch(text_path, arr, ec="k",

examples/ticks_and_spines/centered_ticklabels.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
import matplotlib.ticker as ticker
2424
import matplotlib.pyplot as plt
2525

26-
# load some financial data; apple's stock price
27-
r = (cbook.get_sample_data('aapl.npz', np_load=True)['price_data']
26+
# load some financial data; Google's stock price
27+
r = (cbook.get_sample_data('goog.npz', np_load=True)['price_data']
2828
.view(np.recarray))
2929
r = r[-250:] # get the last 250 days
3030

Binary file not shown.
-105 KB
Binary file not shown.
-301 KB
Binary file not shown.
-250 KB
Binary file not shown.

lib/matplotlib/mpl-data/sample_data/demodata.csv

-11
This file was deleted.
Binary file not shown.

0 commit comments

Comments
 (0)