Revision: 5323
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5323&view=rev
Author: jdh2358
Date: 2008年05月30日 10:09:53 -0700 (2008年5月30日)
Log Message:
-----------
updated hst and other demos
Modified Paths:
--------------
trunk/htdocs/screenshots/align_text_large.png
trunk/htdocs/screenshots/align_text_small.png
trunk/htdocs/screenshots/axes_demo_large.png
trunk/htdocs/screenshots/axes_demo_small.png
trunk/htdocs/screenshots/barchart_demo_large.png
trunk/htdocs/screenshots/barchart_demo_small.png
trunk/htdocs/screenshots/date_demo_large.png
trunk/htdocs/screenshots/date_demo_small.png
trunk/htdocs/screenshots/fill_demo_large.png
trunk/htdocs/screenshots/fill_demo_small.png
trunk/htdocs/screenshots/finance_work2.py
trunk/htdocs/screenshots/finance_work2_large.png
trunk/htdocs/screenshots/finance_work2_small.png
trunk/htdocs/screenshots/histogram_demo_large.png
trunk/htdocs/screenshots/histogram_demo_small.png
trunk/htdocs/screenshots/hstdemo.py
trunk/htdocs/screenshots/layer_images_large.png
trunk/htdocs/screenshots/layer_images_small.png
trunk/htdocs/screenshots/legend_demo_large.png
trunk/htdocs/screenshots/legend_demo_small.png
trunk/htdocs/screenshots/log_shot_large.png
trunk/htdocs/screenshots/log_shot_small.png
trunk/htdocs/screenshots/makeshots.py
trunk/htdocs/screenshots/mathtext_demo_large.png
trunk/htdocs/screenshots/mathtext_demo_small.png
trunk/htdocs/screenshots/mathtext_examples.py
trunk/htdocs/screenshots/mri_with_eeg.py
trunk/htdocs/screenshots/mri_with_eeg_large.png
trunk/htdocs/screenshots/mri_with_eeg_small.png
trunk/htdocs/screenshots/pcolor_demo_large.png
trunk/htdocs/screenshots/pcolor_demo_small.png
trunk/htdocs/screenshots/pfm-lsm.png
trunk/htdocs/screenshots/pie_demo_large.png
trunk/htdocs/screenshots/pie_demo_small.png
trunk/htdocs/screenshots/plotmap_large.png
trunk/htdocs/screenshots/plotmap_small.png
trunk/htdocs/screenshots/polar_demo.py
trunk/htdocs/screenshots/polar_demo_large.png
trunk/htdocs/screenshots/polar_demo_small.png
trunk/htdocs/screenshots/scatter_demo2_large.png
trunk/htdocs/screenshots/scatter_demo2_small.png
trunk/htdocs/screenshots/simple_plot_large.png
trunk/htdocs/screenshots/simple_plot_small.png
trunk/htdocs/screenshots/slider_demo_large.png
trunk/htdocs/screenshots/slider_demo_small.png
trunk/htdocs/screenshots/table_demo.py
trunk/htdocs/screenshots/table_demo_large.png
trunk/htdocs/screenshots/table_demo_small.png
trunk/htdocs/screenshots/tex_demo_large.png
trunk/htdocs/screenshots/tex_demo_small.png
trunk/htdocs/screenshots/text_themes_large.png
trunk/htdocs/screenshots/text_themes_small.png
trunk/htdocs/screenshots/wheeler_demo_large.png
trunk/htdocs/screenshots/wheeler_demo_small.png
Modified: trunk/htdocs/screenshots/align_text_large.png
===================================================================
(Binary files differ)
Modified: trunk/htdocs/screenshots/align_text_small.png
===================================================================
(Binary files differ)
Modified: trunk/htdocs/screenshots/axes_demo_large.png
===================================================================
(Binary files differ)
Modified: trunk/htdocs/screenshots/axes_demo_small.png
===================================================================
(Binary files differ)
Modified: trunk/htdocs/screenshots/barchart_demo_large.png
===================================================================
(Binary files differ)
Modified: trunk/htdocs/screenshots/barchart_demo_small.png
===================================================================
(Binary files differ)
Modified: trunk/htdocs/screenshots/date_demo_large.png
===================================================================
(Binary files differ)
Modified: trunk/htdocs/screenshots/date_demo_small.png
===================================================================
(Binary files differ)
Modified: trunk/htdocs/screenshots/fill_demo_large.png
===================================================================
(Binary files differ)
Modified: trunk/htdocs/screenshots/fill_demo_small.png
===================================================================
(Binary files differ)
Modified: trunk/htdocs/screenshots/finance_work2.py
===================================================================
--- trunk/htdocs/screenshots/finance_work2.py 2008年05月30日 16:58:02 UTC (rev 5322)
+++ trunk/htdocs/screenshots/finance_work2.py 2008年05月30日 17:09:53 UTC (rev 5323)
@@ -82,9 +82,9 @@
rect2 = [left, 0.3, width, 0.4]
rect3 = [left, 0.1, width, 0.2]
axUpper = axes(rect1, axisbg=axesBG) #left, bottom, width, height
-axMiddle = axes(rect2, axisbg=axesBG)
-axMiddleVol = axes(rect2, axisbg=axesBG, frameon=False) # the volume overlay
-axLower = axes(rect3, axisbg=axesBG)
+axMiddle = axes(rect2, axisbg=axesBG, sharex=axUpper)
+axMiddleVol = axes(rect2, axisbg=axesBG, frameon=False, sharex=axUpper) # the volume overlay
+axLower = axes(rect3, axisbg=axesBG, sharex=axUpper)
axUpper.xaxis.set_major_locator( get_locator() )
@@ -145,7 +145,7 @@
if 1: ############### Middle axes #################
#plot_day_summary2(axMiddle, opens, closes, highs, lows)
- candlestick2(axMiddle, opens, closes, highs, lows)
+ candlestick2(axMiddle, opens, closes, highs, lows, width=0.9)
# specify the text in axes (0,1) coords. 0,0 is lower left and 1,1 is
# upper right
@@ -215,7 +215,11 @@
allAxes = (axUpper, axMiddle, axMiddleVol, axLower)
xlim = 0, len(quotes)
for a in allAxes:
- a.dataLim.intervalx().set_bounds(*xlim)
+ #a.dataLim.intervalx = xlim
a.set_xlim(xlim)
+for ax in axUpper, axMiddle:
+ for ticklabel in ax.get_xticklabels():
+ ticklabel.set_visible(False)
+
show()
Modified: trunk/htdocs/screenshots/finance_work2_large.png
===================================================================
(Binary files differ)
Modified: trunk/htdocs/screenshots/finance_work2_small.png
===================================================================
(Binary files differ)
Modified: trunk/htdocs/screenshots/histogram_demo_large.png
===================================================================
(Binary files differ)
Modified: trunk/htdocs/screenshots/histogram_demo_small.png
===================================================================
(Binary files differ)
Modified: trunk/htdocs/screenshots/hstdemo.py
===================================================================
--- trunk/htdocs/screenshots/hstdemo.py 2008年05月30日 16:58:02 UTC (rev 5322)
+++ trunk/htdocs/screenshots/hstdemo.py 2008年05月30日 17:09:53 UTC (rev 5323)
@@ -1,73 +1,61 @@
"""Demo of image with contour overlay
-This demo displays an HST image of NGC 1275 taken with three different
-filters combined as an RGB image with contours of an aligned Chandra
-X-Ray image (smoothed) of the same object overplotted
+This demo displays an HST image of NGC 1275 taken with three different filters
+combined as an RGB image with contours of an aligned Chandra X-Ray image (smoothed)
+of the same object overplotted
-The data for the images are stored as simple binary files and the
-necessary shape and type info is added by the loaddata function (as
-well as decompression for the HST image).
+The data for the images are stored as simple binary files and the necessary shape
+and type info is added by the loaddata function (as well as decompression for the
+HST image).
-The demo creates a figure window that is the size of the HST image in
-pixels so that no resampling is done, scales the plot window (axes) to
-fill the figure window. Resizing the window will modify the aspect
-ratio, but correspondence between the HST image and contour image will
-always be correct
+The demo creates a figure window that is the size of the HST image in pixels so that
+no resampling is done, scales the plot window (axes) to fill the figure window.
+Resizing the window will modify the aspect ratio, but correspondence between the
+HST image and contour image will always be correct
-The HST image was obtained from the Hubble Heritage web pages
+The HST image was obtained from the Hubble Heritage web pages
(http://heritage.stsci.edu/2003/14/index.html)
(Credits: NASA and The Hubble Heritage Team (STScI/AURA))
The Chandra image was obtained from the Chandra web site
http://chandra.harvard.edu/photo/2000/perseus/index.html
(Credits: NASA/CXC/SAo)
"""
-from pylab import *
-import matplotlib.cm as cm
-import matplotlib.numerix as n
-import zlib
-import sys
+import sys, zlib
+import numpy as np
+import matplotlib.pyplot as plt
-from pylab import savefig
-
-def load_hst_data():
+def loaddata():
"""reconstruct the numerix arrays from the data files"""
-
- #hst = n.fromfile('hst.dat',typecode=n.UInt8, shape=(812,592,3))/255.
-
- str = open('data/hst.zdat').read()
- dstr = zlib.decompress(str)
- hst = n.fromstring(dstr, n.UInt8)
+ #hst = np.fromfile('hst.dat',typecode=np.UInt8, shape=(812,592,3))/255.
+ s = file('hst.zdat').read()
+ dstr = zlib.decompress(s)
+ hst = np.fromstring(dstr, np.uint8)
hst.shape = (812, 592, 3)
hst = hst/255.
- str = open('data/chandra.dat').read()
- chandra = n.fromstring(str, n.Int16)
+ s = file('chandra.dat').read()
+ chandra = np.fromstring(s, np.int16)
chandra.shape = (812,592)
if sys.byteorder == 'little':
- chandra = chandra.byteswapped()
-
+ chandra = chandra.byteswap()
# note that both HST and Chandra data are normalized to be between 0 and 1
return hst, chandra/16000.
def hstdemo():
- rc('image',origin='lower') # correct display requires setting origin to this
- hst, chandra = load_hst_data()
+ plt.rc('image',origin='lower') # correct display requires setting origin to this
+ hst, chandra = loaddata()
# set size of figure window to be exactly that of the image so no resampling is done
h, w, d = hst.shape
dpi=80.
- figure(figsize=(w/dpi, h/dpi), dpi=dpi)
+ plt.figure(figsize=(w/dpi, h/dpi), dpi=dpi)
# set plot region to full window size
- axes((0,0,1,1))
+ plt.axes((0,0,1,1))
# display rgb HST image
- imshow(hst)
+ plt.imshow(hst)
# overplot X-ray contour map
- contour(chandra, [.95,.85, .6], linewidths=2, cmap=cm.hot)
- clim(0,1.1)
- legend(loc='lower right')
- text(160, 75, 'HST image of NGC 1275\n with Chandra X-Ray contours',
+ plt.contour(chandra, [.95,.85, .6])
+ plt.legend()
+ plt.text(160, 75, 'HST image of NGC 1275\n with Chandra X-Ray contours',
color='white', size=22)
-
-
hstdemo()
-savefig('hstdemo')
-show()
+plt.show()
Modified: trunk/htdocs/screenshots/layer_images_large.png
===================================================================
(Binary files differ)
Modified: trunk/htdocs/screenshots/layer_images_small.png
===================================================================
(Binary files differ)
Modified: trunk/htdocs/screenshots/legend_demo_large.png
===================================================================
(Binary files differ)
Modified: trunk/htdocs/screenshots/legend_demo_small.png
===================================================================
(Binary files differ)
Modified: trunk/htdocs/screenshots/log_shot_large.png
===================================================================
(Binary files differ)
Modified: trunk/htdocs/screenshots/log_shot_small.png
===================================================================
(Binary files differ)
Modified: trunk/htdocs/screenshots/makeshots.py
===================================================================
--- trunk/htdocs/screenshots/makeshots.py 2008年05月30日 16:58:02 UTC (rev 5322)
+++ trunk/htdocs/screenshots/makeshots.py 2008年05月30日 17:09:53 UTC (rev 5323)
@@ -32,6 +32,7 @@
'pie_demo.py' : default,
'plotmap.py' : default,
'hstdemo.py' : default,
+ 'path_patch_demo.py' : default,
}
Modified: trunk/htdocs/screenshots/mathtext_demo_large.png
===================================================================
(Binary files differ)
Modified: trunk/htdocs/screenshots/mathtext_demo_small.png
===================================================================
(Binary files differ)
Modified: trunk/htdocs/screenshots/mathtext_examples.py
===================================================================
--- trunk/htdocs/screenshots/mathtext_examples.py 2008年05月30日 16:58:02 UTC (rev 5322)
+++ trunk/htdocs/screenshots/mathtext_examples.py 2008年05月30日 17:09:53 UTC (rev 5323)
@@ -40,7 +40,7 @@
r"$f^'$",
r'$\frac{x_2888}{y}$',
r"$\sqrt[3]{\frac{X_2}{Y}}=5$",
- r"$\sqrt[5x\pi]{\prod^\frac{x}{2\pi^2}_\infty}$",
+ r"$\sqrt[5]{\prod^\frac{x}{2\pi^2}_\infty}$",
r"$\sqrt[3]{x}=5$",
r'$\frac{X}{\frac{X}{Y}}$',
# From UTR #25
@@ -49,7 +49,7 @@
r'$\widehat{abc}\widetilde{def}$',
r'$\Gamma \Delta \Theta \Lambda \Xi \Pi \Sigma \Upsilon \Phi \Psi \Omega$',
r'$\alpha \beta \gamma \delta \epsilon \zeta \eta \theta \iota \lambda \mu \nu \xi \pi \kappa \rho \sigma \tau \upsilon \phi \chi \psi$',
- #ur'Generic symbol: $\u23ce \mathrm{\ue0f2 \U0001D538}$'
+ ur'Generic symbol: $\u23ce \mathrm{\ue0f2 \U0001D538}$'
]
from pylab import *
Modified: trunk/htdocs/screenshots/mri_with_eeg.py
===================================================================
--- trunk/htdocs/screenshots/mri_with_eeg.py 2008年05月30日 16:58:02 UTC (rev 5322)
+++ trunk/htdocs/screenshots/mri_with_eeg.py 2008年05月30日 17:09:53 UTC (rev 5323)
@@ -4,24 +4,21 @@
faster*
"""
from __future__ import division
-import numpy
-
from pylab import *
from matplotlib.lines import Line2D
-from matplotlib.transforms import get_bbox_transform, Point, Value, Bbox,\
- unit_bbox
+from matplotlib.transforms import Bbox, BboxTransform, BboxTransformTo, Affine2D
# I use if 1 to break up the different regions of code visually
if 1: # load the data
# data are 256x256 16 bit integers
dfile = 'data/s1045.ima'
- im = fromstring(file(dfile, 'rb').read(), numpy.uint16).astype(numpy.float)
+ im = fromstring(file(dfile, 'rb').read(), uint16).astype(float)
im.shape = 256, 256
if 1: # plot the MRI in pcolor
subplot(221)
- imshow(im)
+ imshow(im, cmap=cm.jet)
axis('off')
if 1: # plot the histogram of MRI intensity
@@ -30,44 +27,39 @@
im = take(im, nonzero(im)) # ignore the background
im = im/(2.0**15) # normalize
hist(im, 100)
- xticks([])
+ xticks([-1, -.5, 0, .5, 1])
yticks([])
xlabel('intensity')
ylabel('MRI density')
if 1: # plot the EEG
# load the data
+
numSamples, numRows = 800,4
- data = fromstring(file('data/eeg.dat', 'rb').read(), numpy.float)
+ data = fromstring(file('data/eeg.dat', 'rb').read(), float)
data.shape = numSamples, numRows
t = arange(numSamples)/float(numSamples)*10.0
ticklocs = []
ax = subplot(212)
+ xlim(0,10)
+ xticks(arange(10))
- boxin = Bbox(
- Point(ax.viewLim.ll().x(), Value(-20)),
- Point(ax.viewLim.ur().x(), Value(20)))
+ boxin = Bbox.from_extents(ax.viewLim.x0, -20, ax.viewLim.x1, 20)
+ height = ax.bbox.height
+ boxout = Bbox.from_extents(ax.bbox.x0, -1.0 * height,
+ ax.bbox.x1, 1.0 * height)
- height = ax.bbox.ur().y() - ax.bbox.ll().y()
- boxout = Bbox(
- Point(ax.bbox.ll().x(), Value(-1)*height),
- Point(ax.bbox.ur().x(), Value(1) * height))
+ transOffset = BboxTransformTo(
+ Bbox.from_extents(0.0, ax.bbox.y0, 1.0, ax.bbox.y1))
- transOffset = get_bbox_transform(
- unit_bbox(),
- Bbox( Point( Value(0), ax.bbox.ll().y()),
- Point( Value(1), ax.bbox.ur().y())
- ))
-
-
for i in range(numRows):
# effectively a copy of transData
- trans = get_bbox_transform(boxin, boxout)
+ trans = BboxTransform(boxin, boxout)
offset = (i+1)/(numRows+1)
- trans.set_offset( (0, offset), transOffset)
+ trans += Affine2D().translate(*transOffset.transform_point((0, offset)))
thisLine = Line2D(
t, data[:,i]-data[0,i],
@@ -78,11 +70,8 @@
ax.add_line(thisLine)
ticklocs.append(offset)
- xlim(0,10)
- xticks(arange(10))
+ setp(gca(), 'yticklabels', ['PG3', 'PG5', 'PG7', 'PG9'])
- yticks(ticklocs, ['PG3', 'PG5', 'PG7', 'PG9'])
-
# set the yticks to use axes coords on the y axis
ax.set_yticks(ticklocs)
for tick in ax.yaxis.get_major_ticks():
Modified: trunk/htdocs/screenshots/mri_with_eeg_large.png
===================================================================
(Binary files differ)
Modified: trunk/htdocs/screenshots/mri_with_eeg_small.png
===================================================================
(Binary files differ)
Modified: trunk/htdocs/screenshots/pcolor_demo_large.png
===================================================================
(Binary files differ)
Modified: trunk/htdocs/screenshots/pcolor_demo_small.png
===================================================================
(Binary files differ)
Modified: trunk/htdocs/screenshots/pfm-lsm.png
===================================================================
(Binary files differ)
Modified: trunk/htdocs/screenshots/pie_demo_large.png
===================================================================
(Binary files differ)
Modified: trunk/htdocs/screenshots/pie_demo_small.png
===================================================================
(Binary files differ)
Modified: trunk/htdocs/screenshots/plotmap_large.png
===================================================================
--- trunk/htdocs/screenshots/plotmap_large.png 2008年05月30日 16:58:02 UTC (rev 5322)
+++ trunk/htdocs/screenshots/plotmap_large.png 2008年05月30日 17:09:53 UTC (rev 5323)
@@ -1,4333 +1,4195 @@
\x89PNG