File tree Expand file tree Collapse file tree 1 file changed +16
-19
lines changed Expand file tree Collapse file tree 1 file changed +16
-19
lines changed Original file line number Diff line number Diff line change 1
- #!/usr/bin/env python
2
-
3
1
from __future__ import print_function
4
- from pylab import *
2
+ # from pylab import *
3
+ import matplotlib .pyplot as plt
4
+ import numpy as np
5
5
import matplotlib .cbook as cbook
6
6
7
7
w , h = 512 , 512
8
8
9
9
datafile = cbook .get_sample_data ('ct.raw.gz' , asfileobj = True )
10
10
s = datafile .read ()
11
- A = fromstring (s , uint16 ).astype (float )
12
- A *= 1.0 / max (A )
11
+ A = np . fromstring (s , np . uint16 ).astype (float )
12
+ A *= 1.0 / max (A )
13
13
A .shape = w , h
14
14
15
15
extent = (0 , 25 , 0 , 25 )
16
- im = imshow (A , cmap = cm .hot , origin = 'upper' , extent = extent )
16
+ im = plt . imshow (A , cmap = plt . cm .hot , origin = 'upper' , extent = extent )
17
17
18
18
markers = [(15.9 , 14.5 ), (16.8 , 15 )]
19
19
x , y = zip (* markers )
20
- plot (x , y , 'o' )
21
- #axis([0,25,0,25])
22
-
20
+ plt .plot (x , y , 'o' )
23
21
24
- #axis('off')
25
- title ('CT density' )
22
+ plt .title ('CT density' )
26
23
27
24
if 0 :
28
- x = asum (A , 0 )
29
- subplot (212 )
30
- bar (arange (w ), x )
31
- xlim (0 , h - 1 )
32
- ylabel ('density' )
33
- setp (gca (), 'xticklabels' , [])
34
-
35
- show ()
25
+ x = np . asum (A , 0 )
26
+ plt . subplot (212 )
27
+ plt . bar (np . arange (w ), x )
28
+ plt . xlim (0 , h - 1 )
29
+ plt . ylabel ('density' )
30
+ # setp(gca(), 'xticklabels', [])
31
+ plt . xticklabels ([])
32
+ plt . show ()
You can’t perform that action at this time.
0 commit comments