8000 updated image to work with data coords; moved image extendsion to _image · matplotlib/matplotlib@3d9c781 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3d9c781

Browse files
committed
updated image to work with data coords; moved image extendsion to _image
svn path=/trunk/matplotlib/; revision=179
1 parent 1ec2767 commit 3d9c781

File tree

9 files changed

+40
-580
lines changed

9 files changed

+40
-580
lines changed

MANIFEST

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ examples/figtext.py
269269
examples/ftface_props.py
270270
examples/gdtest.py
271271
examples/histogram_demo.py
272+
examples/image_demo.py
272273
examples/interactive.py
273274
examples/interactive2.py
274275
examples/legend_demo.py
@@ -300,6 +301,7 @@ examples/vertical_ticklabels.py
300301
examples/vline_demo.py
301302
examples/data/AAPL.dat
302303
examples/data/INTC.dat
304+
examples/data/ct.raw
303305
examples/data/eeg.dat
304306
examples/data/intc.csv
305307
examples/data/membrane.dat
@@ -395,6 +397,7 @@ matplotlib/backend_bases.py
395397
matplotlib/cbook.py
396398
matplotlib/colors.py
397399
matplotlib/figure.py
400+
matplotlib/image.py
398401
matplotlib/legend.py
399402
matplotlib/lines.py
400403
matplotlib/mathtext.py
@@ -423,6 +426,8 @@ src/_backend_agg.cpp
423426
src/_backend_agg.h
424427
src/_gtkagg.cpp
425428
src/_gtkgd.c
429+
src/_image.cpp
430+
src/_image.h
426431
src/_tkagg.cpp
427432
src/ft2font.c
428433
src/ft2font.h

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
# Copyright (C) 2003 <jdhunter@ace.bsd.uchicago.edu>
33
# $Header$
44
# $Log$
5+
# Revision 1.25 2004/03/15 14:49:46 jdh2358
6+
# updated image to work with data coords; moved image extendsion to _image
7+
#
58
# Revision 1.24 2004/03/08 14:56:44 jdh2358
69
# fixed subplot bug
710
#
@@ -101,6 +104,7 @@ MODULES = \
101104
matplotlib.cbook \
102105
matplotlib.colors \
103106
matplotlib.figure \
107+
matplotlib.image \
104108
matplotlib.legend \
105109
matplotlib.lines \
106110
matplotlib.matlab \

NUMARRAY_ISSUES

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ Below is a status report of known issues
1313

1414
TypeError: unsupported operand type(s) for /: 'NumArray' and 'float'"
1515

16-
Solution: use divide(-t, 2.0)
16+
Solution: use numarray 0.9 or later; for older versions, use
17+
divide(-t, 2.0)
1718

1819
* stock demo does not run with "TypeError: unsubscriptable object"
1920

examples/image_demo.py

Lines changed: 25 additions & 17 deletions
4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from matplotlib.image import ASPECT_FREE, ASPECT_PRESERVE
2-
from matplotlib.image import NEAREST, BILINEAR, BICUBIC, SPLINE16
31
from matplotlib.matlab import *
2

53
w, h = 512, 512
@@ -8,23 +6,33 @@
86
A *= 1.0/max(A)
97
A.shape = w, h
108

11-
12-
figure(1, figsize=(2,7))
13-
subplot(211)
9+
markers = [(15.9, 14.5), (16.8, 15)]
10+
x,y = zip(*markers)
11+
#figure(1, figsize=(2,7))
12+
#pyt subplot(211)
1413
im = imshow(A)
15-
#im.set_interpolation(BICUBIC)
16-
#im.set_interpolation(NEAREST)
17-
im.set_interpolation(BILINEAR)
18-
#im.set_preserve_aspect(ASPECT_PRESERVE)
19-
set(gca(), 'xlim', [0,h-1])
20-
axis('off')
14+
im.set_datalimx(0,25)
15+
im.set_datalimy(0,25)
16+
#im.set_interpolation('bicubic')
17+
#im.set_interpolation('nearest')
18+
im.set_interpolation('bilinear')
19+
#im.set_aspect('free')
20+
im.set_aspect('preserve')
21+
print x, y
22+
plot(x, y, 'o')
23+
axis([0,25,0,25])
24+
25+
26+
27+
#axis('off')
2128
title('CT density')
2229

23-
x = sum(A,0)
24-
subplot(212)
25-
bar(arange(w), x)
26-
set(gca(), 'xlim', [0,h-1])
27-
ylabel('density')
28-
set(gca(), 'xticklabels', [])
30+
if 0:
31+
x = sum(A,0)
32+
subplot(212)
33+
bar(arange(w), x)
34+
set(gca(), 'xlim', [0,h-1])
35+
ylabel('density')
36+
set(gca(), 'xticklabels', [])
2937
show()
3038

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999

100100

101101
setup(name="matplotlib",
102-
version= '0.52b',
102+
version= '0.52c',
103103
description = "Matlab style python plotting package",
104104
author = "John D. Hunter",
105105
author_email="jdhunter@ace.bsd.uchicago.edu",

setupext.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,11 +232,11 @@ def build_image(ext_modules, packages):
232232
global BUILT_IMAGE
233233
if BUILT_IMAGE: return # only build it if you you haven't already
234234

235-
deps = ['src/image.cpp']
235+
deps = ['src/_image.cpp']
236236
deps.extend(glob.glob('agg2/src/*.cpp'))
237237

238238
module = Extension(
239-
'matplotlib.image',
239+
'matplotlib._image',
240240
deps
241241
,
242242
)

src/_backend_agg.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include <png.h>
33
#include "ft2font.h"
44
#include "_backend_agg.h"
5-
#include "image.h"
5+
#include "_image.h"
66

77
static PyObject *ErrorObject;
88

0 commit comments

Comments
 (0)
0