You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
(12) |
Sep
(12) |
Oct
(56) |
Nov
(65) |
Dec
(37) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(59) |
Feb
(78) |
Mar
(153) |
Apr
(205) |
May
(184) |
Jun
(123) |
Jul
(171) |
Aug
(156) |
Sep
(190) |
Oct
(120) |
Nov
(154) |
Dec
(223) |
2005 |
Jan
(184) |
Feb
(267) |
Mar
(214) |
Apr
(286) |
May
(320) |
Jun
(299) |
Jul
(348) |
Aug
(283) |
Sep
(355) |
Oct
(293) |
Nov
(232) |
Dec
(203) |
2006 |
Jan
(352) |
Feb
(358) |
Mar
(403) |
Apr
(313) |
May
(165) |
Jun
(281) |
Jul
(316) |
Aug
(228) |
Sep
(279) |
Oct
(243) |
Nov
(315) |
Dec
(345) |
2007 |
Jan
(260) |
Feb
(323) |
Mar
(340) |
Apr
(319) |
May
(290) |
Jun
(296) |
Jul
(221) |
Aug
(292) |
Sep
(242) |
Oct
(248) |
Nov
(242) |
Dec
(332) |
2008 |
Jan
(312) |
Feb
(359) |
Mar
(454) |
Apr
(287) |
May
(340) |
Jun
(450) |
Jul
(403) |
Aug
(324) |
Sep
(349) |
Oct
(385) |
Nov
(363) |
Dec
(437) |
2009 |
Jan
(500) |
Feb
(301) |
Mar
(409) |
Apr
(486) |
May
(545) |
Jun
(391) |
Jul
(518) |
Aug
(497) |
Sep
(492) |
Oct
(429) |
Nov
(357) |
Dec
(310) |
2010 |
Jan
(371) |
Feb
(657) |
Mar
(519) |
Apr
(432) |
May
(312) |
Jun
(416) |
Jul
(477) |
Aug
(386) |
Sep
(419) |
Oct
(435) |
Nov
(320) |
Dec
(202) |
2011 |
Jan
(321) |
Feb
(413) |
Mar
(299) |
Apr
(215) |
May
(284) |
Jun
(203) |
Jul
(207) |
Aug
(314) |
Sep
(321) |
Oct
(259) |
Nov
(347) |
Dec
(209) |
2012 |
Jan
(322) |
Feb
(414) |
Mar
(377) |
Apr
(179) |
May
(173) |
Jun
(234) |
Jul
(295) |
Aug
(239) |
Sep
(276) |
Oct
(355) |
Nov
(144) |
Dec
(108) |
2013 |
Jan
(170) |
Feb
(89) |
Mar
(204) |
Apr
(133) |
May
(142) |
Jun
(89) |
Jul
(160) |
Aug
(180) |
Sep
(69) |
Oct
(136) |
Nov
(83) |
Dec
(32) |
2014 |
Jan
(71) |
Feb
(90) |
Mar
(161) |
Apr
(117) |
May
(78) |
Jun
(94) |
Jul
(60) |
Aug
(83) |
Sep
(102) |
Oct
(132) |
Nov
(154) |
Dec
(96) |
2015 |
Jan
(45) |
Feb
(138) |
Mar
(176) |
Apr
(132) |
May
(119) |
Jun
(124) |
Jul
(77) |
Aug
(31) |
Sep
(34) |
Oct
(22) |
Nov
(23) |
Dec
(9) |
2016 |
Jan
(26) |
Feb
(17) |
Mar
(10) |
Apr
(8) |
May
(4) |
Jun
(8) |
Jul
(6) |
Aug
(5) |
Sep
(9) |
Oct
(4) |
Nov
|
Dec
|
2017 |
Jan
(5) |
Feb
(7) |
Mar
(1) |
Apr
(5) |
May
|
Jun
(3) |
Jul
(6) |
Aug
(1) |
Sep
|
Oct
(2) |
Nov
(1) |
Dec
|
2018 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2025 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
1
(2) |
2
(32) |
3
(26) |
4
(29) |
5
(41) |
6
(2) |
7
(1) |
8
(13) |
9
(15) |
10
(23) |
11
(23) |
12
(16) |
13
(6) |
14
(15) |
15
(4) |
16
(18) |
17
(28) |
18
(17) |
19
(11) |
20
(6) |
21
(2) |
22
(4) |
23
(1) |
24
|
25
|
26
(1) |
27
(2) |
28
(2) |
29
(3) |
30
(10) |
31
(2) |
|
|
|
Sweet! That should *defiintely* go into the mpl gallery, and honestly I'd love for it to be cleaned up enough to be usable to style generically any plot, much like the mathematica code I linked to earlier does. It would be a beautiful demonstration of matplotlib's capabilities, and furthermore, I can imagine it being useful in practice. If I want to make a purely 'qualitative' diagram, something in this style actually looks great and I prefer it to something that looks more like a 'real data' plot. Thanks everyone for the enthusiasm with which you took this and ran with it! Cheers, f On Thu, Oct 4, 2012 at 2:39 PM, Damon McDougall <dam...@gm...> wrote: > On Thu, Oct 4, 2012 at 10:09 PM, Juergen Hasch <py...@el...> wrote: >> Here is my take on it as an IPython notebook, based on Damon's code: >> http://nbviewer.ipython.org/3835181/ >> >> I took the engineering approach and filtered the random function instead of doing some fft/ifft magic. >> Also, X and Y of the functions are affected now, giving them a more "natural" look in the slopes. >> >> Juergen > > I think I actually prefer your output over mine :) > Nice job. > > -- > Damon McDougall > http://www.damon-is-a-geek.com > B2.39 > Mathematics Institute > University of Warwick > Coventry > West Midlands > CV4 7AL > United Kingdom > > ------------------------------------------------------------------------------ > Don't let slow site performance ruin your business. Deploy New Relic APM > Deploy New Relic app performance management and know exactly > what is happening inside your Ruby, Python, PHP, Java, and .NET app > Try New Relic at no cost today and get our sweet Data Nerd shirt too! > http://p.sf.net/sfu/newrelic-dev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
On Thu, Oct 4, 2012 at 10:09 PM, Juergen Hasch <py...@el...> wrote: > Here is my take on it as an IPython notebook, based on Damon's code: > http://nbviewer.ipython.org/3835181/ > > I took the engineering approach and filtered the random function instead of doing some fft/ifft magic. > Also, X and Y of the functions are affected now, giving them a more "natural" look in the slopes. > > Juergen I think I actually prefer your output over mine :) Nice job. -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom
Here is my take on it as an IPython notebook, based on Damon's code: http://nbviewer.ipython.org/3835181/ I took the engineering approach and filtered the random function instead of doing some fft/ifft magic. Also, X and Y of the functions are affected now, giving them a more "natural" look in the slopes. Juergen Am 04.10.2012 18:09, schrieb Pierre Haessig: > Le 04/10/2012 16:35, Pierre Haessig a écrit : >> So I think this code indeed resamples the rastered plot image on a >> shaken coordinate grid. I kind of understand that the noise on >> coordinates is spatially smoothed by a 10px Gaussian Point Spread >> Function (if I understand correctly...) > I've implemented this processing in a tiny "image_shake" script. > https://gist.github.com/3834536 > A nice occasion to learn how to use some scipy image processing functions... > > I've attached the before/after images because I didn't manage to put > them in the Gist (it's not a plot image but gives the idea of line shaking). > > Now, I think it's unfortunately outside the frame of Fernando's > challenge, because this script uses zero matplotlib methods!! > > Best, > Pierre
On 10/04/2012 03:51 PM, Benjamin Root wrote: > > > On Thu, Oct 4, 2012 at 10:02 AM, Andreas Mueller > <amu...@ai... <mailto:amu...@ai...>> wrote: > > Hi everybody. > I have been trying to save some animations I made and I > encountered the problem mentioned here > <http://sourceforge.net/mailarchive/forum.php?thread_name=CAKH0P%2BVLXthNCAZ1K2pKHYqqPiFHP5iXSFwJvEerVmvtmgGv0g%40mail.gmail.com&forum_name=matplotlib-devel>. > I am using current master. > To be precise, when I use > anim.save("file.mp4", fps=10, extra_args=['-vcodec', 'libx264']) > I get "RuntimeError: Error writing to file" from the agg backend. > If I don't use the extra_args, it works, but I get very, very bad > quality that can not be redeemed using bitrate. > I have ffmpeg and libx264 installed. I also tried the mencoder by > passing > MencoderWriter() to save, but that resulted in a video where all > frames are identical. > > Any help on this would be appreciated. Is there an easy way to > just dump > the frames? I can do the mencoder bit myself. > > Thanks, > Andy > > > Exactly which version of mpl are you using, and what is your > platform? This will help us diagnose what is going on. > Thanks for the quick answer. I am not on the box but I used master from yesterday, so 89482b21c8582d49a2ddc2865e472eb404fd07e2 <https://github.com/matplotlib/matplotlib/commit/89482b21c8582d49a2ddc2865e472eb404fd07e2>, I guess. The platform is Ubuntu Precise (with loads of random Python packages, but that seems somewhat unrelated). Cheers, Andy
Replying back to the mailing list so that others can see your response.... On Thu, Oct 4, 2012 at 12:53 PM, Andreas Mueller <amu...@ai...>wrote: > Thanks for the quick answer. > I am not on the box but I used master from yesterday, so > 89482b21c8582d49a2ddc2865e472eb404fd07e2<https://github.com/matplotlib/matplotlib/commit/89482b21c8582d49a2ddc2865e472eb404fd07e2>, > I guess. > The platform is Ubuntu Precise (with loads of random Python packages, but > that seems somewhat unrelated). > Cheers, > Andy > >
Le 04/10/2012 16:35, Pierre Haessig a écrit : > So I think this code indeed resamples the rastered plot image on a > shaken coordinate grid. I kind of understand that the noise on > coordinates is spatially smoothed by a 10px Gaussian Point Spread > Function (if I understand correctly...) I've implemented this processing in a tiny "image_shake" script. https://gist.github.com/3834536 A nice occasion to learn how to use some scipy image processing functions... I've attached the before/after images because I didn't manage to put them in the Gist (it's not a plot image but gives the idea of line shaking). Now, I think it's unfortunately outside the frame of Fernando's challenge, because this script uses zero matplotlib methods!! Best, Pierre
Le 04/10/2012 16:54, Damon McDougall a écrit : > Adding Gaussian noise to each point on a function doesn't look nice. > That's why I produced a random function in Fourier space first. That > way, random functions still have some sense of smoothness. Mathematica code seems to use a Gaussian *smoothing* of a uniform noise. I understand this as the spatial-domain-way (using convolution) to get some smoothness while you've taken the frequency-domain path. It's a matter of taste and I guess that both ways should be ok ! Best, Pierre
On 10/04/2012 10:29 AM, Benjamin Root wrote: > > > On Thu, Oct 4, 2012 at 10:11 AM, Michael Droettboom <md...@st... > <mailto:md...@st...>> wrote: > > Yes -- this would be a great application for the path filtering > infrastructure that matplotlib has. > > Mike > > > I agree with this idea. However, I don't think the code is set up to > allow for user-defined path filters. Maybe an AGG filter would be > sufficient in the short-term? > We have a complete set of path filters in C++ in path_converters.h that are used by most of the backends. It's not really user-defined because it can't be extended from Python, but it should be sufficient to put it in there and have it work everywhere. Mike
On Thu, Oct 4, 2012 at 3:35 PM, Pierre Haessig <pie...@cr...> wrote: > Le 04/10/2012 16:03, Jason Grout a écrit : >> f@r means f(r) >> >> a~ImageConvolve~b means ImageConvolve(a,b) (~ treats an operator as infix) >> >> Table[..., {2}] means [... for i in range(2)] >> >> #+1& is a lambda function lambda x: x+1 >> >> So I think it goes something like: >> >> def xkcdDistort(p): >> r = ImagePad(Rasterize(p), 10, Padding='White') >> (ix, iy) = [ImageConvolve(RandomImage([-1,1], ImageDimensions(r)), >> GaussianMatrix(10)) >> for i in range(2)] >> return ImagePad(ImageTransformation(r, >> lambda coord: (coord[0]+15*ImageValue(ix, coord), >> coord[1]+15*ImageValue(iy, coord)), >> DataRange='Full'), >> -5) > Thanks a lot! > > It's the first time I encounter Mathematica syntax. Some of these > functional notations are not so easy to follow for my unexperienced eyes > but it makes this Mathematica code nicely compact. > > So I think this code indeed resamples the rastered plot image on a > shaken coordinate grid. I kind of understand that the noise on > coordinates is spatially smoothed by a 10px Gaussian Point Spread > Function (if I understand correctly...) > > Best, > Pierre Adding Gaussian noise to each point on a function doesn't look nice. That's why I produced a random function in Fourier space first. That way, random functions still have some sense of smoothness. -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom
On Thu, Oct 4, 2012 at 10:02 AM, Andreas Mueller <amu...@ai...>wrote: > Hi everybody. > I have been trying to save some animations I made and I encountered the > problem mentioned here<http://sourceforge.net/mailarchive/forum.php?thread_name=CAKH0P%2BVLXthNCAZ1K2pKHYqqPiFHP5iXSFwJvEerVmvtmgGv0g%40mail.gmail.com&forum_name=matplotlib-devel> > . > I am using current master. > To be precise, when I use > anim.save("file.mp4", fps=10, extra_args=['-vcodec', 'libx264']) > I get "RuntimeError: Error writing to file" from the agg backend. > If I don't use the extra_args, it works, but I get very, very bad > quality that can not be redeemed using bitrate. > I have ffmpeg and libx264 installed. I also tried the mencoder by passing > MencoderWriter() to save, but that resulted in a video where all frames > are identical. > > Any help on this would be appreciated. Is there an easy way to just dump > the frames? I can do the mencoder bit myself. > > Thanks, > Andy > > Exactly which version of mpl are you using, and what is your platform? This will help us diagnose what is going on. Cheers! Ben Root
On Thu, Oct 4, 2012 at 10:41 AM, Jason Grout <jas...@cr...>wrote: > On 10/4/12 9:11 AM, Michael Droettboom wrote: > > Yes -- this would be a great application for the path filtering > > infrastructure that matplotlib has. > > > Is that the same as the path effects features, like > http://matplotlib.org/examples/pylab_examples/patheffect_demo.html ? > > Thanks, > > Jason > > Slightly different. That is through the AGG layer, so vector-based backends wouldn't benefit, IIRC. That being said, this is probably the better place to implement this (maybe this is what Mike was thinking of?). Ben Root
On Thu, Oct 4, 2012 at 10:39 AM, Pierre Haessig <pie...@cr...>wrote: > Le 04/10/2012 16:11, Michael Droettboom a écrit : > > Yes -- this would be a great application for the path filtering > > infrastructure that matplotlib has. > Sounds way cooler than post-processing a raster plot image ! > > I'm not aware of this path filtering infrastructure. I guess it's a > deeply buried facility which is not accessible in the "Python user space" ? > > Best, > Pierre > > That is correct. In path.so, there are some functions that are explicitly called to do any cleanup and simplification on the paths. We would have to do some work to allow for user-defined functions. I once considered doing this back in the beginning of summer to address some contouring "bugs" I encountered, but found other, more simple solutions. Cheers! Ben Root
On 10/4/12 9:11 AM, Michael Droettboom wrote: > Yes -- this would be a great application for the path filtering > infrastructure that matplotlib has. Is that the same as the path effects features, like http://matplotlib.org/examples/pylab_examples/patheffect_demo.html ? Thanks, Jason
Le 04/10/2012 16:11, Michael Droettboom a écrit : > Yes -- this would be a great application for the path filtering > infrastructure that matplotlib has. Sounds way cooler than post-processing a raster plot image ! I'm not aware of this path filtering infrastructure. I guess it's a deeply buried facility which is not accessible in the "Python user space" ? Best, Pierre
Le 04/10/2012 16:03, Jason Grout a écrit : > f@r means f(r) > > a~ImageConvolve~b means ImageConvolve(a,b) (~ treats an operator as infix) > > Table[..., {2}] means [... for i in range(2)] > > #+1& is a lambda function lambda x: x+1 > > So I think it goes something like: > > def xkcdDistort(p): > r = ImagePad(Rasterize(p), 10, Padding='White') > (ix, iy) = [ImageConvolve(RandomImage([-1,1], ImageDimensions(r)), > GaussianMatrix(10)) > for i in range(2)] > return ImagePad(ImageTransformation(r, > lambda coord: (coord[0]+15*ImageValue(ix, coord), > coord[1]+15*ImageValue(iy, coord)), > DataRange='Full'), > -5) Thanks a lot! It's the first time I encounter Mathematica syntax. Some of these functional notations are not so easy to follow for my unexperienced eyes but it makes this Mathematica code nicely compact. So I think this code indeed resamples the rastered plot image on a shaken coordinate grid. I kind of understand that the noise on coordinates is spatially smoothed by a 10px Gaussian Point Spread Function (if I understand correctly...) Best, Pierre
On Thu, Oct 4, 2012 at 10:11 AM, Michael Droettboom <md...@st...> wrote: > Yes -- this would be a great application for the path filtering > infrastructure that matplotlib has. > > Mike > > I agree with this idea. However, I don't think the code is set up to allow for user-defined path filters. Maybe an AGG filter would be sufficient in the short-term? Ben Root
This is just too cool of an idea to pass up -- I'm going to see if I can put together a PR that does this using the C++ path filtering stuff so it would be available everywhere. Mike On 10/04/2012 10:11 AM, Michael Droettboom wrote: > Yes -- this would be a great application for the path filtering > infrastructure that matplotlib has. > > Mike > > On 10/04/2012 08:29 AM, Phil Elson wrote: >> Nice challenge Fernando! >> >> Damon, I love the solution! I do wonder whether we could do some >> quirky transform on the lines to achieve a similar result, rather than >> manipulating the data before plotting it. The benefit is that >> everything should then get randomly Xkcd-ed automatically - maybe I >> will save that one for a rainy day.... >> >> Thanks for posting! >> >> >> >> On 4 October 2012 11:31, Damon McDougall <dam...@gm...> wrote: >>> On Thu, Oct 4, 2012 at 10:44 AM, Damon McDougall >>> <dam...@gm...> wrote: >>>> On Thu, Oct 4, 2012 at 10:02 AM, Pierre Haessig >>>> <pie...@cr...> wrote: >>>>> Hi Fernando, >>>>> >>>>> Le 04/10/2012 09:16, Fernando Perez a écrit : >>>>>> This would make for an awesome couple of examples for the gallery, the >>>>>> mathematica solutions look really pretty cool: >>>>>> >>>>>> http://mathematica.stackexchange.com/questions/11350/xkcd-style-graphs >>>>> I've never used Mathematica so that it's pretty difficult for me to >>>>> understand the following lines of code which I guess do the main job of >>>>> distorting the image >>>>> >>>>> xkcdDistort[p_] := Module[{r, ix, iy}, >>>>> r = ImagePad[Rasterize@p, 10, Padding -> White]; >>>>> {ix, iy} = >>>>> Table[RandomImage[{-1, 1}, ImageDimensions@r]~ImageConvolve~ >>>>> GaussianMatrix[10], {2}]; >>>>> ImagePad[ImageTransformation[r, >>>>> # + 15 {ImageValue[ix, #], ImageValue[iy, #]} &, DataRange -> >>>>> Full], -5]]; >>>>> >>>>> >>>>> Is there somebody there that can describe this algorithm with words >>>>> (English or Python ;-)) ? >>>>> >>>>> I feel like the key point is about adressing the rasterized plot image >>>>> "r" with some slightly randomized indices "ix" and "iy". However, I >>>>> really don't get the step that generates these indices. >>>>> >>>>> Best, >>>>> Pierre >>>> I believe this is in your interests: http://i.imgur.com/5XwRO.png >>>> >>>> Here's the code: https://gist.github.com/3832579 >>>> >>>> Disclaimer: The code is ugly; don't judge me. Also, I installed the >>>> Humor Sans font but I couldn't get mpl to find it. Oh well :) >>> I got the font working :) http://i.imgur.com/Dxemm.png >>> >>> -- >>> Damon McDougall >>> http://www.damon-is-a-geek.com >>> B2.39 >>> Mathematics Institute >>> University of Warwick >>> Coventry >>> West Midlands >>> CV4 7AL >>> United Kingdom >>> >>> ------------------------------------------------------------------------------ >>> Don't let slow site performance ruin your business. Deploy New Relic APM >>> Deploy New Relic app performance management and know exactly >>> what is happening inside your Ruby, Python, PHP, Java, and .NET app >>> Try New Relic at no cost today and get our sweet Data Nerd shirt too! >>> http://p.sf.net/sfu/newrelic-dev2dev >>> _______________________________________________ >>> Matplotlib-users mailing list >>> Mat...@li... >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> ------------------------------------------------------------------------------ >> Don't let slow site performance ruin your business. Deploy New Relic APM >> Deploy New Relic app performance management and know exactly >> what is happening inside your Ruby, Python, PHP, Java, and .NET app >> Try New Relic at no cost today and get our sweet Data Nerd shirt too! >> http://p.sf.net/sfu/newrelic-dev2dev >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > ------------------------------------------------------------------------------ > Don't let slow site performance ruin your business. Deploy New Relic APM > Deploy New Relic app performance management and know exactly > what is happening inside your Ruby, Python, PHP, Java, and .NET app > Try New Relic at no cost today and get our sweet Data Nerd shirt too! > http://p.sf.net/sfu/newrelic-dev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Le 04/10/2012 14:29, Phil Elson a écrit : > Damon, I love the solution! I do wonder whether we could do some > quirky transform on the lines to achieve a similar result, rather than > manipulating the data before plotting it. The benefit is that > everything should then get randomly Xkcd-ed automatically - maybe I > will save that one for a rainy day.... > > A different solution to get the shaken effect on every graphic items is the post-processing of a raster rendering of the plot. I think this is what was proposed with Mathematica though I'm really unfamiliar with its syntax One way I see to "shake" on image would be to use scipy.ndimage.interpolation.map_coordinates [1] to interpolate the rastered plot image with a "shaken grid". This shaken grid would be a regular 2D indexing grid + some 2D noise, carefully tuned to have a bit of spatial correlation. I'm not so familiar with image processing in Python though, so there may be better solutions I'm not aware of. Best, Pierre [1] http://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.interpolation.map_coordinates.htm
On 10/4/12 4:02 AM, Pierre Haessig wrote: > Hi Fernando, > > Le 04/10/2012 09:16, Fernando Perez a écrit : >> This would make for an awesome couple of examples for the gallery, the >> mathematica solutions look really pretty cool: >> >> http://mathematica.stackexchange.com/questions/11350/xkcd-style-graphs > I've never used Mathematica so that it's pretty difficult for me to > understand the following lines of code which I guess do the main job of > distorting the image > > xkcdDistort[p_] := Module[{r, ix, iy}, > r = ImagePad[Rasterize@p, 10, Padding -> White]; > {ix, iy} = > Table[RandomImage[{-1, 1}, ImageDimensions@r]~ImageConvolve~ > GaussianMatrix[10], {2}]; > ImagePad[ImageTransformation[r, > # + 15 {ImageValue[ix, #], ImageValue[iy, #]} &, DataRange -> > Full], -5]]; > > > Is there somebody there that can describe this algorithm with words > (English or Python ;-)) ? f@r means f(r) a~ImageConvolve~b means ImageConvolve(a,b) (~ treats an operator as infix) Table[..., {2}] means [... for i in range(2)] #+1& is a lambda function lambda x: x+1 So I think it goes something like: def xkcdDistort(p): r = ImagePad(Rasterize(p), 10, Padding='White') (ix, iy) = [ImageConvolve(RandomImage([-1,1], ImageDimensions(r)), GaussianMatrix(10)) for i in range(2)] return ImagePad(ImageTransformation(r, lambda coord: (coord[0]+15*ImageValue(ix, coord), coord[1]+15*ImageValue(iy, coord)), DataRange='Full'), -5) Thanks, Jason
Yes -- this would be a great application for the path filtering infrastructure that matplotlib has. Mike On 10/04/2012 08:29 AM, Phil Elson wrote: > Nice challenge Fernando! > > Damon, I love the solution! I do wonder whether we could do some > quirky transform on the lines to achieve a similar result, rather than > manipulating the data before plotting it. The benefit is that > everything should then get randomly Xkcd-ed automatically - maybe I > will save that one for a rainy day.... > > Thanks for posting! > > > > On 4 October 2012 11:31, Damon McDougall <dam...@gm...> wrote: >> On Thu, Oct 4, 2012 at 10:44 AM, Damon McDougall >> <dam...@gm...> wrote: >>> On Thu, Oct 4, 2012 at 10:02 AM, Pierre Haessig >>> <pie...@cr...> wrote: >>>> Hi Fernando, >>>> >>>> Le 04/10/2012 09:16, Fernando Perez a écrit : >>>>> This would make for an awesome couple of examples for the gallery, the >>>>> mathematica solutions look really pretty cool: >>>>> >>>>> http://mathematica.stackexchange.com/questions/11350/xkcd-style-graphs >>>> I've never used Mathematica so that it's pretty difficult for me to >>>> understand the following lines of code which I guess do the main job of >>>> distorting the image >>>> >>>> xkcdDistort[p_] := Module[{r, ix, iy}, >>>> r = ImagePad[Rasterize@p, 10, Padding -> White]; >>>> {ix, iy} = >>>> Table[RandomImage[{-1, 1}, ImageDimensions@r]~ImageConvolve~ >>>> GaussianMatrix[10], {2}]; >>>> ImagePad[ImageTransformation[r, >>>> # + 15 {ImageValue[ix, #], ImageValue[iy, #]} &, DataRange -> >>>> Full], -5]]; >>>> >>>> >>>> Is there somebody there that can describe this algorithm with words >>>> (English or Python ;-)) ? >>>> >>>> I feel like the key point is about adressing the rasterized plot image >>>> "r" with some slightly randomized indices "ix" and "iy". However, I >>>> really don't get the step that generates these indices. >>>> >>>> Best, >>>> Pierre >>> I believe this is in your interests: http://i.imgur.com/5XwRO.png >>> >>> Here's the code: https://gist.github.com/3832579 >>> >>> Disclaimer: The code is ugly; don't judge me. Also, I installed the >>> Humor Sans font but I couldn't get mpl to find it. Oh well :) >> I got the font working :) http://i.imgur.com/Dxemm.png >> >> -- >> Damon McDougall >> http://www.damon-is-a-geek.com >> B2.39 >> Mathematics Institute >> University of Warwick >> Coventry >> West Midlands >> CV4 7AL >> United Kingdom >> >> ------------------------------------------------------------------------------ >> Don't let slow site performance ruin your business. Deploy New Relic APM >> Deploy New Relic app performance management and know exactly >> what is happening inside your Ruby, Python, PHP, Java, and .NET app >> Try New Relic at no cost today and get our sweet Data Nerd shirt too! >> http://p.sf.net/sfu/newrelic-dev2dev >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users > ------------------------------------------------------------------------------ > Don't let slow site performance ruin your business. Deploy New Relic APM > Deploy New Relic app performance management and know exactly > what is happening inside your Ruby, Python, PHP, Java, and .NET app > Try New Relic at no cost today and get our sweet Data Nerd shirt too! > http://p.sf.net/sfu/newrelic-dev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Hi everybody. I have been trying to save some animations I made and I encountered the problem mentioned here <http://sourceforge.net/mailarchive/forum.php?thread_name=CAKH0P%2BVLXthNCAZ1K2pKHYqqPiFHP5iXSFwJvEerVmvtmgGv0g%40mail.gmail.com&forum_name=matplotlib-devel>. I am using current master. To be precise, when I use anim.save("file.mp4", fps=10, extra_args=['-vcodec', 'libx264']) I get "RuntimeError: Error writing to file" from the agg backend. If I don't use the extra_args, it works, but I get very, very bad quality that can not be redeemed using bitrate. I have ffmpeg and libx264 installed. I also tried the mencoder by passing MencoderWriter() to save, but that resulted in a video where all frames are identical. Any help on this would be appreciated. Is there an easy way to just dump the frames? I can do the mencoder bit myself. Thanks, Andy
Nice challenge Fernando! Damon, I love the solution! I do wonder whether we could do some quirky transform on the lines to achieve a similar result, rather than manipulating the data before plotting it. The benefit is that everything should then get randomly Xkcd-ed automatically - maybe I will save that one for a rainy day.... Thanks for posting! On 4 October 2012 11:31, Damon McDougall <dam...@gm...> wrote: > On Thu, Oct 4, 2012 at 10:44 AM, Damon McDougall > <dam...@gm...> wrote: >> On Thu, Oct 4, 2012 at 10:02 AM, Pierre Haessig >> <pie...@cr...> wrote: >>> Hi Fernando, >>> >>> Le 04/10/2012 09:16, Fernando Perez a écrit : >>>> This would make for an awesome couple of examples for the gallery, the >>>> mathematica solutions look really pretty cool: >>>> >>>> http://mathematica.stackexchange.com/questions/11350/xkcd-style-graphs >>> I've never used Mathematica so that it's pretty difficult for me to >>> understand the following lines of code which I guess do the main job of >>> distorting the image >>> >>> xkcdDistort[p_] := Module[{r, ix, iy}, >>> r = ImagePad[Rasterize@p, 10, Padding -> White]; >>> {ix, iy} = >>> Table[RandomImage[{-1, 1}, ImageDimensions@r]~ImageConvolve~ >>> GaussianMatrix[10], {2}]; >>> ImagePad[ImageTransformation[r, >>> # + 15 {ImageValue[ix, #], ImageValue[iy, #]} &, DataRange -> >>> Full], -5]]; >>> >>> >>> Is there somebody there that can describe this algorithm with words >>> (English or Python ;-)) ? >>> >>> I feel like the key point is about adressing the rasterized plot image >>> "r" with some slightly randomized indices "ix" and "iy". However, I >>> really don't get the step that generates these indices. >>> >>> Best, >>> Pierre >> >> I believe this is in your interests: http://i.imgur.com/5XwRO.png >> >> Here's the code: https://gist.github.com/3832579 >> >> Disclaimer: The code is ugly; don't judge me. Also, I installed the >> Humor Sans font but I couldn't get mpl to find it. Oh well :) > > I got the font working :) http://i.imgur.com/Dxemm.png > > -- > Damon McDougall > http://www.damon-is-a-geek.com > B2.39 > Mathematics Institute > University of Warwick > Coventry > West Midlands > CV4 7AL > United Kingdom > > ------------------------------------------------------------------------------ > Don't let slow site performance ruin your business. Deploy New Relic APM > Deploy New Relic app performance management and know exactly > what is happening inside your Ruby, Python, PHP, Java, and .NET app > Try New Relic at no cost today and get our sweet Data Nerd shirt too! > http://p.sf.net/sfu/newrelic-dev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
On Thu, Oct 4, 2012 at 10:44 AM, Damon McDougall <dam...@gm...> wrote: > On Thu, Oct 4, 2012 at 10:02 AM, Pierre Haessig > <pie...@cr...> wrote: >> Hi Fernando, >> >> Le 04/10/2012 09:16, Fernando Perez a écrit : >>> This would make for an awesome couple of examples for the gallery, the >>> mathematica solutions look really pretty cool: >>> >>> http://mathematica.stackexchange.com/questions/11350/xkcd-style-graphs >> I've never used Mathematica so that it's pretty difficult for me to >> understand the following lines of code which I guess do the main job of >> distorting the image >> >> xkcdDistort[p_] := Module[{r, ix, iy}, >> r = ImagePad[Rasterize@p, 10, Padding -> White]; >> {ix, iy} = >> Table[RandomImage[{-1, 1}, ImageDimensions@r]~ImageConvolve~ >> GaussianMatrix[10], {2}]; >> ImagePad[ImageTransformation[r, >> # + 15 {ImageValue[ix, #], ImageValue[iy, #]} &, DataRange -> >> Full], -5]]; >> >> >> Is there somebody there that can describe this algorithm with words >> (English or Python ;-)) ? >> >> I feel like the key point is about adressing the rasterized plot image >> "r" with some slightly randomized indices "ix" and "iy". However, I >> really don't get the step that generates these indices. >> >> Best, >> Pierre > > I believe this is in your interests: http://i.imgur.com/5XwRO.png > > Here's the code: https://gist.github.com/3832579 > > Disclaimer: The code is ugly; don't judge me. Also, I installed the > Humor Sans font but I couldn't get mpl to find it. Oh well :) I got the font working :) http://i.imgur.com/Dxemm.png -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom
If you like to use qt4 as backend, you can also do it like this: import sys from PySide import QtGui import numpy as np from matplotlib.figure import Figure from matplotlib.backends.backend_qt4agg \ import FigureCanvasQTAgg as FigureCanvas fig = Figure() axes = fig.add_subplot(111) x = np.arange(0.0, 3.0, 0.01) y = np.cos(2*np.pi*x) axes.plot(x, y) # show plot in Qt FigureCanvas qApp = QtGui.QApplication(sys.argv) fc=FigureCanvas(fig) fc.setGeometry(2000, 100, 500, 500) fc.show() # a second plot fc1=FigureCanvas(fig) fc1.setGeometry(500, 100, 500, 500) fc1.show() sys.exit(qApp.exec_()) This works for me on windows with two screens. Juergen Am 03.10.2012 20:26, schrieb Gökhan Sever: > I was after a similar issue once, and asked this question at SO: > > http://stackoverflow.com/questions/7802366/matplotlib-window-layout-questions > > Manual positioning is fine sometimes if I want to really place windows > side-by-side for comparison purposes. However it would be nicer if mpl were > to remember positions of figures so that it would place the new figures > exactly the same place where they were before closed. > > Actually, I have similar complaint for other windows opened in my Fedora 16 > (Gnome 3.2) system. Say for instance I start a gvim instance, then move its > window to my second monitor, but closing and re-opening it, the window's > position is restored to the first monitor. Same thing is for evince, > sometimes it opens pdf's on the first monitor, sometimes on the second, > randomly position at least for my observation. I don't know where to look > for a solution; in each specific program, or windows manager should handle > / remember positions of windows on screens. > > On Tue, Oct 2, 2012 at 9:38 PM, Jianbao Tao <jia...@gm...> wrote: > >> Hi, >> >> Is it possible to specify the position of a figure window when one is >> created? This will be a killing feature if one wants to put the figure >> window at the right place in the screen automatically. It is annoying if >> ones has to drag a new figure to a comfortable place in the screen every >> time a new figure is created. >> >> Jianbao >> >> >> ------------------------------------------------------------------------------ >> Don't let slow site performance ruin your business. Deploy New Relic APM >> Deploy New Relic app performance management and know exactly >> what is happening inside your Ruby, Python, PHP, Java, and .NET app >> Try New Relic at no cost today and get our sweet Data Nerd shirt too! >> http://p.sf.net/sfu/newrelic-dev2dev >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> > > > > > ------------------------------------------------------------------------------ > Don't let slow site performance ruin your business. Deploy New Relic APM > Deploy New Relic app performance management and know exactly > what is happening inside your Ruby, Python, PHP, Java, and .NET app > Try New Relic at no cost today and get our sweet Data Nerd shirt too! > http://p.sf.net/sfu/newrelic-dev2dev > > > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >
On Thu, Oct 4, 2012 at 10:02 AM, Pierre Haessig <pie...@cr...> wrote: > Hi Fernando, > > Le 04/10/2012 09:16, Fernando Perez a écrit : >> This would make for an awesome couple of examples for the gallery, the >> mathematica solutions look really pretty cool: >> >> http://mathematica.stackexchange.com/questions/11350/xkcd-style-graphs > I've never used Mathematica so that it's pretty difficult for me to > understand the following lines of code which I guess do the main job of > distorting the image > > xkcdDistort[p_] := Module[{r, ix, iy}, > r = ImagePad[Rasterize@p, 10, Padding -> White]; > {ix, iy} = > Table[RandomImage[{-1, 1}, ImageDimensions@r]~ImageConvolve~ > GaussianMatrix[10], {2}]; > ImagePad[ImageTransformation[r, > # + 15 {ImageValue[ix, #], ImageValue[iy, #]} &, DataRange -> > Full], -5]]; > > > Is there somebody there that can describe this algorithm with words > (English or Python ;-)) ? > > I feel like the key point is about adressing the rasterized plot image > "r" with some slightly randomized indices "ix" and "iy". However, I > really don't get the step that generates these indices. > > Best, > Pierre > > > ------------------------------------------------------------------------------ > Don't let slow site performance ruin your business. Deploy New Relic APM > Deploy New Relic app performance management and know exactly > what is happening inside your Ruby, Python, PHP, Java, and .NET app > Try New Relic at no cost today and get our sweet Data Nerd shirt too! > http://p.sf.net/sfu/newrelic-dev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > I believe this is in your interests: http://i.imgur.com/5XwRO.png Here's the code: https://gist.github.com/3832579 Disclaimer: The code is ugly; don't judge me. Also, I installed the Humor Sans font but I couldn't get mpl to find it. Oh well :) -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom