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



Showing 2 results of 2

Revision: 8212
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8212&view=rev
Author: leejjoon
Date: 2010年03月23日 17:37:51 +0000 (2010年3月23日)
Log Message:
-----------
make filters dpi-independent in examples/pylab_examples/demo_agg_filter.py
Modified Paths:
--------------
 trunk/matplotlib/examples/pylab_examples/demo_agg_filter.py
Modified: trunk/matplotlib/examples/pylab_examples/demo_agg_filter.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/demo_agg_filter.py	2010年03月23日 17:23:50 UTC (rev 8211)
+++ trunk/matplotlib/examples/pylab_examples/demo_agg_filter.py	2010年03月23日 17:37:51 UTC (rev 8212)
@@ -52,12 +52,12 @@
 self.offsets = offsets
 
 def get_pad(self, dpi):
- return max(*self.offsets)
+ return int(max(*self.offsets)/72.*dpi)
 
 def process_image(self, padded_src, dpi):
 ox, oy = self.offsets
- a1 = np.roll(padded_src, ox, axis=1)
- a2 = np.roll(a1, -oy, axis=0)
+ a1 = np.roll(padded_src, int(ox/72.*dpi), axis=1)
+ a2 = np.roll(a1, -int(oy/72.*dpi), axis=0)
 return a2
 
 class GaussianFilter(BaseFilter):
@@ -71,14 +71,14 @@
 self.color=color
 
 def get_pad(self, dpi):
- return int(self.sigma*3)
+ return int(self.sigma*3/72.*dpi)
 
 
 def process_image(self, padded_src, dpi):
 #offsetx, offsety = int(self.offsets[0]), int(self.offsets[1])
 tgt_image = np.zeros_like(padded_src)
 aa = smooth2d(padded_src[:,:,-1]*self.alpha,
- self.sigma)
+ self.sigma/72.*dpi)
 tgt_image[:,:,-1] = aa
 tgt_image[:,:,:-1] = self.color
 return tgt_image
@@ -143,7 +143,7 @@
 alpha = new_im[:,:,3]
 alpha.fill(0)
 alpha[pad:-pad, pad:-pad] = im[:,:,-1]
- alpha2 = np.clip(smooth2d(alpha, self.pixels) * 5, 0, 1)
+ alpha2 = np.clip(smooth2d(alpha, self.pixels/72.*dpi) * 5, 0, 1)
 new_im[:,:,-1] = alpha2
 new_im[:,:,:-1] = self.color
 offsetx, offsety = -pad, -pad
@@ -206,8 +206,10 @@
 fontsize=11)
 
 # change clable color to black
+ from matplotlib.patheffects import Normal
 for t in cl:
 t.set_color("k")
+ t.set_path_effects([Normal()]) # to force TextPath (i.e., same font in all backends)
 
 # Add white glows to improve visibility of labels.
 white_glows = FilteredArtistList(cl, GrowFilter(3))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8211
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8211&view=rev
Author: leejjoon
Date: 2010年03月23日 17:23:50 +0000 (2010年3月23日)
Log Message:
-----------
remove scipy dependency in examples/pylab_examples/demo_agg_filter.py
Modified Paths:
--------------
 trunk/matplotlib/examples/pylab_examples/demo_agg_filter.py
Modified: trunk/matplotlib/examples/pylab_examples/demo_agg_filter.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/demo_agg_filter.py	2010年03月22日 16:47:27 UTC (rev 8210)
+++ trunk/matplotlib/examples/pylab_examples/demo_agg_filter.py	2010年03月23日 17:23:50 UTC (rev 8211)
@@ -1,11 +1,30 @@
 import matplotlib.pyplot as plt
 
 import numpy as np
-import scipy.ndimage as NI
 import matplotlib.cm as cm
 import matplotlib.mlab as mlab
 
+def smooth1d(x, window_len):
+ # copied from http://www.scipy.org/Cookbook/SignalSmooth
 
+ s=np.r_[2*x[0]-x[window_len:1:-1],x,2*x[-1]-x[-1:-window_len:-1]]
+ w = np.hanning(window_len)
+ y=np.convolve(w/w.sum(),s,mode='same')
+ return y[window_len-1:-window_len+1]
+
+def smooth2d(A, sigma=3):
+
+ window_len = max(int(sigma), 3)*2+1
+ A1 = np.array([smooth1d(x, window_len) for x in np.asarray(A)])
+ A2 = np.transpose(A1)
+ A3 = np.array([smooth1d(x, window_len) for x in A2])
+ A4 = np.transpose(A3)
+
+ return A4
+
+
+
+
 class BaseFilter(object):
 def prepare_image(self, src_image, dpi, pad):
 ny, nx, depth = src_image.shape
@@ -58,8 +77,9 @@
 def process_image(self, padded_src, dpi):
 #offsetx, offsety = int(self.offsets[0]), int(self.offsets[1])
 tgt_image = np.zeros_like(padded_src)
- tgt_image[:,:,-1] = NI.gaussian_filter(padded_src[:,:,-1]*self.alpha,
- self.sigma)
+ aa = smooth2d(padded_src[:,:,-1]*self.alpha,
+ self.sigma)
+ tgt_image[:,:,-1] = aa
 tgt_image[:,:,:-1] = self.color
 return tgt_image
 
@@ -123,7 +143,7 @@
 alpha = new_im[:,:,3]
 alpha.fill(0)
 alpha[pad:-pad, pad:-pad] = im[:,:,-1]
- alpha2 = NI.grey_dilation(alpha, size=(self.pixels, self.pixels))
+ alpha2 = np.clip(smooth2d(alpha, self.pixels) * 5, 0, 1)
 new_im[:,:,-1] = alpha2
 new_im[:,:,:-1] = self.color
 offsetx, offsety = -pad, -pad
@@ -208,7 +228,7 @@
 mec="r", mfc="w", lw=5, mew=3, ms=10, label="Line 1")
 
 
- gauss = DropShadowFilter(2)
+ gauss = DropShadowFilter(4)
 
 for l in [l1, l2]:
 
@@ -257,7 +277,7 @@
 rects2 = ax.bar(ind+width+0.1, womenMeans, width, color='y', ec="w", lw=2)
 
 #gauss = GaussianFilter(1.5, offsets=(1,1), )
- gauss = DropShadowFilter(1.5, offsets=(1,1), )
+ gauss = DropShadowFilter(5, offsets=(1,1), )
 shadow = FilteredArtistList(rects1+rects2, gauss)
 ax.add_artist(shadow)
 shadow.set_zorder(rects1[0].get_zorder()-0.1)
@@ -275,21 +295,21 @@
 pies = ax.pie(fracs, explode=explode)
 ax.patch.set_visible(True)
 
- light_filter = LightFilter(8)
+ light_filter = LightFilter(9)
 for p in pies[0]:
 p.set_agg_filter(light_filter)
 p.set_rasterized(True) # to support mixed-mode renderers
 p.set(ec="none",
 lw=2)
 
- gauss = DropShadowFilter(3, offsets=(3,4), alpha=0.7)
+ gauss = DropShadowFilter(9, offsets=(3,4), alpha=0.7)
 shadow = FilteredArtistList(pies[0], gauss)
 ax.add_artist(shadow)
 shadow.set_zorder(pies[0][0].get_zorder()-0.1)
 
 
 if 1:
-
+ 
 plt.figure(1, figsize=(6, 6))
 plt.subplots_adjust(left=0.05, right=0.95)
 
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 によって変換されたページ (->オリジナル) /