You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(33) |
Dec
(20) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(7) |
Feb
(44) |
Mar
(51) |
Apr
(43) |
May
(43) |
Jun
(36) |
Jul
(61) |
Aug
(44) |
Sep
(25) |
Oct
(82) |
Nov
(97) |
Dec
(47) |
2005 |
Jan
(77) |
Feb
(143) |
Mar
(42) |
Apr
(31) |
May
(93) |
Jun
(93) |
Jul
(35) |
Aug
(78) |
Sep
(56) |
Oct
(44) |
Nov
(72) |
Dec
(75) |
2006 |
Jan
(116) |
Feb
(99) |
Mar
(181) |
Apr
(171) |
May
(112) |
Jun
(86) |
Jul
(91) |
Aug
(111) |
Sep
(77) |
Oct
(72) |
Nov
(57) |
Dec
(51) |
2007 |
Jan
(64) |
Feb
(116) |
Mar
(70) |
Apr
(74) |
May
(53) |
Jun
(40) |
Jul
(519) |
Aug
(151) |
Sep
(132) |
Oct
(74) |
Nov
(282) |
Dec
(190) |
2008 |
Jan
(141) |
Feb
(67) |
Mar
(69) |
Apr
(96) |
May
(227) |
Jun
(404) |
Jul
(399) |
Aug
(96) |
Sep
(120) |
Oct
(205) |
Nov
(126) |
Dec
(261) |
2009 |
Jan
(136) |
Feb
(136) |
Mar
(119) |
Apr
(124) |
May
(155) |
Jun
(98) |
Jul
(136) |
Aug
(292) |
Sep
(174) |
Oct
(126) |
Nov
(126) |
Dec
(79) |
2010 |
Jan
(109) |
Feb
(83) |
Mar
(139) |
Apr
(91) |
May
(79) |
Jun
(164) |
Jul
(184) |
Aug
(146) |
Sep
(163) |
Oct
(128) |
Nov
(70) |
Dec
(73) |
2011 |
Jan
(235) |
Feb
(165) |
Mar
(147) |
Apr
(86) |
May
(74) |
Jun
(118) |
Jul
(65) |
Aug
(75) |
Sep
(162) |
Oct
(94) |
Nov
(48) |
Dec
(44) |
2012 |
Jan
(49) |
Feb
(40) |
Mar
(88) |
Apr
(35) |
May
(52) |
Jun
(69) |
Jul
(90) |
Aug
(123) |
Sep
(112) |
Oct
(120) |
Nov
(105) |
Dec
(116) |
2013 |
Jan
(76) |
Feb
(26) |
Mar
(78) |
Apr
(43) |
May
(61) |
Jun
(53) |
Jul
(147) |
Aug
(85) |
Sep
(83) |
Oct
(122) |
Nov
(18) |
Dec
(27) |
2014 |
Jan
(58) |
Feb
(25) |
Mar
(49) |
Apr
(17) |
May
(29) |
Jun
(39) |
Jul
(53) |
Aug
(52) |
Sep
(35) |
Oct
(47) |
Nov
(110) |
Dec
(27) |
2015 |
Jan
(50) |
Feb
(93) |
Mar
(96) |
Apr
(30) |
May
(55) |
Jun
(83) |
Jul
(44) |
Aug
(8) |
Sep
(5) |
Oct
|
Nov
(1) |
Dec
(1) |
2016 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
(3) |
Sep
(1) |
Oct
(3) |
Nov
|
Dec
|
2017 |
Jan
|
Feb
(5) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(3) |
Aug
|
Sep
(7) |
Oct
|
Nov
|
Dec
|
2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
|
|
|
|
1
(3) |
2
|
3
(2) |
4
(1) |
5
(12) |
6
(5) |
7
(3) |
8
(2) |
9
(1) |
10
(14) |
11
(11) |
12
(7) |
13
(4) |
14
(8) |
15
(2) |
16
(1) |
17
(2) |
18
(1) |
19
|
20
(1) |
21
(10) |
22
(2) |
23
(1) |
24
(1) |
25
(7) |
26
(10) |
27
(2) |
28
(1) |
29
(5) |
30
(7) |
|
|
|
|
|
|
I went ahead and committed the latest version of your patch. Thanks. This is a cool new feature. I think it's probably low-risk for having Windows problems, but having it in SVN will make it more likely for Windows users to test. Cheers, Mike Andrew Stock wrote: > Jae-Joon, > > Thanks for your comments. You have successfully found areas in my > patch that were overcomplicated! > > I have attached a new patch which doesn't alter the api of draw_image > and uses the im object as Jae-Joon suggests. > > I've tested this on Linux Python 2.5 as before, but not on Windows as > I don't have the correct development environment set up at the moment. > > Regards > > Andrew > > On Fri, Nov 7, 2008 at 10:36 AM, Jae-Joon Lee <lee...@gm...> wrote: > >> Andrew, >> >> I just had a quick look at your patch. >> I'm a bit distracted with your changes regarding the "url" support of the image. >> Do we need to change the api of the draw_image()? Can we just utilize >> "im" object as we did with the "gc"? Check the patch below. This >> simple method seem to work fine for me. >> >> I also noted that, in the __init__() methods of the Patch and the >> AxesImage class, you explicitly declare "url" as a keyword argument >> and also initialize self.url. I don't think these are necessary as >> "url" is already a property of the Artist class. >> >> IHTH, >> >> -JJ >> >> >> Index: lib/matplotlib/image.py >> =================================================================== >> --- lib/matplotlib/image.py (revision 6361) >> +++ lib/matplotlib/image.py (working copy) >> @@ -234,6 +234,7 @@ >> self.axes.get_yscale() != 'linear'): >> warnings.warn("Images are not supported on non-linear axes.") >> im = self.make_image(renderer.get_image_magnification()) >> + im._url = self.get_url() >> l, b, widthDisplay, heightDisplay = self.axes.bbox.bounds >> renderer.draw_image(round(l), round(b), im, self.axes.bbox.frozen(), >> *self.get_transformed_clip_path_and_affine()) >> Index: lib/matplotlib/backends/backend_svg.py >> =================================================================== >> --- lib/matplotlib/backends/backend_svg.py (revision 6361) >> +++ lib/matplotlib/backends/backend_svg.py (working copy) >> @@ -274,6 +283,9 @@ >> >> h,w = im.get_size_out() >> >> + url = im._url >> + if url is not None: >> + self._svgwriter.write('<a xlink:href="%s">' % url) >> self._svgwriter.write ( >> '<image x="%f" y="%f" width="%f" height="%f" ' >> '%s xlink:href="'%(x/trans[0], >> (self.height-y)/trans[3]-h, w, h, transstr) >> @@ -298,6 +310,8 @@ >> self._svgwriter.write(filename) >> >> self._svgwriter.write('"/>\n') >> + if url is not None: >> + self._svgwriter.write('</a>') >> >> def draw_text(self, gc, x, y, s, prop, angle, ismath): >> if ismath: >> >> >> >> >> On Thu, Nov 6, 2008 at 11:40 AM, Andrew Stock >> <mat...@an...> wrote: >> >>> Thanks Michael, >>> >>> I've attached a new diff file which I believe also has all the >>> necessary changes to the collections and images. I've also attached >>> two simple scripts which test the collections and image functionality. >>> >>> I've had to make some modification to extension code in this patch >>> which is definitely not my area of expertise so it would be worth >>> someone more experienced casting an eye over this. >>> >>> I've tested this on Linux and successfully run the backend_driver.py >>> file (or at least, it failed with the same errors as before I applied >>> the patch!). >>> >>> Any other comments welcome >>> >>> Thanks >>> >>> On Wed, Nov 5, 2008 at 2:31 PM, Michael Droettboom <md...@st...> wrote: >>> >>>> This looks great to me. I can confirm that this works on Linux as well. >>>> >>>> I think from here it's just a matter of applying the same pattern of changes >>>> to collections and images. Once that's done, I'm happy to apply the patch. >>>> And if you plan to make a lot of changes in the future, it generally pretty >>>> easy to get commit access. Just ask. >>>> >>>> Mike >>>> >>>> Andrew Stock wrote: >>>> >>>>> Hi, >>>>> >>>>> I've attached a diff file which implements the basic functionality. It >>>>> currently doesn't handle collections or draw_image, but I wanted to >>>>> get something simple working first, before expanding the scope. A >>>>> simple test program is as follows: >>>>> >>>>> from pylab import * >>>>> >>>>> f = figure() >>>>> a,b = bar([1,2], [2,5], url='http://www.bbc.co.uk/') >>>>> >>>>> a.set_url('http://www.google.com') >>>>> >>>>> f.canvas.print_figure(r'c:\test.svg') >>>>> >>>>> I'd be interested in comments / feedback on the attached before I >>>>> start to branch out into more significant changes! >>>>> >>>>> Thanks >>>>> >>>>> Andrew >>>>> >>>>> On Thu, Oct 30, 2008 at 8:02 PM, Michael Droettboom <md...@st...> >>>>> wrote: >>>>> >>>>> >>>>>> I realised in my earlier message, I didn't really address your initial >>>>>> request for feedback on your approach. >>>>>> >>>>>> I think the goal here should be to make the url support as pervasive as >>>>>> possible wrt both plot types and backends. >>>>>> >>>>>> Many of the high-level plotting functions (such as bar()) take a standard >>>>>> set of "Artist" keywords. In the docs, you'll often see a table like the >>>>>> one at the bottom for bar(): >>>>>> >>>>>> >>>>>> http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.bar >>>>>> >>>>>> This support all happens automatically simply by adding a setter and >>>>>> getter >>>>>> to the "Artist" class. So, in Artist, simply add set_url/get_url methods >>>>>> and a private attribute to store the url. You shouldn't have to touch >>>>>> any >>>>>> of the high-level plotting functions to have this supported everywhere >>>>>> where >>>>>> it makes sense. >>>>>> >>>>>> Then, to use the url value, you'll want to store it in a GraphicsContext >>>>>> object to pass to the backend. So you'll want to add an attribute and >>>>>> getter/setter in GraphicsContextBase as well. >>>>>> >>>>>> All of the places where the front-end creates a gc and passes it to the >>>>>> backend will need to be updated (such as Artist.draw, Text.draw, perhaps >>>>>> others, do a grep for the public methods in RendererBase). Where it sets >>>>>> things like facecolor on the GraphicsContext, it should also set a url. >>>>>> >>>>>> Then, in backends where appropriate you would use the url value if >>>>>> present. >>>>>> You could start with SVG, and maybe someone can come along and add PDF >>>>>> support later. >>>>>> >>>>>> An additional complication for completeness is handling Collections. >>>>>> Collections store a list of graphics context information (facecolor, >>>>>> edgecolor etc.) rather than a single one. Therefore, you'll want to add >>>>>> set_urls/get_urls to Collection as well, and then deal with passing those >>>>>> values to the backend. Collections don't use a GraphicsContext class, so >>>>>> you'll need to add a new arg to draw_path_collection in all backends. >>>>>> (Refactoring this so we pass an object to the backends rather than a >>>>>> long >>>>>> list of arguments would be welcome to avoid needing to update multiple >>>>>> backends for these sorts of new features in the future). You will also >>>>>> need >>>>>> to update RendererBase._iter_collection to support iterating over URLs in >>>>>> the same way as everything else there. >>>>>> >>>>>> draw_image also doesn't use a gc, so you'll need to add an argument >>>>>> there. >>>>>> >>>>>> Hope that gives you a road map... Please let me know if I can help >>>>>> further. >>>>>> >>>>>> Mike >>>>>> >>>>>> Andrew Stock wrote: >>>>>> >>>>>> >>>>>>> Hi, >>>>>>> >>>>>>> I have a requirement to make clickable bar charts using the SVG output >>>>>>> (rather than html maps). >>>>>>> >>>>>>> An initial look has suggested that the following changes would be >>>>>>> required: >>>>>>> >>>>>>> backend_bases.py: Add a url property to GraphicsContextBase >>>>>>> (defaulting to None, so it's all backwards compatible) >>>>>>> axes.py: Add a url option to the bar function and pass this on to the >>>>>>> constructor of the Rectangle object >>>>>>> patches.py: Pass the url option in the constructor for the Patch >>>>>>> object to the GraphicsContextBase object created in the draw function >>>>>>> backends/backend_svg.py: Add check to _draw_svg_element for url set in >>>>>>> gc. If it is, write out SVG code for xlink. >>>>>>> >>>>>>> I can make these changes and (if people think it would be useful) >>>>>>> contribute the changes back. However, before I do this, I wanted to >>>>>>> check whether this is the right approach to take - I'm not experienced >>>>>>> with the internals of matplotlib and so if there's a better way of >>>>>>> doing it, I'd be grateful for the advice. >>>>>>> >>>>>>> Once I got the bar charts working, I would be interested in possibly >>>>>>> extending this to other chart types. >>>>>>> >>>>>>> Regards >>>>>>> >>>>>>> Andrew >>>>>>> >>>>>>> >>>>>>> ------------------------------------------------------------------------- >>>>>>> This SF.Net email is sponsored by the Moblin Your Move Developer's >>>>>>> challenge >>>>>>> Build the coolest Linux based applications with Moblin SDK & win great >>>>>>> prizes >>>>>>> Grand prize is a trip for two to an Open Source event anywhere in the >>>>>>> world >>>>>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >>>>>>> _______________________________________________ >>>>>>> Matplotlib-devel mailing list >>>>>>> Mat...@li... >>>>>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel >>>>>>> >>>>>>> >>>>>>> >>>>>> -- >>>>>> Michael Droettboom >>>>>> Science Software Branch >>>>>> Operations and Engineering Division >>>>>> Space Telescope Science Institute >>>>>> Operated by AURA for NASA >>>>>> >>>>>> >>>>>> >>>>>> >>>> -- >>>> Michael Droettboom >>>> Science Software Branch >>>> Operations and Engineering Division >>>> Space Telescope Science Institute >>>> Operated by AURA for NASA >>>> >>>> >>>> >>> ------------------------------------------------------------------------- >>> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge >>> Build the coolest Linux based applications with Moblin SDK & win great prizes >>> Grand prize is a trip for two to an Open Source event anywhere in the world >>> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >>> _______________________________________________ >>> Matplotlib-devel mailing list >>> Mat...@li... >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel >>> >>> >>> -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA
Jae-Joon, Thanks for your comments. You have successfully found areas in my patch that were overcomplicated! I have attached a new patch which doesn't alter the api of draw_image and uses the im object as Jae-Joon suggests. I've tested this on Linux Python 2.5 as before, but not on Windows as I don't have the correct development environment set up at the moment. Regards Andrew On Fri, Nov 7, 2008 at 10:36 AM, Jae-Joon Lee <lee...@gm...> wrote: > Andrew, > > I just had a quick look at your patch. > I'm a bit distracted with your changes regarding the "url" support of the image. > Do we need to change the api of the draw_image()? Can we just utilize > "im" object as we did with the "gc"? Check the patch below. This > simple method seem to work fine for me. > > I also noted that, in the __init__() methods of the Patch and the > AxesImage class, you explicitly declare "url" as a keyword argument > and also initialize self.url. I don't think these are necessary as > "url" is already a property of the Artist class. > > IHTH, > > -JJ > > > Index: lib/matplotlib/image.py > =================================================================== > --- lib/matplotlib/image.py (revision 6361) > +++ lib/matplotlib/image.py (working copy) > @@ -234,6 +234,7 @@ > self.axes.get_yscale() != 'linear'): > warnings.warn("Images are not supported on non-linear axes.") > im = self.make_image(renderer.get_image_magnification()) > + im._url = self.get_url() > l, b, widthDisplay, heightDisplay = self.axes.bbox.bounds > renderer.draw_image(round(l), round(b), im, self.axes.bbox.frozen(), > *self.get_transformed_clip_path_and_affine()) > Index: lib/matplotlib/backends/backend_svg.py > =================================================================== > --- lib/matplotlib/backends/backend_svg.py (revision 6361) > +++ lib/matplotlib/backends/backend_svg.py (working copy) > @@ -274,6 +283,9 @@ > > h,w = im.get_size_out() > > + url = im._url > + if url is not None: > + self._svgwriter.write('<a xlink:href="%s">' % url) > self._svgwriter.write ( > '<image x="%f" y="%f" width="%f" height="%f" ' > '%s xlink:href="'%(x/trans[0], > (self.height-y)/trans[3]-h, w, h, transstr) > @@ -298,6 +310,8 @@ > self._svgwriter.write(filename) > > self._svgwriter.write('"/>\n') > + if url is not None: > + self._svgwriter.write('</a>') > > def draw_text(self, gc, x, y, s, prop, angle, ismath): > if ismath: > > > > > On Thu, Nov 6, 2008 at 11:40 AM, Andrew Stock > <mat...@an...> wrote: >> Thanks Michael, >> >> I've attached a new diff file which I believe also has all the >> necessary changes to the collections and images. I've also attached >> two simple scripts which test the collections and image functionality. >> >> I've had to make some modification to extension code in this patch >> which is definitely not my area of expertise so it would be worth >> someone more experienced casting an eye over this. >> >> I've tested this on Linux and successfully run the backend_driver.py >> file (or at least, it failed with the same errors as before I applied >> the patch!). >> >> Any other comments welcome >> >> Thanks >> >> On Wed, Nov 5, 2008 at 2:31 PM, Michael Droettboom <md...@st...> wrote: >>> This looks great to me. I can confirm that this works on Linux as well. >>> >>> I think from here it's just a matter of applying the same pattern of changes >>> to collections and images. Once that's done, I'm happy to apply the patch. >>> And if you plan to make a lot of changes in the future, it generally pretty >>> easy to get commit access. Just ask. >>> >>> Mike >>> >>> Andrew Stock wrote: >>>> >>>> Hi, >>>> >>>> I've attached a diff file which implements the basic functionality. It >>>> currently doesn't handle collections or draw_image, but I wanted to >>>> get something simple working first, before expanding the scope. A >>>> simple test program is as follows: >>>> >>>> from pylab import * >>>> >>>> f = figure() >>>> a,b = bar([1,2], [2,5], url='http://www.bbc.co.uk/') >>>> >>>> a.set_url('http://www.google.com') >>>> >>>> f.canvas.print_figure(r'c:\test.svg') >>>> >>>> I'd be interested in comments / feedback on the attached before I >>>> start to branch out into more significant changes! >>>> >>>> Thanks >>>> >>>> Andrew >>>> >>>> On Thu, Oct 30, 2008 at 8:02 PM, Michael Droettboom <md...@st...> >>>> wrote: >>>> >>>>> >>>>> I realised in my earlier message, I didn't really address your initial >>>>> request for feedback on your approach. >>>>> >>>>> I think the goal here should be to make the url support as pervasive as >>>>> possible wrt both plot types and backends. >>>>> >>>>> Many of the high-level plotting functions (such as bar()) take a standard >>>>> set of "Artist" keywords. In the docs, you'll often see a table like the >>>>> one at the bottom for bar(): >>>>> >>>>> >>>>> http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.bar >>>>> >>>>> This support all happens automatically simply by adding a setter and >>>>> getter >>>>> to the "Artist" class. So, in Artist, simply add set_url/get_url methods >>>>> and a private attribute to store the url. You shouldn't have to touch >>>>> any >>>>> of the high-level plotting functions to have this supported everywhere >>>>> where >>>>> it makes sense. >>>>> >>>>> Then, to use the url value, you'll want to store it in a GraphicsContext >>>>> object to pass to the backend. So you'll want to add an attribute and >>>>> getter/setter in GraphicsContextBase as well. >>>>> >>>>> All of the places where the front-end creates a gc and passes it to the >>>>> backend will need to be updated (such as Artist.draw, Text.draw, perhaps >>>>> others, do a grep for the public methods in RendererBase). Where it sets >>>>> things like facecolor on the GraphicsContext, it should also set a url. >>>>> >>>>> Then, in backends where appropriate you would use the url value if >>>>> present. >>>>> You could start with SVG, and maybe someone can come along and add PDF >>>>> support later. >>>>> >>>>> An additional complication for completeness is handling Collections. >>>>> Collections store a list of graphics context information (facecolor, >>>>> edgecolor etc.) rather than a single one. Therefore, you'll want to add >>>>> set_urls/get_urls to Collection as well, and then deal with passing those >>>>> values to the backend. Collections don't use a GraphicsContext class, so >>>>> you'll need to add a new arg to draw_path_collection in all backends. >>>>> (Refactoring this so we pass an object to the backends rather than a >>>>> long >>>>> list of arguments would be welcome to avoid needing to update multiple >>>>> backends for these sorts of new features in the future). You will also >>>>> need >>>>> to update RendererBase._iter_collection to support iterating over URLs in >>>>> the same way as everything else there. >>>>> >>>>> draw_image also doesn't use a gc, so you'll need to add an argument >>>>> there. >>>>> >>>>> Hope that gives you a road map... Please let me know if I can help >>>>> further. >>>>> >>>>> Mike >>>>> >>>>> Andrew Stock wrote: >>>>> >>>>>> >>>>>> Hi, >>>>>> >>>>>> I have a requirement to make clickable bar charts using the SVG output >>>>>> (rather than html maps). >>>>>> >>>>>> An initial look has suggested that the following changes would be >>>>>> required: >>>>>> >>>>>> backend_bases.py: Add a url property to GraphicsContextBase >>>>>> (defaulting to None, so it's all backwards compatible) >>>>>> axes.py: Add a url option to the bar function and pass this on to the >>>>>> constructor of the Rectangle object >>>>>> patches.py: Pass the url option in the constructor for the Patch >>>>>> object to the GraphicsContextBase object created in the draw function >>>>>> backends/backend_svg.py: Add check to _draw_svg_element for url set in >>>>>> gc. If it is, write out SVG code for xlink. >>>>>> >>>>>> I can make these changes and (if people think it would be useful) >>>>>> contribute the changes back. However, before I do this, I wanted to >>>>>> check whether this is the right approach to take - I'm not experienced >>>>>> with the internals of matplotlib and so if there's a better way of >>>>>> doing it, I'd be grateful for the advice. >>>>>> >>>>>> Once I got the bar charts working, I would be interested in possibly >>>>>> extending this to other chart types. >>>>>> >>>>>> Regards >>>>>> >>>>>> Andrew >>>>>> >>>>>> >>>>>> ------------------------------------------------------------------------- >>>>>> This SF.Net email is sponsored by the Moblin Your Move Developer's >>>>>> challenge >>>>>> Build the coolest Linux based applications with Moblin SDK & win great >>>>>> prizes >>>>>> Grand prize is a trip for two to an Open Source event anywhere in the >>>>>> world >>>>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >>>>>> _______________________________________________ >>>>>> Matplotlib-devel mailing list >>>>>> Mat...@li... >>>>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel >>>>>> >>>>>> >>>>> >>>>> -- >>>>> Michael Droettboom >>>>> Science Software Branch >>>>> Operations and Engineering Division >>>>> Space Telescope Science Institute >>>>> Operated by AURA for NASA >>>>> >>>>> >>>>> >>> >>> -- >>> Michael Droettboom >>> Science Software Branch >>> Operations and Engineering Division >>> Space Telescope Science Institute >>> Operated by AURA for NASA >>> >>> >> >> ------------------------------------------------------------------------- >> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge >> Build the coolest Linux based applications with Moblin SDK & win great prizes >> Grand prize is a trip for two to an Open Source event anywhere in the world >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >> _______________________________________________ >> Matplotlib-devel mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel >> >> >
Andrew, I just had a quick look at your patch. I'm a bit distracted with your changes regarding the "url" support of the image. Do we need to change the api of the draw_image()? Can we just utilize "im" object as we did with the "gc"? Check the patch below. This simple method seem to work fine for me. I also noted that, in the __init__() methods of the Patch and the AxesImage class, you explicitly declare "url" as a keyword argument and also initialize self.url. I don't think these are necessary as "url" is already a property of the Artist class. IHTH, -JJ Index: lib/matplotlib/image.py =================================================================== --- lib/matplotlib/image.py (revision 6361) +++ lib/matplotlib/image.py (working copy) @@ -234,6 +234,7 @@ self.axes.get_yscale() != 'linear'): warnings.warn("Images are not supported on non-linear axes.") im = self.make_image(renderer.get_image_magnification()) + im._url = self.get_url() l, b, widthDisplay, heightDisplay = self.axes.bbox.bounds renderer.draw_image(round(l), round(b), im, self.axes.bbox.frozen(), *self.get_transformed_clip_path_and_affine()) Index: lib/matplotlib/backends/backend_svg.py =================================================================== --- lib/matplotlib/backends/backend_svg.py (revision 6361) +++ lib/matplotlib/backends/backend_svg.py (working copy) @@ -274,6 +283,9 @@ h,w = im.get_size_out() + url = im._url + if url is not None: + self._svgwriter.write('<a xlink:href="%s">' % url) self._svgwriter.write ( '<image x="%f" y="%f" width="%f" height="%f" ' '%s xlink:href="'%(x/trans[0], (self.height-y)/trans[3]-h, w, h, transstr) @@ -298,6 +310,8 @@ self._svgwriter.write(filename) self._svgwriter.write('"/>\n') + if url is not None: + self._svgwriter.write('</a>') def draw_text(self, gc, x, y, s, prop, angle, ismath): if ismath: On Thu, Nov 6, 2008 at 11:40 AM, Andrew Stock <mat...@an...> wrote: > Thanks Michael, > > I've attached a new diff file which I believe also has all the > necessary changes to the collections and images. I've also attached > two simple scripts which test the collections and image functionality. > > I've had to make some modification to extension code in this patch > which is definitely not my area of expertise so it would be worth > someone more experienced casting an eye over this. > > I've tested this on Linux and successfully run the backend_driver.py > file (or at least, it failed with the same errors as before I applied > the patch!). > > Any other comments welcome > > Thanks > > On Wed, Nov 5, 2008 at 2:31 PM, Michael Droettboom <md...@st...> wrote: >> This looks great to me. I can confirm that this works on Linux as well. >> >> I think from here it's just a matter of applying the same pattern of changes >> to collections and images. Once that's done, I'm happy to apply the patch. >> And if you plan to make a lot of changes in the future, it generally pretty >> easy to get commit access. Just ask. >> >> Mike >> >> Andrew Stock wrote: >>> >>> Hi, >>> >>> I've attached a diff file which implements the basic functionality. It >>> currently doesn't handle collections or draw_image, but I wanted to >>> get something simple working first, before expanding the scope. A >>> simple test program is as follows: >>> >>> from pylab import * >>> >>> f = figure() >>> a,b = bar([1,2], [2,5], url='http://www.bbc.co.uk/') >>> >>> a.set_url('http://www.google.com') >>> >>> f.canvas.print_figure(r'c:\test.svg') >>> >>> I'd be interested in comments / feedback on the attached before I >>> start to branch out into more significant changes! >>> >>> Thanks >>> >>> Andrew >>> >>> On Thu, Oct 30, 2008 at 8:02 PM, Michael Droettboom <md...@st...> >>> wrote: >>> >>>> >>>> I realised in my earlier message, I didn't really address your initial >>>> request for feedback on your approach. >>>> >>>> I think the goal here should be to make the url support as pervasive as >>>> possible wrt both plot types and backends. >>>> >>>> Many of the high-level plotting functions (such as bar()) take a standard >>>> set of "Artist" keywords. In the docs, you'll often see a table like the >>>> one at the bottom for bar(): >>>> >>>> >>>> http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.bar >>>> >>>> This support all happens automatically simply by adding a setter and >>>> getter >>>> to the "Artist" class. So, in Artist, simply add set_url/get_url methods >>>> and a private attribute to store the url. You shouldn't have to touch >>>> any >>>> of the high-level plotting functions to have this supported everywhere >>>> where >>>> it makes sense. >>>> >>>> Then, to use the url value, you'll want to store it in a GraphicsContext >>>> object to pass to the backend. So you'll want to add an attribute and >>>> getter/setter in GraphicsContextBase as well. >>>> >>>> All of the places where the front-end creates a gc and passes it to the >>>> backend will need to be updated (such as Artist.draw, Text.draw, perhaps >>>> others, do a grep for the public methods in RendererBase). Where it sets >>>> things like facecolor on the GraphicsContext, it should also set a url. >>>> >>>> Then, in backends where appropriate you would use the url value if >>>> present. >>>> You could start with SVG, and maybe someone can come along and add PDF >>>> support later. >>>> >>>> An additional complication for completeness is handling Collections. >>>> Collections store a list of graphics context information (facecolor, >>>> edgecolor etc.) rather than a single one. Therefore, you'll want to add >>>> set_urls/get_urls to Collection as well, and then deal with passing those >>>> values to the backend. Collections don't use a GraphicsContext class, so >>>> you'll need to add a new arg to draw_path_collection in all backends. >>>> (Refactoring this so we pass an object to the backends rather than a >>>> long >>>> list of arguments would be welcome to avoid needing to update multiple >>>> backends for these sorts of new features in the future). You will also >>>> need >>>> to update RendererBase._iter_collection to support iterating over URLs in >>>> the same way as everything else there. >>>> >>>> draw_image also doesn't use a gc, so you'll need to add an argument >>>> there. >>>> >>>> Hope that gives you a road map... Please let me know if I can help >>>> further. >>>> >>>> Mike >>>> >>>> Andrew Stock wrote: >>>> >>>>> >>>>> Hi, >>>>> >>>>> I have a requirement to make clickable bar charts using the SVG output >>>>> (rather than html maps). >>>>> >>>>> An initial look has suggested that the following changes would be >>>>> required: >>>>> >>>>> backend_bases.py: Add a url property to GraphicsContextBase >>>>> (defaulting to None, so it's all backwards compatible) >>>>> axes.py: Add a url option to the bar function and pass this on to the >>>>> constructor of the Rectangle object >>>>> patches.py: Pass the url option in the constructor for the Patch >>>>> object to the GraphicsContextBase object created in the draw function >>>>> backends/backend_svg.py: Add check to _draw_svg_element for url set in >>>>> gc. If it is, write out SVG code for xlink. >>>>> >>>>> I can make these changes and (if people think it would be useful) >>>>> contribute the changes back. However, before I do this, I wanted to >>>>> check whether this is the right approach to take - I'm not experienced >>>>> with the internals of matplotlib and so if there's a better way of >>>>> doing it, I'd be grateful for the advice. >>>>> >>>>> Once I got the bar charts working, I would be interested in possibly >>>>> extending this to other chart types. >>>>> >>>>> Regards >>>>> >>>>> Andrew >>>>> >>>>> >>>>> ------------------------------------------------------------------------- >>>>> This SF.Net email is sponsored by the Moblin Your Move Developer's >>>>> challenge >>>>> Build the coolest Linux based applications with Moblin SDK & win great >>>>> prizes >>>>> Grand prize is a trip for two to an Open Source event anywhere in the >>>>> world >>>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >>>>> _______________________________________________ >>>>> Matplotlib-devel mailing list >>>>> Mat...@li... >>>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel >>>>> >>>>> >>>> >>>> -- >>>> Michael Droettboom >>>> Science Software Branch >>>> Operations and Engineering Division >>>> Space Telescope Science Institute >>>> Operated by AURA for NASA >>>> >>>> >>>> >> >> -- >> Michael Droettboom >> Science Software Branch >> Operations and Engineering Division >> Space Telescope Science Institute >> Operated by AURA for NASA >> >> > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > Matplotlib-devel mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel > >