SourceForge logo
SourceForge logo
Menu

matplotlib-checkins — Commit notification. DO NOT POST to this list, just subscribe to it.

You can subscribe to this list here.

2007 Jan
Feb
Mar
Apr
May
Jun
Jul
(115)
Aug
(120)
Sep
(137)
Oct
(170)
Nov
(461)
Dec
(263)
2008 Jan
(120)
Feb
(74)
Mar
(35)
Apr
(74)
May
(245)
Jun
(356)
Jul
(240)
Aug
(115)
Sep
(78)
Oct
(225)
Nov
(98)
Dec
(271)
2009 Jan
(132)
Feb
(84)
Mar
(74)
Apr
(56)
May
(90)
Jun
(79)
Jul
(83)
Aug
(296)
Sep
(214)
Oct
(76)
Nov
(82)
Dec
(66)
2010 Jan
(46)
Feb
(58)
Mar
(51)
Apr
(77)
May
(58)
Jun
(126)
Jul
(128)
Aug
(64)
Sep
(50)
Oct
(44)
Nov
(48)
Dec
(54)
2011 Jan
(68)
Feb
(52)
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
(1)
2018 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S



1
(3)
2
(3)
3
4
(2)
5
(9)
6
(4)
7
(9)
8
(7)
9
(2)
10
(3)
11
(2)
12
13
(2)
14
(10)
15
(24)
16
(17)
17
(21)
18
(3)
19
(23)
20
(6)
21
(4)
22
(14)
23
(11)
24
(15)
25
(6)
26
(1)
27
(4)
28
(3)
29
(9)
30
(6)
31
(2)

Showing 2 results of 2

Revision: 6175
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6175&view=rev
Author: mdboom
Date: 2008年10月09日 11:37:01 +0000 (2008年10月09日)
Log Message:
-----------
Better version of 'show' warning that only emits when show() is run directly from the python or ipython console.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/backends/__init__.py
Modified: trunk/matplotlib/lib/matplotlib/backends/__init__.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/__init__.py	2008年10月09日 01:19:54 UTC (rev 6174)
+++ trunk/matplotlib/lib/matplotlib/backends/__init__.py	2008年10月09日 11:37:01 UTC (rev 6175)
@@ -1,5 +1,6 @@
 
 import matplotlib
+import inspect
 import warnings
 
 # ipython relies on interactive_bk being defined here
@@ -30,11 +31,14 @@
 # for "show" or "draw_if_interactive", so if they are not defined
 # by the backend, just do nothing
 def do_nothing_show(*args, **kwargs):
