SF.net SVN: matplotlib: [4479] trunk/toolkits/basemap/examples/hurrtracks. py
Revision: 4479
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4479&view=rev
Author: jswhit
Date: 2007-11-28 04:34:04 -0800 (Wed, 28 Nov 2007)
Log Message:
---
use fill_color kwarg to mapboundary to color oceans (instead of axes background)
Modified Paths:
--
trunk/toolkits/basemap/examples/hurrtracks.py
Modified: trunk/toolkits/basemap/examples/hurrtracks.py
===
--- trunk/toolkits/basemap/examples/hurrtracks.py 2007-11-28 02:48:38 UTC
(rev 4478)
+++ trunk/toolkits/basemap/examples/hurrtracks.py 2007-11-28 12:34:04 UTC
(rev 4479)
@@ -9,9 +9,8 @@
m = Basemap(llcrnrlon=-100.,llcrnrlat=0.,urcrnrlon=-20.,urcrnrlat=57.,
projection='lcc',lat_1=20.,lat_2=40.,lon_0=-60.,
resolution ='l',area_thresh=1000.)
-# create figure, add axes.
+# create figure.
fig=p.figure()
-fig.add_axes([0.1,0.1,0.8,0.8],axisbg='#99')
# read shapefile.
shp_info = m.readshapefile('huralll020','hurrtracks',drawbounds=False)
print shp_info
@@ -39,7 +38,8 @@
# draw coastlines, meridians and parallels.
m.drawcoastlines()
m.drawcountries()
-m.fillcontinents(color='#cc9966')
+m.drawmapboundary(fill_color='#99')
+m.fillcontinents(color='#cc9966',lake_color='#99')
m.drawparallels(p.arange(10,70,20),labels=[1,1,0,0])
m.drawmeridians(p.arange(-100,0,20),labels=[0,0,0,1])
p.title('Atlantic Hurricane Tracks (Storms Reaching Category 4, 1851-2004)')
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4480] branches/transforms/src/_backend_agg.cpp
Revision: 4480
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4480&view=rev
Author: mdboom
Date: 2007-11-28 05:40:54 -0800 (Wed, 28 Nov 2007)
Log Message:
---
Fix marker drawing bug, and improve speed (by using buffers on the
stack if possible).
Modified Paths:
--
branches/transforms/src/_backend_agg.cpp
Modified: branches/transforms/src/_backend_agg.cpp
===
--- branches/transforms/src/_backend_agg.cpp2007-11-28 12:34:04 UTC (rev
4479)
+++ branches/transforms/src/_backend_agg.cpp2007-11-28 13:40:54 UTC (rev
4480)
@@ -462,6 +462,8 @@
return has_clippath;
}
+#define MARKER_CACHE_SIZE 512
+
Py::Object
RendererAgg::draw_markers(const Py::Tuple& args) {
typedef agg::conv_transform transformed_path_t;
@@ -505,6 +507,8 @@
agg::scanline_storage_aa8 scanlines;
theRasterizer->reset();
+ agg::int8u staticFillCache[MARKER_CACHE_SIZE];
+ agg::int8u staticStrokeCache[MARKER_CACHE_SIZE];
agg::int8u* fillCache = NULL;
agg::int8u* strokeCache = NULL;
@@ -514,7 +518,10 @@
theRasterizer->add_path(marker_path_curve);
agg::render_scanlines(*theRasterizer, *slineP8, scanlines);
fillSize = scanlines.byte_size();
- fillCache = new agg::int8u[fillSize]; // or any container
+ if (fillSize < MARKER_CACHE_SIZE)
+ fillCache = staticFillCache;
+ else
+ fillCache = new agg::int8u[fillSize];
scanlines.serialize(fillCache);
}
@@ -526,7 +533,10 @@
theRasterizer->add_path(stroke);
agg::render_scanlines(*theRasterizer, *slineP8, scanlines);
unsigned strokeSize = scanlines.byte_size();
-strokeCache = new agg::int8u[strokeSize]; // or any container
+if (strokeSize < MARKER_CACHE_SIZE)
+ strokeCache = staticStrokeCache;
+else
+ strokeCache = new agg::int8u[strokeSize];
scanlines.serialize(strokeCache);
theRasterizer->reset_clipping();
@@ -539,52 +549,44 @@
agg::serialized_scanlines_adaptor_aa8 sa;
agg::serialized_scanlines_adaptor_aa8::embedded_scanline sl;
-if (face.first) {
- // render the fill
+while (path_quantized.vertex(&x, &y) != agg::path_cmd_stop) {
if (has_clippath) {
pixfmt_amask_type pfa(*pixFmt, *alphaMask);
amask_ren_type r(pfa);
amask_aa_renderer_type ren(r);
- ren.color(face.second);
- while (path_quantized.vertex(&x, &y) != agg::path_cmd_stop) {
+
+ if (face.first) {
+ ren.color(face.second);
sa.init(fillCache, fillSize, x, y);
agg::render_scanlines(sa, sl, ren);
}
+ ren.color(gc.color);
+ sa.init(strokeCache, strokeSize, x, y);
+ agg::render_scanlines(sa, sl, ren);
} else {
- rendererAA->color(face.second);
- while (path_quantized.vertex(&x, &y) != agg::path_cmd_stop) {
+ if (face.first) {
+ rendererAA->color(face.second);
sa.init(fillCache, fillSize, x, y);
agg::render_scanlines(sa, sl, *rendererAA);
}
- }
- path_quantized.rewind(0);
-}
-//render the stroke
-if (has_clippath) {
- pixfmt_amask_type pfa(*pixFmt, *alphaMask);
- amask_ren_type r(pfa);
- amask_aa_renderer_type ren(r);
- ren.color(gc.color);
- while (path_quantized.vertex(&x, &y) != agg::path_cmd_stop) {
+ rendererAA->color(gc.color);
sa.init(strokeCache, strokeSize, x, y);
- agg::render_scanlines(sa, sl, ren);
- }
-} else {
- rendererAA->color(gc.color);
- while (path_quantized.vertex(&x, &y) != agg::path_cmd_stop) {
- sa.init(strokeCache, strokeSize, x, y);
agg::render_scanlines(sa, sl, *rendererAA);
}
}
} catch(...) {
-delete[] fillCache;
-delete[] strokeCache;
+if (fillCache != staticFillCache)
+ delete[] fillCache;
+if (strokeCache != staticStrokeCache)
+ delete[] strokeCache;
throw;
}
- delete [] fillCache;
- delete [] strokeCache;
+ if (fillCache != staticFillCache)
+delete[] fillCache;
+ if (strokeCache != staticStrokeCache)
+delete[] strokeCache;
return Py::Object();
@@ -945,9 +947,6 @@
size_t i = 0;
// Convert all of the transforms up front
-master_transform *= agg::trans_affine_scaling(1.0, -1.0);
-master_transform *= agg::trans_affine_translation(0.0, (double)height);
-
typedef std::vector transforms_t;
transforms_t transforms;
transforms.reserve(Ntransforms);
@@ -955,6 +954,7 @@
agg::trans_affine trans = py_to_agg_transformation_matrix
(transforms_obj[i], false);
trans *= master_transform;
+
transforms.push_back(trans);
}
@@ -996,6 +996,10 @@
trans *= agg::trans_affine_translation(xo, yo);
}
+ // These transformations must be done post-offsets
+ trans *= agg::trans_affine_scaling(1.0, -1.0);
+ trans *= agg::trans_affine_
SF.net SVN: matplotlib: [4481] branches/transforms
Revision: 4481
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4481&view=rev
Author: mdboom
Date: 2007-11-28 05:42:39 -0800 (Wed, 28 Nov 2007)
Log Message:
---
Major speed improvements for auto-placing of legends.
Modified Paths:
--
branches/transforms/lib/matplotlib/legend.py
branches/transforms/lib/matplotlib/lines.py
branches/transforms/lib/matplotlib/path.py
branches/transforms/lib/matplotlib/transforms.py
branches/transforms/src/_path.cpp
Modified: branches/transforms/lib/matplotlib/legend.py
===
--- branches/transforms/lib/matplotlib/legend.py2007-11-28 13:40:54 UTC
(rev 4480)
+++ branches/transforms/lib/matplotlib/legend.py2007-11-28 13:42:39 UTC
(rev 4481)
@@ -36,33 +36,6 @@
from text import Text
from transforms import Affine2D, Bbox, BboxTransformTo
-def line_cuts_bbox(line, bbox):
-""" Return True if and only if line cuts bbox. """
-minx, miny, width, height = bbox.bounds
-maxx = minx + width
-maxy = miny + height
-
-n = len(line)
-if n == 0:
-return False
-
-if n == 1:
-return bbox.contains(line[0][0], line[0][1])
-p1 = line[0]
-for p2 in line[1:]:
-segment = (p1, p2)
-# See if the segment cuts any of the edges of bbox
-for edge in (((minx, miny), (minx, maxy)),
- ((minx, miny), (maxx, miny)),
- ((maxx, miny), (maxx, maxy)),
- ((minx, maxy), (maxx, maxy))):
-if segments_intersect(segment, edge):
-return True
-p1=p2
-
-return False
-
-
class Legend(Artist):
"""
Place a legend on the axes at location loc. Labels are a
@@ -344,11 +317,11 @@
for handle in ax.lines:
assert isinstance(handle, Line2D)
-data = handle.get_xydata()
+path = handle.get_path()
trans = handle.get_transform()
-tdata = trans.transform(data)
-averts = inverse_transform.transform(tdata)
-lines.append(averts)
+tpath = trans.transform_path(path)
+apath = inverse_transform.transform_path(tpath)
+lines.append(apath)
for handle in ax.patches:
assert isinstance(handle, Patch)
@@ -435,7 +408,7 @@
badness = legendBox.count_contains(verts)
badness += legendBox.count_overlaps(bboxes)
for line in lines:
-if line_cuts_bbox(line, legendBox):
+if line.intersects_bbox(legendBox):
badness += 1
ox, oy = l-tx, b-ty
Modified: branches/transforms/lib/matplotlib/lines.py
===
--- branches/transforms/lib/matplotlib/lines.py 2007-11-28 13:40:54 UTC (rev
4480)
+++ branches/transforms/lib/matplotlib/lines.py 2007-11-28 13:42:39 UTC (rev
4481)
@@ -285,6 +285,7 @@
self._xorig = npy.asarray([])
self._yorig = npy.asarray([])
+self._invalid = True
self.set_data(xdata, ydata)
def contains(self, mouseevent):
@@ -353,7 +354,7 @@
def get_window_extent(self, renderer):
bbox = Bbox.unit()
-bbox.update_from_data_xy(self.get_transform().transform(self._xy),
+
bbox.update_from_data_xy(self.get_transform().transform(self.get_xydata()),
ignore=True)
# correct for marker size, if any
if self._marker is not None:
@@ -394,9 +395,10 @@
(y.shape != self._yorig.shape or npy.any(y != self._yorig:
self._xorig = x
self._yorig = y
-self.recache()
+self._invalid = True
else:
-self._transformed_path._invalid =
self._transformed_path.INVALID_NON_AFFINE
+if hasattr(self, "_transformed_path"):
+self._transformed_path._invalid =
self._transformed_path.INVALID_NON_AFFINE
def recache(self):
#if self.axes is None: print 'recache no axes'
@@ -434,6 +436,7 @@
self._path = Path(self._xy)
self._transformed_path = TransformedPath(self._path,
self.get_transform())
+self._invalid = False
def set_transform(self, t):
"""
@@ -442,7 +445,8 @@
ACCEPTS: a matplotlib.transforms.Transform instance
"""
Artist.set_transform(self, t)
-self._transformed_path = TransformedPath(self._path,
self.get_transform())
+self._invalid = True
+# self._transformed_path = TransformedPath(self._path,
self.get_transform())
def _is_sorted(self, x):
"return true if x is sorted"
@@ -450,6 +454,9 @@
return npy.alltrue(x[1:]-x[0:-1]>=0)
def draw(self, renderer):
+if self._invalid:
+self.recache()
+
renderer.open_group('line2d')
if
SF.net SVN: matplotlib: [4482] trunk/matplotlib/setup.py
Revision: 4482 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4482&view=rev Author: mdboom Date: 2007-11-28 07:18:41 -0800 (Wed, 28 Nov 2007) Log Message: --- Remove fonts/otf directory in list of data files. Modified Paths: -- trunk/matplotlib/setup.py Modified: trunk/matplotlib/setup.py === --- trunk/matplotlib/setup.py 2007-11-28 13:42:39 UTC (rev 4481) +++ trunk/matplotlib/setup.py 2007-11-28 15:18:41 UTC (rev 4482) @@ -88,7 +88,6 @@ 'mpl-data/fonts/pdfcorefonts/*.afm', 'mpl-data/fonts/pdfcorefonts/*.txt', 'mpl-data/fonts/ttf/*.ttf', - 'mpl-data/fonts/otf/*.otf', 'mpl-data/images/*.xpm', 'mpl-data/images/*.svg', 'mpl-data/images/*.png', This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 ___ Matplotlib-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4483] trunk/toolkits/basemap/lib/matplotlib/ toolkits/basemap/basemap.py
Revision: 4483 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4483&view=rev Author: jswhit Date: 2007-11-28 07:50:58 -0800 (Wed, 28 Nov 2007) Log Message: --- fix for orthographic projection. Modified Paths: -- trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py Modified: trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py === --- trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py 2007-11-28 15:18:41 UTC (rev 4482) +++ trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py 2007-11-28 15:50:58 UTC (rev 4483) @@ -688,7 +688,10 @@ lon_0=self.projparams['lon_0'] lat_0=self.projparams['lat_0'] re = self.projparams['R'] -maptran = pyproj.Proj(proj='stere',lon_0=lon_0,lat_0=lat_0,R=re) +# center of stereographic projection restricted +# to be one of 60 points on the sphere (every 45 deg lat/lon). +lon0 = 45*(int(lon_0)/45); lat0 = 45*(int(lat_0)/45) +maptran = pyproj.Proj(proj='stere',lon_0=lon0,lat0=lat_0,R=re) # boundary polygon for orthographic projection # in stereographic coorindates. b = self._boundarypolyll.boundary This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 ___ Matplotlib-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4484] trunk/toolkits/basemap/lib/matplotlib/ toolkits/basemap/basemap.py
Revision: 4484 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4484&view=rev Author: jswhit Date: 2007-11-28 07:58:28 -0800 (Wed, 28 Nov 2007) Log Message: --- more fixes for orthographic Modified Paths: -- trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py Modified: trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py === --- trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py 2007-11-28 15:50:58 UTC (rev 4483) +++ trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py 2007-11-28 15:58:28 UTC (rev 4484) @@ -688,9 +688,10 @@ lon_0=self.projparams['lon_0'] lat_0=self.projparams['lat_0'] re = self.projparams['R'] -# center of stereographic projection restricted -# to be one of 60 points on the sphere (every 45 deg lat/lon). -lon0 = 45*(int(lon_0)/45); lat0 = 45*(int(lat_0)/45) +# center of stereographic projection restricted to be +# nearest one of 60 points on the sphere (every 45 deg lat/lon). +lon0 = 45.*(npy.around(lon_0/45.)) +lat0 = 45.*(npy.around(lat_0/45.)) maptran = pyproj.Proj(proj='stere',lon_0=lon0,lat0=lat_0,R=re) # boundary polygon for orthographic projection # in stereographic coorindates. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 ___ Matplotlib-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4485] trunk/toolkits/basemap/lib/matplotlib/ toolkits/basemap/basemap.py
Revision: 4485 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4485&view=rev Author: jswhit Date: 2007-11-28 09:19:16 -0800 (Wed, 28 Nov 2007) Log Message: --- more orthographic fixes Modified Paths: -- trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py Modified: trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py === --- trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py 2007-11-28 15:58:28 UTC (rev 4484) +++ trunk/toolkits/basemap/lib/matplotlib/toolkits/basemap/basemap.py 2007-11-28 17:19:16 UTC (rev 4485) @@ -689,10 +689,11 @@ lat_0=self.projparams['lat_0'] re = self.projparams['R'] # center of stereographic projection restricted to be -# nearest one of 60 points on the sphere (every 45 deg lat/lon). -lon0 = 45.*(npy.around(lon_0/45.)) -lat0 = 45.*(npy.around(lat_0/45.)) -maptran = pyproj.Proj(proj='stere',lon_0=lon0,lat0=lat_0,R=re) +# nearest one of 6 points on the sphere (every 90 deg lat/lon). +lon0 = 90.*(npy.around(lon_0/90.)) +lat0 = 90.*(npy.around(lat_0/90.)) +if npy.abs(int(lat0)) == 90: lon0=0. +maptran = pyproj.Proj(proj='stere',lon_0=lon0,lat_0=lat0,R=re) # boundary polygon for orthographic projection # in stereographic coorindates. b = self._boundarypolyll.boundary This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 ___ Matplotlib-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4486] trunk/matplotlib/CODING_GUIDE
Revision: 4486 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4486&view=rev Author: jdh2358 Date: 2007-11-28 10:11:27 -0800 (Wed, 28 Nov 2007) Log Message: --- updated coding guide with trailing whitespace config suggestion Modified Paths: -- trunk/matplotlib/CODING_GUIDE Modified: trunk/matplotlib/CODING_GUIDE === --- trunk/matplotlib/CODING_GUIDE 2007-11-28 17:19:16 UTC (rev 4485) +++ trunk/matplotlib/CODING_GUIDE 2007-11-28 18:11:27 UTC (rev 4486) @@ -39,6 +39,8 @@ * If you have altered extension code, do you pass unit/memleak_hawaii.py? + + == Importing and name spaces == For numpy, use: @@ -103,7 +105,26 @@ to replace a single long line with two shorter and more readable lines. +Please do not commit lines with trailing white space, as it causes +noise in svn diffs. If you are an emacs user, the following in your +.emacs will cause emacs to strip trailing white space on save for +python, C and C++ +; and similarly for c++-mode-hook and c-mode-hook +(add-hook 'python-mode-hook + (lambda () + (add-hook 'local-write-file-hooks 'delete-trailing-whitespace))) + + +for older versions of emacs (emacs<23) you may need to do + +(add-hook 'python-mode-hook + (lambda () + (add-hook 'write-file-functions 'delete-trailing-whitespace))) + + + + == Licenses == matplotlib only uses BSD compatible code. If you bring in code from This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 ___ Matplotlib-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4488] branches/transforms/src
Revision: 4488
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4488&view=rev
Author: mdboom
Date: 2007-11-28 10:26:40 -0800 (Wed, 28 Nov 2007)
Log Message:
---
Increase performance of draw_markers in Agg backend
Modified Paths:
--
branches/transforms/src/_backend_agg.cpp
branches/transforms/src/agg_py_path_iterator.h
Modified: branches/transforms/src/_backend_agg.cpp
===
--- branches/transforms/src/_backend_agg.cpp2007-11-28 18:18:11 UTC (rev
4487)
+++ branches/transforms/src/_backend_agg.cpp2007-11-28 18:26:40 UTC (rev
4488)
@@ -549,8 +549,8 @@
agg::serialized_scanlines_adaptor_aa8 sa;
agg::serialized_scanlines_adaptor_aa8::embedded_scanline sl;
-while (path_quantized.vertex(&x, &y) != agg::path_cmd_stop) {
- if (has_clippath) {
+if (has_clippath) {
+ while (path_quantized.vertex(&x, &y) != agg::path_cmd_stop) {
pixfmt_amask_type pfa(*pixFmt, *alphaMask);
amask_ren_type r(pfa);
amask_aa_renderer_type ren(r);
@@ -563,7 +563,9 @@
ren.color(gc.color);
sa.init(strokeCache, strokeSize, x, y);
agg::render_scanlines(sa, sl, ren);
- } else {
+ }
+} else {
+ while (path_quantized.vertex(&x, &y) != agg::path_cmd_stop) {
if (face.first) {
rendererAA->color(face.second);
sa.init(fillCache, fillSize, x, y);
@@ -1139,6 +1141,7 @@
m_iterator(0), m_m(m), m_n(n), m_coordinates(coordinates) {
}
+ private:
inline unsigned vertex(unsigned idx, double* x, double* y) {
size_t m = (idx & 0x2) ? (m_m + 1) : m_m;
size_t n = (idx+1 & 0x2) ? (m_n + 1) : m_n;
@@ -1148,8 +1151,9 @@
return (idx) ? agg::path_cmd_line_to : agg::path_cmd_move_to;
}
+ public:
inline unsigned vertex(double* x, double* y) {
- if (m_iterator >= total_vertices())
+ if (m_iterator >= total_vertices())
return agg::path_cmd_stop;
return vertex(m_iterator++, x, y);
}
@@ -1496,7 +1500,7 @@
int ymin = height;
int xmax = 0;
int ymax = 0;
-
+
// Looks at the alpha channel to find the minimum extents of the image
unsigned char* pixel = pixBuffer + 3;
for (int y = 0; y < (int)height; ++y) {
@@ -1520,11 +1524,11 @@
ymin = std::max(0, ymin - 1);
xmax = std::min(xmax, (int)width);
ymax = std::min(ymax, (int)height);
-
+
newwidth = xmax - xmin;
newheight = ymax - ymin;
int newsize= newwidth * newheight * 4;
-
+
unsigned char* buf = new unsigned char[newsize];
unsigned int* dst = (unsigned int*)buf;
unsigned int* src = (unsigned int*)pixBuffer;
@@ -1540,7 +1544,7 @@
bounds[1] = Py::Int(ymin);
bounds[2] = Py::Int(newwidth);
bounds[3] = Py::Int(newheight);
-
+
Py::Tuple result(2);
result[0] = data;
result[1] = bounds;
Modified: branches/transforms/src/agg_py_path_iterator.h
===
--- branches/transforms/src/agg_py_path_iterator.h 2007-11-28 18:18:11 UTC
(rev 4487)
+++ branches/transforms/src/agg_py_path_iterator.h 2007-11-28 18:26:40 UTC
(rev 4488)
@@ -17,7 +17,7 @@
m_vertices(NULL), m_codes(NULL), m_iterator(0) {
Py::Object vertices_obj = path_obj.getAttr("vertices");
Py::Object codes_obj = path_obj.getAttr("codes");
-
+
m_vertices = (PyArrayObject*)PyArray_FromObject
(vertices_obj.ptr(), PyArray_DOUBLE, 2, 2);
if (!m_vertices || PyArray_NDIM(m_vertices) != 2 ||
PyArray_DIM(m_vertices, 1) != 2)
@@ -26,7 +26,7 @@
if (codes_obj.ptr() != Py_None) {
m_codes = (PyArrayObject*)PyArray_FromObject
(codes_obj.ptr(), PyArray_UINT8, 1, 1);
- if (!m_codes)
+ if (!m_codes)
throw Py::ValueError("Invalid codes array.");
}
@@ -40,11 +40,11 @@
static const char code_map[];
+ private:
inline unsigned vertex(unsigned idx, double* x, double* y) {
-if (idx > m_total_vertices)
- throw Py::RuntimeError("Requested vertex past end");
-*x = *(double*)PyArray_GETPTR2(m_vertices, idx, 0);
-*y = *(double*)PyArray_GETPTR2(m_vertices, idx, 1);
+char* pair = (char*)PyArray_GETPTR2(m_vertices, idx, 0);
+*x = *(double*)pair;
+*y = *(double*)(pair + PyArray_STRIDE(m_vertices, 1));
if (m_codes) {
return code_map[(int)*(char *)PyArray_GETPTR1(m_codes, idx)];
} else {
@@ -52,6 +52,7 @@
}
}
+ public:
inline unsigned vertex(double* x, double* y) {
if (m_iterator >= m_total_vertices) return agg::path_cmd_stop;
return vertex(m_iterator++, x, y);
@@ -71,10 +72,10 @@
};
// Maps path codes on the Python side to agg path commands
-const char PathIterator::code_map[] =
- {0,
- agg::path_cmd_move_to,
- agg::path_cmd_line_to,
+const char PathIterator::code_map[] =
+ {0,
+ agg::path_cmd_move_to,
+ agg::path_cmd_line_to,
agg::path_cmd
SF.net SVN: matplotlib: [4490] trunk/matplotlib/CODING_GUIDE
Revision: 4490 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4490&view=rev Author: jdh2358 Date: 2007-11-28 10:28:19 -0800 (Wed, 28 Nov 2007) Log Message: --- fixed coding guide bug for trailing whitespace Modified Paths: -- trunk/matplotlib/CODING_GUIDE Modified: trunk/matplotlib/CODING_GUIDE === --- trunk/matplotlib/CODING_GUIDE 2007-11-28 18:27:43 UTC (rev 4489) +++ trunk/matplotlib/CODING_GUIDE 2007-11-28 18:28:19 UTC (rev 4490) @@ -113,14 +113,15 @@ ; and similarly for c++-mode-hook and c-mode-hook (add-hook 'python-mode-hook (lambda () - (add-hook 'local-write-file-hooks 'delete-trailing-whitespace))) + (add-hook 'write-file-functions 'delete-trailing-whitespace))) -for older versions of emacs (emacs<23) you may need to do +for older versions of emacs (emacs<22) you may need to do + (add-hook 'python-mode-hook (lambda () - (add-hook 'write-file-functions 'delete-trailing-whitespace))) + (add-hook 'local-write-file-hooks 'delete-trailing-whitespace))) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 ___ Matplotlib-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4491] branches/transforms
Revision: 4491
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4491&view=rev
Author: mdboom
Date: 2007-11-28 10:30:10 -0800 (Wed, 28 Nov 2007)
Log Message:
---
Merged revisions -4490 via svnmerge from
http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib
r4457 | jdh2358 | 2007-11-26 16:53:01 -0500 (Mon, 26 Nov 2007) | 2 lines
fixed a bug in unit processing -- thanks chris
r4461 | efiring | 2007-11-26 21:24:22 -0500 (Mon, 26 Nov 2007) | 5 lines
Fixed pcolormesh bug
Integer X input was causing Y to be turned into
an integer as well.
r4472 | jdh2358 | 2007-11-27 13:34:38 -0500 (Tue, 27 Nov 2007) | 2 lines
tagged version 91.0 for release
r4474 | cmoad | 2007-11-27 20:31:59 -0500 (Tue, 27 Nov 2007) | 1 line
version bumps
r4475 | cmoad | 2007-11-27 20:33:15 -0500 (Tue, 27 Nov 2007) | 1 line
rev typo fixed for 0.91 release
r4476 | cmoad | 2007-11-27 21:24:40 -0500 (Tue, 27 Nov 2007) | 1 line
CXX/WrapPython.h was missing from sdist build
r4477 | cmoad | 2007-11-27 21:25:06 -0500 (Tue, 27 Nov 2007) | 1 line
rev bump for new bug
r4478 | cmoad | 2007-11-27 21:48:38 -0500 (Tue, 27 Nov 2007) | 1 line
reverting WrapPython.h inclusion
r4482 | mdboom | 2007-11-28 10:18:41 -0500 (Wed, 28 Nov 2007) | 2 lines
Remove fonts/otf directory in list of data files.
r4486 | jdh2358 | 2007-11-28 13:11:27 -0500 (Wed, 28 Nov 2007) | 2 lines
updated coding guide with trailing whitespace config suggestion
r4490 | jdh2358 | 2007-11-28 13:28:19 -0500 (Wed, 28 Nov 2007) | 2 lines
fixed coding guide bug for trailing whitespace
Modified Paths:
--
branches/transforms/API_CHANGES
branches/transforms/CHANGELOG
branches/transforms/CODING_GUIDE
branches/transforms/lib/matplotlib/__init__.py
branches/transforms/lib/matplotlib/axes.py
branches/transforms/lib/matplotlib/mlab.py
branches/transforms/license/LICENSE
branches/transforms/setup.py
Property Changed:
branches/transforms/
Property changes on: branches/transforms
___
Name: svnmerge-integrated
- /trunk/matplotlib:1-4443
+ /trunk/matplotlib:1-4490
Modified: branches/transforms/API_CHANGES
===
--- branches/transforms/API_CHANGES 2007-11-28 18:28:19 UTC (rev 4490)
+++ branches/transforms/API_CHANGES 2007-11-28 18:30:10 UTC (rev 4491)
@@ -33,11 +33,11 @@
Bbox.height()Bbox.height
Bbox.intervalx().get_bounds()Bbox.intervalx
- Bbox.intervalx().set_bounds()
+ Bbox.intervalx().set_bounds()
[Bbox.intervalx is now a property.]
Bbox.intervaly().get_bounds()Bbox.intervaly
- Bbox.intervaly().set_bounds()
+ Bbox.intervaly().set_bounds()
[Bbox.intervaly is now a property.]
Bbox.xmin() Bbox.x0 or Bbox.xmin
@@ -84,7 +84,7 @@
[Axes.set_position() now accepts either four scalars or a
transforms Bbox instance.]
- [also returns a Bbox]
+ [also returns a Bbox]
Axes.toggle_log_lineary()Axes.set_yscale()
[Since the recfactoring allows for more than two scale types
('log' or 'linear'), it no longer makes sense to have a
@@ -119,10 +119,10 @@
contour.py
Contour._segmentsContour.get_paths()
-[Contour.get_paths() now returns a list of path.Path instances.]
+[Contour.get_paths() now returns a list of path.Path instances.]
figure.py
- Figure.dpi.get()/set() Figure.dpi (a property)
+ Figure.dpi.get()/set() Figure.dpi (a property)
patches.py
get_verts() get_path()
@@ -150,9 +150,9 @@
offsetTrans, facecolors, edgecolors, linewidths,
linestyles, antialiaseds) [optional]
-
+
**changed methods** --->
- draw_image(self, x, y, im, bbox) draw_image(self, x, y, im,
bbox,
+ draw_image(self, x, y, im, bbox) draw_image(self, x, y, im, bbox,
clippath,
clippath_trans)
**removed methods** --->
@@ -166,9 +166,11 @@
draw_polygon
draw_rectangle
draw_regpoly_collection
-
+
END OF TRANSFORMS REFACTORING
+0.91.0 Released
+
Changed cbook.is_file_like to cbook.is_writable_file_like and
corr
SF.net SVN: matplotlib: [4487] trunk/toolkits/basemap/Changelog
Revision: 4487 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4487&view=rev Author: jswhit Date: 2007-11-28 10:18:11 -0800 (Wed, 28 Nov 2007) Log Message: --- fixes for fillcontinents in ortho Modified Paths: -- trunk/toolkits/basemap/Changelog Modified: trunk/toolkits/basemap/Changelog === --- trunk/toolkits/basemap/Changelog2007-11-28 18:11:27 UTC (rev 4486) +++ trunk/toolkits/basemap/Changelog2007-11-28 18:18:11 UTC (rev 4487) @@ -1,4 +1,5 @@ version 0.9.8 (not yet released) + * fixes for filling continents in orthographic projection. * added 'maskandscale' kwarg to NetCDFFile to optionally turn off automatic masking and rescaling of variable data. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 ___ Matplotlib-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4495] branches/transforms/lib/matplotlib/ transforms.py
Revision: 4495 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4495&view=rev Author: mdboom Date: 2007-11-28 12:37:04 -0800 (Wed, 28 Nov 2007) Log Message: --- Minor fixes. Modified Paths: -- branches/transforms/lib/matplotlib/transforms.py Modified: branches/transforms/lib/matplotlib/transforms.py === --- branches/transforms/lib/matplotlib/transforms.py2007-11-28 20:36:45 UTC (rev 4494) +++ branches/transforms/lib/matplotlib/transforms.py2007-11-28 20:37:04 UTC (rev 4495) @@ -556,7 +556,7 @@ corners = self.corners() corners_rotated = Affine2D().rotate(radians).transform(corners) bbox = Bbox.unit() -bbox.update_from_data(corners_rotated, ignore=True) +bbox.update_from_data_xy(corners_rotated, ignore=True) return bbox [EMAIL PROTECTED] @@ -649,7 +649,8 @@ def ignore(self, value): """ Set whether the existing bounds of the box should be ignored -by subsequent calls to update_from_data. +by subsequent calls to update_from_data or +update_from_data_xy. value: When True, subsequent calls to update_from_data will ignore the existing bounds of the Bbox. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. - SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 ___ Matplotlib-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4494] branches/transforms/lib/matplotlib/backends/ backend_ps.py
Revision: 4494
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4494&view=rev
Author: mdboom
Date: 2007-11-28 12:36:45 -0800 (Wed, 28 Nov 2007)
Log Message:
---
Fix Ps import bug
Modified Paths:
--
branches/transforms/lib/matplotlib/backends/backend_ps.py
Modified: branches/transforms/lib/matplotlib/backends/backend_ps.py
===
--- branches/transforms/lib/matplotlib/backends/backend_ps.py 2007-11-28
20:36:22 UTC (rev 4493)
+++ branches/transforms/lib/matplotlib/backends/backend_ps.py 2007-11-28
20:36:45 UTC (rev 4494)
@@ -10,7 +10,6 @@
from cStringIO import StringIO
from matplotlib import verbose, __version__, rcParams
from matplotlib._pylab_helpers import Gcf
-import matplotlib.agg as agg
from matplotlib.afm import AFM
from matplotlib.backend_bases import RendererBase, GraphicsContextBase,\
FigureManagerBase, FigureCanvasBase
@@ -144,7 +143,7 @@
self.image_magnification = dpi/72.0
self._clip_paths = {}
self._path_collection_id = 0
-
+
self.fontd = {}
self.afmfontd = {}
self.used_characters = {}
@@ -332,7 +331,7 @@
size = prop.get_size_in_points()
font.set_size(size, 72.0)
return font
-
+
def _rgba(self, im):
return im.as_rgba_str()
@@ -406,7 +405,7 @@
id = self._get_clip_path(clippath, clippath_trans)
clip.append('%s' % id)
clip = '\n'.join(clip)
-
+
#y = figh-(y+h)
ps = """gsave
%(clip)s
@@ -427,7 +426,7 @@
def _convert_path(self, path, transform):
path = transform.transform_path(path)
-
+
ps = []
for points, code in path.iter_segments():
if code == Path.MOVETO:
@@ -444,7 +443,7 @@
elif code == Path.CLOSEPOLY:
ps.append("cl")
ps = "\n".join(ps)
-
+
return ps
def _get_clip_path(self, clippath, clippath_transform):
@@ -489,7 +488,7 @@
ps_cmd.extend(['gsave', ps_color, 'fill', 'grestore'])
ps_cmd.extend(['stroke', 'grestore', '} bind def'])
-
+
tpath = trans.transform_path(path)
for x, y in tpath.vertices:
ps_cmd.append("%1.3g %1.3g o" % (x, y))
@@ -502,7 +501,7 @@
offsetTrans, facecolors, edgecolors, linewidths,
linestyles, antialiaseds):
write = self._pswriter.write
-
+
path_codes = []
for i, (path, transform) in enumerate(self._iter_collection_raw_paths(
master_transform, paths, all_transforms)):
@@ -513,7 +512,7 @@
ps_cmd.extend(['} bind def\n'])
write('\n'.join(ps_cmd))
path_codes.append(name)
-
+
for xo, yo, path_id, gc, rgbFace in self._iter_collection(
path_codes, cliprect, clippath, clippath_trans,
offsets, offsetTrans, facecolors, edgecolors,
@@ -523,7 +522,7 @@
self._draw_ps(ps, gc, rgbFace)
self._path_collection_id += 1
-
+
def draw_tex(self, gc, x, y, s, prop, angle, ismath='TeX!'):
"""
draw a Text instance
@@ -570,7 +569,7 @@
elif isinstance(s, unicode):
return self.draw_unicode(gc, x, y, s, prop, angle)
-
+
elif rcParams['ps.useafm']:
font = self._get_font_afm(prop)
@@ -654,7 +653,7 @@
kern = 0
last_name = name
thisx += kern * scale
-
+
lines.append('%f %f m /%s glyphshow'%(thisx, thisy, name))
thisx += width * scale
@@ -671,7 +670,7 @@
grestore
""" % locals()
self._pswriter.write(ps)
-
+
else:
font = self._get_font_ttf(prop)
@@ -750,7 +749,7 @@
(len(gc.get_rgb()) <= 3 or gc.get_rgb()[3] != 0.0))
fill = (fill and rgbFace is not None and
(len(rgbFace) <= 3 or rgbFace[3] != 0.0))
-
+
if stroke:
self.set_linewidth(gc.get_linewidth())
jint = gc.get_joinstyle()
@@ -769,7 +768,7 @@
if clippath:
id = self._get_clip_path(clippath, clippath_trans)
write('gsave\n%s\n' % id)
-
+
# Jochen, is the strip necessary? - this could be a honking big string
write(ps.strip())
write("\n")
@@ -795,7 +794,7 @@
if cliprect:
write("grestore\n")
-
+
class GraphicsContextPS(GraphicsContextBase):
def get_capstyle(self):
return {'butt':0,
@@ -821,16 +820,16 @@
filetypes = {'ps' : 'Postscript',
'eps' : 'Encapsulated Postscript'}
-
+
def get_default_filetype(self):
return 'ps'
-
+
def print_ps(self, outfile, *args, **kw
SF.net SVN: matplotlib: [4493] branches/transforms/lib/matplotlib/backends/ backend_pdf.py
Revision: 4493
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4493&view=rev
Author: mdboom
Date: 2007-11-28 12:36:22 -0800 (Wed, 28 Nov 2007)
Log Message:
---
Fix PDF font size bug.
Modified Paths:
--
branches/transforms/lib/matplotlib/backends/backend_pdf.py
Modified: branches/transforms/lib/matplotlib/backends/backend_pdf.py
===
--- branches/transforms/lib/matplotlib/backends/backend_pdf.py 2007-11-28
20:13:47 UTC (rev 4492)
+++ branches/transforms/lib/matplotlib/backends/backend_pdf.py 2007-11-28
20:36:22 UTC (rev 4493)
@@ -175,7 +175,7 @@
# A bounding box
elif isinstance(obj, BboxBase):
return fill([pdfRepr(val) for val in obj.bounds])
-
+
else:
raise TypeError, \
"Don't know a PDF representation for %s objects." \
@@ -341,7 +341,7 @@
self.passed_in_file_object = True
else:
raise ValueError("filename must be a path or a file-like object")
-
+
self.fh = fh
self.currentstream = None # stream object to write to, if any
fh.write("%PDF-1.4\n")# 1.4 is the first version to have alpha
@@ -530,7 +530,7 @@
firstchar = 0
lastchar = len(fontinfo.widths) - 1
-
+
fontdict = {
'Type': Name('Font'),
'Subtype':Name('Type1'),
@@ -575,7 +575,7 @@
'XHeight': 500, # TODO: this one too
'FontFile':fontfileObject,
'FontFamily': familyname,
-'StemV': 50, # TODO
+'StemV': 50, # TODO
# (see also revision 3874; but not all TeX distros have AFM files!)
#'FontWeight': a number where 400 = Regular, 700 = Bold
}
@@ -620,7 +620,7 @@
CMapName currentdict /CMap defineresource pop
end
end"""
-
+
def embedTTF(self, filename, characters):
"""Embed the TTF font from the named file into the document."""
@@ -833,7 +833,7 @@
unicode_cmap = (self._identityToUnicodeCMap %
(len(unicode_groups),
"\n".join(unicode_bfrange)))
-
+
# CIDToGIDMap stream
cid_to_gid_map = "".join(cid_to_gid_map).encode("utf-16be")
self.beginStream(cidToGidMapObject.id,
@@ -848,7 +848,7 @@
{'Length': unicode_cmap})
self.currentstream.write(unicode_cmap)
self.endStream()
-
+
descriptor['MaxWidth'] = max_width
# Write everything out
@@ -902,7 +902,7 @@
warnings.warn(("'%s' can not be subsetted into a Type 3 font. " +
"The entire font will be embedded in the output.") %
os.path.basename(filename))
-
+
if fonttype == 3:
return embedTTFType3(font, characters, descriptor)
elif fonttype == 42:
@@ -1054,7 +1054,7 @@
'SMask': smaskObject})
self.currentstream.write(data) # TODO: predictors (i.e.,
output png)
self.endStream()
-
+
img.flipud_out()
def markerObject(self, path, trans, fillp, lw):
@@ -1068,7 +1068,7 @@
else:
name = result[0]
return name
-
+
def writeMarkers(self):
for tup in self.markers.values():
name, object, path, trans, fillp, lw = tup
@@ -1088,7 +1088,7 @@
[EMAIL PROTECTED]
def pathOperations(path, transform):
tpath = transform.transform_path(path)
-
+
cmds = []
for points, code in tpath.iter_segments():
if code == Path.MOVETO:
@@ -1109,11 +1109,11 @@
cmds.append(Op.closepath)
return cmds
pathOperations = staticmethod(pathOperations)
-
+
def writePath(self, path, transform):
cmds = self.pathOperations(path, transform)
self.output(*cmds)
-
+
def reserveObject(self, name=''):
"""Reserve an ID for an indirect object.
The name is used for debugging in case we forget to print out
@@ -1249,7 +1249,7 @@
marker, Op.use_xobject)
lastx, lasty = x, y
output(Op.grestore)
-
+
def _setup_textpos(self, x, y, angle, oldx=0, oldy=0, oldangle=0):
if angle == oldangle == 0:
self.file.output(x - oldx, y - oldy, Op.textpos)
@@ -1285,11 +1285,12 @@
fonttype = 42
else:
fonttype = global_fonttype
-
+
if fonttype == 42 or num <= 255:
self._setup_textpos(ox, oy, 0, oldx, oldy)
oldx, oldy = ox, oy
if (fontname, fontsize) != prev_font:
+fontsize *= self.dpi/72.0
sel
SF.net SVN: matplotlib: [4492] trunk/matplotlib/lib/matplotlib/mathtext.py
Revision: 4492
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4492&view=rev
Author: mdboom
Date: 2007-11-28 12:13:47 -0800 (Wed, 28 Nov 2007)
Log Message:
---
Fix bug using stix fonts.
Modified Paths:
--
trunk/matplotlib/lib/matplotlib/mathtext.py
Modified: trunk/matplotlib/lib/matplotlib/mathtext.py
===
--- trunk/matplotlib/lib/matplotlib/mathtext.py 2007-11-28 18:30:10 UTC (rev
4491)
+++ trunk/matplotlib/lib/matplotlib/mathtext.py 2007-11-28 20:13:47 UTC (rev
4492)
@@ -852,6 +852,7 @@
fontmap = {}
use_cmex = False
cm_fallback = False
+_sans = False
def __init__(self, *args, **kwargs):
TruetypeFonts.__init__(self, *args, **kwargs)
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4497] trunk/matplotlib/examples/mathtext_demo.py
Revision: 4497
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4497&view=rev
Author: mdboom
Date: 2007-11-28 12:43:01 -0800 (Wed, 28 Nov 2007)
Log Message:
---
Minor fix -- updating old \rm{} syntax to \mathrm{} syntax.
Modified Paths:
--
trunk/matplotlib/examples/mathtext_demo.py
Modified: trunk/matplotlib/examples/mathtext_demo.py
===
--- trunk/matplotlib/examples/mathtext_demo.py 2007-11-28 20:41:15 UTC (rev
4496)
+++ trunk/matplotlib/examples/mathtext_demo.py 2007-11-28 20:43:01 UTC (rev
4497)
@@ -22,7 +22,7 @@
ax.legend(("Foo", "Testing $x^2$"))
-ax.set_title(r'$\Delta_i^j \hspace{0.4} \rm{versus} \hspace{0.4}
\Delta_{i+1}^j$', fontsize=20)
+ax.set_title(r'$\Delta_i^j \hspace{0.4} \mathrm{versus} \hspace{0.4}
\Delta_{i+1}^j$', fontsize=20)
#fig.savefig('mathtext_demo')
show()
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4498] trunk/matplotlib/lib/matplotlib/backends/ backend_pdf.py
Revision: 4498
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4498&view=rev
Author: mdboom
Date: 2007-11-28 12:58:06 -0800 (Wed, 28 Nov 2007)
Log Message:
---
Fix for STIX fonts with PDF backend.
Modified Paths:
--
trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py
===
--- trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2007-11-28
20:43:01 UTC (rev 4497)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2007-11-28
20:58:06 UTC (rev 4498)
@@ -334,7 +334,7 @@
self.passed_in_file_object = True
else:
raise ValueError("filename must be a path or a file-like object")
-
+
self.fh = fh
self.currentstream = None # stream object to write to, if any
fh.write("%PDF-1.4\n")# 1.4 is the first version to have alpha
@@ -524,7 +524,7 @@
firstchar = 0
lastchar = len(fontinfo.widths) - 1
-
+
fontdict = {
'Type': Name('Font'),
'Subtype':Name('Type1'),
@@ -569,7 +569,7 @@
'XHeight': 500, # TODO: this one too
'FontFile':fontfileObject,
'FontFamily': familyname,
-'StemV': 50, # TODO
+'StemV': 50, # TODO
# (see also revision 3874; but not all TeX distros have AFM files!)
#'FontWeight': a number where 400 = Regular, 700 = Bold
}
@@ -614,7 +614,7 @@
CMapName currentdict /CMap defineresource pop
end
end"""
-
+
def embedTTF(self, filename, characters):
"""Embed the TTF font from the named file into the document."""
@@ -713,7 +713,7 @@
charprocDict['Type'] = Name('XObject')
charprocDict['Subtype'] = Name('Form')
charprocDict['BBox'] = bbox
-charprocObject = self.reserveObject('charProc for %s' % name)
+charprocObject = self.reserveObject('charProc')
self.beginStream(charprocObject.id, None, charprocDict)
self.currentstream.write(stream)
self.endStream()
@@ -827,7 +827,7 @@
unicode_cmap = (self._identityToUnicodeCMap %
(len(unicode_groups),
"\n".join(unicode_bfrange)))
-
+
# CIDToGIDMap stream
cid_to_gid_map = "".join(cid_to_gid_map).encode("utf-16be")
self.beginStream(cidToGidMapObject.id,
@@ -842,7 +842,7 @@
{'Length': unicode_cmap})
self.currentstream.write(unicode_cmap)
self.endStream()
-
+
descriptor['MaxWidth'] = max_width
# Write everything out
@@ -896,7 +896,7 @@
warnings.warn(("'%s' can not be subsetted into a Type 3 font. " +
"The entire font will be embedded in the output.") %
os.path.basename(filename))
-
+
if fonttype == 3:
return embedTTFType3(font, characters, descriptor)
elif fonttype == 42:
@@ -1378,7 +1378,7 @@
fonttype = 42
else:
fonttype = global_fonttype
-
+
if fonttype == 42 or num <= 255:
self._setup_textpos(ox, oy, 0, oldx, oldy)
oldx, oldy = ox, oy
@@ -1397,8 +1397,9 @@
fonttype = 42
else:
fonttype = global_fonttype
-
+
if fonttype == 3 and num > 255:
+self.file.fontName(fontname)
self.file.output(Op.gsave,
0.001 * fontsize, 0,
0, 0.001 * fontsize,
@@ -1534,12 +1535,12 @@
y += font.get_descent() / 64.0
fonttype = rcParams['pdf.fonttype']
-
+
# We can't subset all OpenType fonts, so switch to Type 42
# in that case.
if is_opentype_cff_font(font.fname):
fonttype = 42
-
+
def check_simple_method(s):
"""Determine if we should use the simple or woven method
to output this text, and chunks the string into 1-byte and
@@ -1830,7 +1831,7 @@
if (self._cliprect, self._clippath) != (cliprect, clippath):
cmds.extend(self.push())
if self._cliprect != cliprect:
-cmds.extend([t for t in cliprect] +
+cmds.extend([t for t in cliprect] +
[Op.rectangle, Op.clip, Op.endpath])
if self._clippath != clippath:
cmds.extend(PdfFile.pathOperations(clippath) +
@@ -1858,7 +1859,7 @@
SF.net SVN: matplotlib: [4499] branches/transforms
Revision: 4499
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4499&view=rev
Author: mdboom
Date: 2007-11-28 13:01:01 -0800 (Wed, 28 Nov 2007)
Log Message:
---
Merged revisions 4496-4498 via svnmerge from
http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib
r4497 | mdboom | 2007-11-28 15:43:01 -0500 (Wed, 28 Nov 2007) | 2 lines
Minor fix -- updating old \rm{} syntax to \mathrm{} syntax.
r4498 | mdboom | 2007-11-28 15:58:06 -0500 (Wed, 28 Nov 2007) | 2 lines
Fix for STIX fonts with PDF backend.
Modified Paths:
--
branches/transforms/examples/mathtext_demo.py
branches/transforms/lib/matplotlib/backends/backend_pdf.py
Property Changed:
branches/transforms/
Property changes on: branches/transforms
___
Name: svnmerge-integrated
- /trunk/matplotlib:1-4495
+ /trunk/matplotlib:1-4498
Modified: branches/transforms/examples/mathtext_demo.py
===
--- branches/transforms/examples/mathtext_demo.py 2007-11-28 20:58:06 UTC
(rev 4498)
+++ branches/transforms/examples/mathtext_demo.py 2007-11-28 21:01:01 UTC
(rev 4499)
@@ -22,7 +22,7 @@
ax.legend(("Foo", "Testing $x^2$"))
-ax.set_title(r'$\Delta_i^j \hspace{0.4} \rm{versus} \hspace{0.4}
\Delta_{i+1}^j$', fontsize=20)
+ax.set_title(r'$\Delta_i^j \hspace{0.4} \mathrm{versus} \hspace{0.4}
\Delta_{i+1}^j$', fontsize=20)
#fig.savefig('mathtext_demo')
show()
Modified: branches/transforms/lib/matplotlib/backends/backend_pdf.py
===
--- branches/transforms/lib/matplotlib/backends/backend_pdf.py 2007-11-28
20:58:06 UTC (rev 4498)
+++ branches/transforms/lib/matplotlib/backends/backend_pdf.py 2007-11-28
21:01:01 UTC (rev 4499)
@@ -719,7 +719,7 @@
charprocDict['Type'] = Name('XObject')
charprocDict['Subtype'] = Name('Form')
charprocDict['BBox'] = bbox
-charprocObject = self.reserveObject('charProc for %s' % name)
+charprocObject = self.reserveObject('charProc')
self.beginStream(charprocObject.id, None, charprocDict)
self.currentstream.write(stream)
self.endStream()
@@ -1308,6 +1308,7 @@
fonttype = global_fonttype
if fonttype == 3 and num > 255:
+self.file.fontName(fontname)
self.file.output(Op.gsave,
0.001 * fontsize, 0,
0, 0.001 * fontsize,
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib: [4496] branches/transforms
Revision: 4496
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4496&view=rev
Author: mdboom
Date: 2007-11-28 12:41:15 -0800 (Wed, 28 Nov 2007)
Log Message:
---
Merged revisions 4491-4495 via svnmerge from
http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib
r4492 | mdboom | 2007-11-28 15:13:47 -0500 (Wed, 28 Nov 2007) | 2 lines
Fix bug using stix fonts.
Modified Paths:
--
branches/transforms/lib/matplotlib/mathtext.py
Property Changed:
branches/transforms/
Property changes on: branches/transforms
___
Name: svnmerge-integrated
- /trunk/matplotlib:1-4490
+ /trunk/matplotlib:1-4495
Modified: branches/transforms/lib/matplotlib/mathtext.py
===
--- branches/transforms/lib/matplotlib/mathtext.py 2007-11-28 20:37:04 UTC
(rev 4495)
+++ branches/transforms/lib/matplotlib/mathtext.py 2007-11-28 20:41:15 UTC
(rev 4496)
@@ -850,6 +850,7 @@
fontmap = {}
use_cmex = False
cm_fallback = False
+_sans = False
def __init__(self, *args, **kwargs):
TruetypeFonts.__init__(self, *args, **kwargs)
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going
mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