- warnings.warn("""
+ frame = inspect.currentframe()
+ fname = inspect.getframeinfo(frame.f_back)[0]
+ if fname in ('<stdin>', '<ipython console>'):
+ warnings.warn("""
 Your currently selected backend, '%s' does not support show().
 Please select a GUI backend in your matplotlibrc file ('%s')
 or with matplotlib.use()""" %
- (backend, matplotlib.matplotlib_fname()))
+ (backend, matplotlib.matplotlib_fname()))
 def do_nothing(*args, **kwargs): pass
 backend_version = getattr(backend_mod,'backend_version', 'unknown')
 show = getattr(backend_mod, 'show', do_nothing_show)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ef...@us...> - 2008年10月09日 01:20:07
Revision: 6174
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6174&view=rev
Author: efiring
Date: 2008年10月09日 01:19:54 +0000 (2008年10月09日)
Log Message:
-----------
path simplification for paths with gaps
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/examples/pylab_examples/clippedline.py
 trunk/matplotlib/lib/matplotlib/path.py
 trunk/matplotlib/src/agg_py_path_iterator.h
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2008年10月08日 19:53:57 UTC (rev 6173)
+++ trunk/matplotlib/CHANGELOG	2008年10月09日 01:19:54 UTC (rev 6174)
@@ -1,3 +1,5 @@
+2008年10月08日 Add path simplification support to paths with gaps. - EF
+
 2008年10月05日 Fix problem with AFM files that don't specify the font's
 full name or family name. - JKS
 
Modified: trunk/matplotlib/examples/pylab_examples/clippedline.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/clippedline.py	2008年10月08日 19:53:57 UTC (rev 6173)
+++ trunk/matplotlib/examples/pylab_examples/clippedline.py	2008年10月09日 01:19:54 UTC (rev 6174)
@@ -19,7 +19,7 @@
 
 def set_data(self, *args, **kwargs):
 Line2D.set_data(self, *args, **kwargs)
- if self._invalid: 
+ if self._invalid:
 self.recache()
 self.xorig = np.array(self._x)
 self.yorig = np.array(self._y)
Modified: trunk/matplotlib/lib/matplotlib/path.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/path.py	2008年10月08日 19:53:57 UTC (rev 6173)
+++ trunk/matplotlib/lib/matplotlib/path.py	2008年10月09日 01:19:54 UTC (rev 6174)
@@ -109,9 +109,8 @@
 assert vertices.ndim == 2
 assert vertices.shape[1] == 2
 
- self.should_simplify = (codes is None and
- np.all(np.isfinite(vertices)) and
- len(vertices) >= 128)
+ self.should_simplify = (len(vertices) >= 128 and
+ (codes is None or np.all(codes <= Path.LINETO)))
 self.codes = codes
 self.vertices = vertices
 
Modified: trunk/matplotlib/src/agg_py_path_iterator.h
===================================================================
--- trunk/matplotlib/src/agg_py_path_iterator.h	2008年10月08日 19:53:57 UTC (rev 6173)
+++ trunk/matplotlib/src/agg_py_path_iterator.h	2008年10月09日 01:19:54 UTC (rev 6174)
@@ -137,7 +137,8 @@
 double width = 0.0, double height = 0.0) :
 m_source(&source), m_quantize(quantize), m_simplify(simplify),
 m_width(width + 1.0), m_height(height + 1.0), m_queue_read(0), m_queue_write(0),
- m_moveto(true), m_lastx(0.0), m_lasty(0.0), m_clipped(false),
+ m_moveto(true), m_after_moveto(false),
+ m_lastx(0.0), m_lasty(0.0), m_clipped(false),
 m_do_clipping(width > 0.0 && height > 0.0),
 m_origdx(0.0), m_origdy(0.0),
 m_origdNorm2(0.0), m_dnorm2Max(0.0), m_dnorm2Min(0.0),
@@ -205,6 +206,7 @@
 *y = front.y;
 #if DEBUG_SIMPLIFY
 printf((cmd == agg::path_cmd_move_to) ? "|" : "-");
+ printf(" 1 %f %f\n", *x, *y);
 #endif
 return cmd;
 }
@@ -239,18 +241,40 @@
 
 //if we are starting a new path segment, move to the first point
 // + init
- if (m_moveto)
+
+#if DEBUG_SIMPLIFY
+ printf("x, y, code: %f, %f, %d\n", *x, *y, cmd);
+#endif
+ if (m_moveto || cmd == agg::path_cmd_move_to)
 {
+ // m_moveto check is not generally needed because
+ // m_source generates an initial moveto; but it
+ // is retained for safety in case circumstances
+ // arise where this is not true.
+ if (m_origdNorm2 && !m_after_moveto)
+ {
+ // m_origdNorm2 is nonzero only if we have a vector;
+ // the m_after_moveto check ensures we push this
+ // vector to the queue only once.
+ _push(x,y);
+ }
+ m_after_moveto = true;
 m_lastx = *x;
 m_lasty = *y;
 m_moveto = false;
 m_origdNorm2 = 0.0;
-#if DEBUG_SIMPLIFY
- m_pushed++;
- printf("|");
-#endif
- return agg::path_cmd_move_to;
+ // A moveto resulting from a nan yields a missing
+ // line segment, hence a break in the line, just
+ // like clipping, so we treat it the same way.
+ m_clipped = true;
+ if (m_queue_read < m_queue_write)
+ {
+ // If we did a push, empty the queue now.
+ break;
+ }
+ continue;
 }
+ m_after_moveto = false;
 
 // Don't render line segments less than one pixel long
 if (fabs(*x - m_lastx) < 1.0 && fabs(*y - m_lasty) < 1.0)
@@ -295,7 +319,7 @@
 m_origdy = *y - m_lasty;
 m_origdNorm2 = m_origdx*m_origdx + m_origdy*m_origdy;
 
- //set all the variables to reflect this new orig vecor
+ //set all the variables to reflect this new orig vector
 m_dnorm2Max = m_origdNorm2;
 m_dnorm2Min = 0.0;
 m_haveMin = false;
@@ -376,7 +400,6 @@
 #endif
 continue;
 }
-
 //if we get here, then this vector was not similar enough to the
 //line we are building, so we need to draw that line and start the
 //next one.
@@ -384,46 +407,9 @@
 //if the line needs to extend in the opposite direction from the
 //direction we are drawing in, move back to we start drawing from
 //back there.
- if (m_haveMin)
- {
- m_queue[m_queue_write++].set(agg::path_cmd_line_to, m_minX, m_minY);
- }
- m_queue[m_queue_write++].set(agg::path_cmd_line_to, m_maxX, m_maxY);
 
- //if we clipped some segments between this line and the next line
- //we are starting, we also need to move to the last point.
- if (m_clipped) {
- m_queue[m_queue_write++].set(agg::path_cmd_move_to, m_lastx, m_lasty);
- }
- else if (!m_lastMax)
- {
- //if the last line was not the longest line, then move back to
- //the end point of the last line in the sequence. Only do this
- //if not clipped, since in that case lastx,lasty is not part of
- //the line just drawn.
+ _push(x, y);
 
- //Would be move_to if not for the artifacts
- m_queue[m_queue_write++].set(agg::path_cmd_line_to, m_lastx, m_lasty);
- }
-
- //now reset all the variables to get ready for the next line
- m_origdx = *x - m_lastx;
- m_origdy = *y - m_lasty;
- m_origdNorm2 = m_origdx*m_origdx + m_origdy*m_origdy;
-
- m_dnorm2Max = m_origdNorm2;
- m_dnorm2Min = 0.0;
- m_haveMin = false;
- m_lastMax = true;
- m_lastx = m_maxX = *x;
- m_lasty = m_maxY = *y;
- m_lastWrittenX = m_minX = m_lastx;
- m_lastWrittenY = m_minY = m_lasty;
-
- m_clipped = false;
-#if DEBUG_SIMPLIFY
- m_pushed += m_queue_write - m_queue_read;
-#endif
 break;
 }
 
@@ -453,6 +439,8 @@
 *y = front.y;
 #if DEBUG_SIMPLIFY
 printf((cmd == agg::path_cmd_move_to) ? "|" : "-");
+ printf(" 3 %f %f\n", *x, *y);
+
 #endif
 return cmd;
 }
@@ -489,6 +477,7 @@
 item m_queue[6];
 
 bool m_moveto;
+ bool m_after_moveto;
 double m_lastx, m_lasty;
 bool m_clipped;
 bool m_do_clipping;
@@ -512,6 +501,52 @@
 unsigned m_pushed;
 unsigned m_skipped;
 #endif
+
+ void _push(double* x, double* y)
+ {
+ if (m_haveMin)
+ {
+ m_queue[m_queue_write++].set(agg::path_cmd_line_to, m_minX, m_minY);
+ }
+ m_queue[m_queue_write++].set(agg::path_cmd_line_to, m_maxX, m_maxY);
+
+ //if we clipped some segments between this line and the next line
+ //we are starting, we also need to move to the last point.
+ if (m_clipped) {
+ m_queue[m_queue_write++].set(agg::path_cmd_move_to, m_lastx, m_lasty);
+ }
+ else if (!m_lastMax)
+ {
+ //if the last line was not the longest line, then move back to
+ //the end point of the last line in the sequence. Only do this
+ //if not clipped, since in that case lastx,lasty is not part of
+ //the line just drawn.
+
+ //Would be move_to if not for the artifacts
+ m_queue[m_queue_write++].set(agg::path_cmd_line_to, m_lastx, m_lasty);
+ }
+
+ //now reset all the variables to get ready for the next line
+ m_origdx = *x - m_lastx;
+ m_origdy = *y - m_lasty;
+ m_origdNorm2 = m_origdx*m_origdx + m_origdy*m_origdy;
+
+ m_dnorm2Max = m_origdNorm2;
+ m_dnorm2Min = 0.0;
+ m_haveMin = false;
+ m_lastMax = true;
+ m_lastx = m_maxX = *x;
+ m_lasty = m_maxY = *y;
+ m_lastWrittenX = m_minX = m_lastx;
+ m_lastWrittenY = m_minY = m_lasty;
+
+ m_clipped = false;
+#if DEBUG_SIMPLIFY
+ m_pushed += m_queue_write - m_queue_read;
+#endif
+
+ }
+
 };
 
 #endif // __AGG_PY_PATH_ITERATOR_H__
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

Showing 2 results of 2

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /