From tcaswell at gmail.com Fri Mar 1 23:48:59 2019 From: tcaswell at gmail.com (Thomas Caswell) Date: Fri, 1 Mar 2019 23:48:59 -0500 Subject: [Matplotlib-devel] REL: Matplotlib 2.2.4 and 3.0.3 Message-ID: Folks, As we get ready for 3.1 (aiming for mid-to-late March), we have tagged 2.2.4 and 3.0.3 bug-fix releases. Wheels for all three platforms are on pypi for both releases. 3.0.3: The third and last planned bug-fix release of the 3.0 series * fix several possible memory leaks * documentation fixes 2.2.4 The forth bug-fix release of the v2.2 LTS series. - Fix a memory leak with PySide2. - rename :math: sphinx directive to :mathmpl: to work with sphinx > 1.8. Both versions are now available if sphinx < 1.8. - avoids numpy deprecation warnings. - fixes to tests to work with pytest >= 3.8 and the minimum is now pytest >= 3.6. As a reminder, the 2.2 LTS series will continue to support Python 2.7 and get critical bug-fixes until the end of 2019. In both cases jquery-ui is no longer bundled in git repo and is downloaded during the install or sdist process. If you are installing from pypi the files will be included, but if you are installing from git you will need internet access the first time you run `pip install .`. The install process tries to cache the files and will not need internel access on future installations. I big thank you to everyone who worked on these releases done. Paul Ivanov was co release manager with me on both releases. Tom -- Thomas Caswell tcaswell at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From Nicolas.Rougier at inria.fr Fri Mar 8 12:31:43 2019 From: Nicolas.Rougier at inria.fr (Nicolas Rougier) Date: Fri, 8 Mar 2019 18:31:43 +0100 Subject: [Matplotlib-devel] Software 3D Renderer Message-ID: <7E5C7B5B-29B6-4C9A-BFBE-FD4120B1D8C5@inria.fr> I?ve coded a small pure Python 3D renderer (100 lines with loader, z-buffer, transformation, texture & light) available at https://github.com/rougier/tiny-renderer. But I?ve no idea if any part can be re-used for the 3D axis in matplotlib. Nicolas From rmay31 at gmail.com Fri Mar 8 12:35:45 2019 From: rmay31 at gmail.com (Ryan May) Date: Fri, 8 Mar 2019 10:35:45 -0700 Subject: [Matplotlib-devel] Software 3D Renderer In-Reply-To: <7E5C7B5B-29B6-4C9A-BFBE-FD4120B1D8C5@inria.fr> References: <7E5C7B5B-29B6-4C9A-BFBE-FD4120B1D8C5@inria.fr> Message-ID: Does that include rasterization? Ryan On Fri, Mar 8, 2019 at 10:32 AM Nicolas Rougier wrote: > > I?ve coded a small pure Python 3D renderer (100 lines with loader, > z-buffer, transformation, texture & light) available at > https://github.com/rougier/tiny-renderer. But I?ve no idea if any part > can be re-used for the 3D axis in matplotlib. > > > Nicolas > _______________________________________________ > Matplotlib-devel mailing list > Matplotlib-devel at python.org > https://mail.python.org/mailman/listinfo/matplotlib-devel > -- Ryan May -------------- next part -------------- An HTML attachment was scrubbed... URL: From Nicolas.Rougier at inria.fr Fri Mar 8 12:36:20 2019 From: Nicolas.Rougier at inria.fr (Nicolas Rougier) Date: Fri, 8 Mar 2019 18:36:20 +0100 Subject: [Matplotlib-devel] Software 3D Renderer In-Reply-To: References: <7E5C7B5B-29B6-4C9A-BFBE-FD4120B1D8C5@inria.fr> Message-ID: Yes. > On 8 Mar 2019, at 18:35, Ryan May wrote: > > Does that include rasterization? > > Ryan > > On Fri, Mar 8, 2019 at 10:32 AM Nicolas Rougier wrote: > > I?ve coded a small pure Python 3D renderer (100 lines with loader, z-buffer, transformation, texture & light) available at https://github.com/rougier/tiny-renderer. But I?ve no idea if any part can be re-used for the 3D axis in matplotlib. > > > Nicolas > _______________________________________________ > Matplotlib-devel mailing list > Matplotlib-devel at python.org > https://mail.python.org/mailman/listinfo/matplotlib-devel > > > -- > Ryan May > From tcaswell at gmail.com Sat Mar 9 09:26:19 2019 From: tcaswell at gmail.com (Thomas Caswell) Date: Sat, 9 Mar 2019 09:26:19 -0500 Subject: [Matplotlib-devel] Software 3D Renderer In-Reply-To: References: <7E5C7B5B-29B6-4C9A-BFBE-FD4120B1D8C5@inria.fr> Message-ID: Interesting. I suspect that we could sub-class `Image` and propagate the RGBA array the renderer (the fiddly bits is getting the view port, size, resolution, etc plumbed through correctly). If I am reading this correctly, we could use it as MeshArtist? This may be an interesting GSoC project. Tom On Fri, Mar 8, 2019 at 12:36 PM Nicolas Rougier wrote: > Yes. > > > On 8 Mar 2019, at 18:35, Ryan May wrote: > > > > Does that include rasterization? > > > > Ryan > > > > On Fri, Mar 8, 2019 at 10:32 AM Nicolas Rougier < > Nicolas.Rougier at inria.fr> wrote: > > > > I?ve coded a small pure Python 3D renderer (100 lines with loader, > z-buffer, transformation, texture & light) available at > https://github.com/rougier/tiny-renderer. But I?ve no idea if any part > can be re-used for the 3D axis in matplotlib. > > > > > > Nicolas > > _______________________________________________ > > Matplotlib-devel mailing list > > Matplotlib-devel at python.org > > https://mail.python.org/mailman/listinfo/matplotlib-devel > > > > > > -- > > Ryan May > > > > _______________________________________________ > Matplotlib-devel mailing list > Matplotlib-devel at python.org > https://mail.python.org/mailman/listinfo/matplotlib-devel > -- Thomas Caswell tcaswell at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From rayosborn at mac.com Sat Mar 9 10:22:48 2019 From: rayosborn at mac.com (Raymond Osborn) Date: Sat, 9 Mar 2019 09:22:48 -0600 Subject: [Matplotlib-devel] Interpolations in Line2D objects Message-ID: <469371B0-A258-4371-BED9-547D428C16C9@mac.com> Is there any interest in adding an interpolation attribute to axes.Line2D objects similar to those in Axes.imshow? We often use bicubic interpolation using spicy.interpolate to generate smooth lines to connect markers, partly for aesthetic reasons, but partly for (what we maintain are) valid scientific reasons. However, there is no way to display the line along with the associated marker in legends, and it generates additional Line2D objects that are not really separate entities. I haven?t looked into how this might be done but I thought I would check first to see if this has been considered before and rejected for any reason. It obviously requires storing additional smoothed arrays and smoothing options, and perhaps there are other complications I am not aware of. Ray From ben.v.root at gmail.com Sat Mar 9 20:32:30 2019 From: ben.v.root at gmail.com (Benjamin Root) Date: Sat, 9 Mar 2019 20:32:30 -0500 Subject: [Matplotlib-devel] Interpolations in Line2D objects In-Reply-To: <469371B0-A258-4371-BED9-547D428C16C9@mac.com> References: <469371B0-A258-4371-BED9-547D428C16C9@mac.com> Message-ID: Matplotlib already has support for bezier curves. Could that work? https://matplotlib.org/gallery/shapes_and_collections/quad_bezier.html On Sat, Mar 9, 2019 at 10:22 AM Raymond Osborn via Matplotlib-devel < matplotlib-devel at python.org> wrote: > Is there any interest in adding an interpolation attribute to axes.Line2D > objects similar to those in Axes.imshow? We often use bicubic interpolation > using spicy.interpolate to generate smooth lines to connect markers, partly > for aesthetic reasons, but partly for (what we maintain are) valid > scientific reasons. However, there is no way to display the line along with > the associated marker in legends, and it generates additional Line2D > objects that are not really separate entities. > > I haven?t looked into how this might be done but I thought I would check > first to see if this has been considered before and rejected for any > reason. It obviously requires storing additional smoothed arrays and > smoothing options, and perhaps there are other complications I am not aware > of. > > Ray > _______________________________________________ > Matplotlib-devel mailing list > Matplotlib-devel at python.org > https://mail.python.org/mailman/listinfo/matplotlib-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jklymak at uvic.ca Sun Mar 10 11:14:40 2019 From: jklymak at uvic.ca (Jody Klymak) Date: Sun, 10 Mar 2019 08:14:40 -0700 Subject: [Matplotlib-devel] Interpolations in Line2D objects In-Reply-To: <469371B0-A258-4371-BED9-547D428C16C9@mac.com> References: <469371B0-A258-4371-BED9-547D428C16C9@mac.com> Message-ID: <3186D9E4-3B30-41FE-9ACF-3072D6C7793A@uvic.ca> Hi Ray, Thanks a lot for the interest in Matplotlib. On the other hand, I?d be against this because the API for curve fitting would need to be elaborate, and in my opinion has a better home in scipy or numpy. We are trying to get away from data processing tasks inside Matplotlib, and leave that to partner libraries, though a few exceptions still exist. As for legends, I?d argue pretty strongly that the data and the spline are quite different entities and deserve differentiation in the legend and/or caption of whatever figure you are making. However if you really want the line and marker in the same legend entry there are numerous hacks to let you do that. Easiest is probably to draw a marker + line off-canvas somewhere and label that. Cheers, Jody > On Mar 9, 2019, at 7:22 AM, Raymond Osborn via Matplotlib-devel wrote: > > Is there any interest in adding an interpolation attribute to axes.Line2D objects similar to those in Axes.imshow? We often use bicubic interpolation using spicy.interpolate to generate smooth lines to connect markers, partly for aesthetic reasons, but partly for (what we maintain are) valid scientific reasons. However, there is no way to display the line along with the associated marker in legends, and it generates additional Line2D objects that are not really separate entities. > > I haven?t looked into how this might be done but I thought I would check first to see if this has been considered before and rejected for any reason. It obviously requires storing additional smoothed arrays and smoothing options, and perhaps there are other complications I am not aware of. > > Ray > _______________________________________________ > Matplotlib-devel mailing list > Matplotlib-devel at python.org > https://mail.python.org/mailman/listinfo/matplotlib-devel From rayosborn at mac.com Sun Mar 10 11:38:16 2019 From: rayosborn at mac.com (Raymond Osborn) Date: Sun, 10 Mar 2019 10:38:16 -0500 Subject: [Matplotlib-devel] Interpolations in Line2D objects In-Reply-To: <3186D9E4-3B30-41FE-9ACF-3072D6C7793A@uvic.ca> References: <469371B0-A258-4371-BED9-547D428C16C9@mac.com> <3186D9E4-3B30-41FE-9ACF-3072D6C7793A@uvic.ca> Message-ID: <5A966D75-0290-4AC1-AC63-92284E56CB49@mac.com> Matplotlib already has entered this space by providing interpolation options in imshow. There is no difference in the reasons for doing it and the options would be, if anything, less complicated. Personally, I don?t see this as data analysis. It?s more for presentational reasons, which I believe is very much part of Matplotlib and not scipy. Ray > On Mar 10, 2019, at 10:14 AM, Jody Klymak wrote: > > Hi Ray, > > Thanks a lot for the interest in Matplotlib. On the other hand, I?d be against this because the API for curve fitting would need to be elaborate, and in my opinion has a better home in scipy or numpy. We are trying to get away from data processing tasks inside Matplotlib, and leave that to partner libraries, though a few exceptions still exist. > > As for legends, I?d argue pretty strongly that the data and the spline are quite different entities and deserve differentiation in the legend and/or caption of whatever figure you are making. However if you really want the line and marker in the same legend entry there are numerous hacks to let you do that. Easiest is probably to draw a marker + line off-canvas somewhere and label that. > > Cheers, Jody > > >> On Mar 9, 2019, at 7:22 AM, Raymond Osborn via Matplotlib-devel wrote: >> >> Is there any interest in adding an interpolation attribute to axes.Line2D objects similar to those in Axes.imshow? We often use bicubic interpolation using spicy.interpolate to generate smooth lines to connect markers, partly for aesthetic reasons, but partly for (what we maintain are) valid scientific reasons. However, there is no way to display the line along with the associated marker in legends, and it generates additional Line2D objects that are not really separate entities. >> >> I haven?t looked into how this might be done but I thought I would check first to see if this has been considered before and rejected for any reason. It obviously requires storing additional smoothed arrays and smoothing options, and perhaps there are other complications I am not aware of. >> >> Ray >> _______________________________________________ >> Matplotlib-devel mailing list >> Matplotlib-devel at python.org >> https://mail.python.org/mailman/listinfo/matplotlib-devel > From jklymak at uvic.ca Sun Mar 10 12:41:49 2019 From: jklymak at uvic.ca (Jody Klymak) Date: Sun, 10 Mar 2019 09:41:49 -0700 Subject: [Matplotlib-devel] Interpolations in Line2D objects In-Reply-To: <5A966D75-0290-4AC1-AC63-92284E56CB49@mac.com> References: <469371B0-A258-4371-BED9-547D428C16C9@mac.com> <3186D9E4-3B30-41FE-9ACF-3072D6C7793A@uvic.ca> <5A966D75-0290-4AC1-AC63-92284E56CB49@mac.com> Message-ID: Interpolation in `imshow` is contentious, to say the least, subject to bugs, and disagreements about how out of bounds data should be handled, etc etc.. However, mapping an image of arbitrary resolution to the figure resolution is inherently an interpolation/smoothing operation, so we have to do it to show the image at all. Conversely, drawing a line between two points is something most renderers do for us. Cheers, Jody > On Mar 10, 2019, at 8:38 AM, Raymond Osborn wrote: > > Matplotlib already has entered this space by providing interpolation options in imshow. There is no difference in the reasons for doing it and the options would be, if anything, less complicated. Personally, I don?t see this as data analysis. It?s more for presentational reasons, which I believe is very much part of Matplotlib and not scipy. > > Ray > >> On Mar 10, 2019, at 10:14 AM, Jody Klymak wrote: >> >> Hi Ray, >> >> Thanks a lot for the interest in Matplotlib. On the other hand, I?d be against this because the API for curve fitting would need to be elaborate, and in my opinion has a better home in scipy or numpy. We are trying to get away from data processing tasks inside Matplotlib, and leave that to partner libraries, though a few exceptions still exist. >> >> As for legends, I?d argue pretty strongly that the data and the spline are quite different entities and deserve differentiation in the legend and/or caption of whatever figure you are making. However if you really want the line and marker in the same legend entry there are numerous hacks to let you do that. Easiest is probably to draw a marker + line off-canvas somewhere and label that. >> >> Cheers, Jody >> >> >>> On Mar 9, 2019, at 7:22 AM, Raymond Osborn via Matplotlib-devel wrote: >>> >>> Is there any interest in adding an interpolation attribute to axes.Line2D objects similar to those in Axes.imshow? We often use bicubic interpolation using spicy.interpolate to generate smooth lines to connect markers, partly for aesthetic reasons, but partly for (what we maintain are) valid scientific reasons. However, there is no way to display the line along with the associated marker in legends, and it generates additional Line2D objects that are not really separate entities. >>> >>> I haven?t looked into how this might be done but I thought I would check first to see if this has been considered before and rejected for any reason. It obviously requires storing additional smoothed arrays and smoothing options, and perhaps there are other complications I am not aware of. >>> >>> Ray >>> _______________________________________________ >>> Matplotlib-devel mailing list >>> Matplotlib-devel at python.org >>> https://mail.python.org/mailman/listinfo/matplotlib-devel >> > From rayosborn at mac.com Sun Mar 10 14:55:58 2019 From: rayosborn at mac.com (Raymond Osborn) Date: Sun, 10 Mar 2019 13:55:58 -0500 Subject: [Matplotlib-devel] Interpolations in Line2D objects In-Reply-To: References: <469371B0-A258-4371-BED9-547D428C16C9@mac.com> <3186D9E4-3B30-41FE-9ACF-3072D6C7793A@uvic.ca> <5A966D75-0290-4AC1-AC63-92284E56CB49@mac.com> Message-ID: Of course, contours involve smooth interpolations as well, so I?m not sure I accept the premise that I am asking Matplotlib to expand its scope unreasonably. I certainly hope that interpolations are not in danger of being removed from imshow. If this is the consensus of the Matplotlib developers, then I will program it myself in NeXpy (http://nexpy.github.io/nexpy/), where we have added GUI handles to the less common Matplotlib features that we find ourselves using all the time in our research, such as skew axes and symmetric log plots. This is another such feature. It is not hard to implement with scipy.interpolate, but I believe that there are many in your user community who would find this an extremely useful option within Matplotlib, which is why I decided to raise the issue. With best regards, Ray > On Mar 10, 2019, at 11:41 AM, Jody Klymak wrote: > > Interpolation in `imshow` is contentious, to say the least, subject to bugs, and disagreements about how out of bounds data should be handled, etc etc.. However, mapping an image of arbitrary resolution to the figure resolution is inherently an interpolation/smoothing operation, so we have to do it to show the image at all. > > Conversely, drawing a line between two points is something most renderers do for us. > > Cheers, Jody > >> On Mar 10, 2019, at 8:38 AM, Raymond Osborn wrote: >> >> Matplotlib already has entered this space by providing interpolation options in imshow. There is no difference in the reasons for doing it and the options would be, if anything, less complicated. Personally, I don?t see this as data analysis. It?s more for presentational reasons, which I believe is very much part of Matplotlib and not scipy. >> >> Ray >> >>> On Mar 10, 2019, at 10:14 AM, Jody Klymak wrote: >>> >>> Hi Ray, >>> >>> Thanks a lot for the interest in Matplotlib. On the other hand, I?d be against this because the API for curve fitting would need to be elaborate, and in my opinion has a better home in scipy or numpy. We are trying to get away from data processing tasks inside Matplotlib, and leave that to partner libraries, though a few exceptions still exist. >>> >>> As for legends, I?d argue pretty strongly that the data and the spline are quite different entities and deserve differentiation in the legend and/or caption of whatever figure you are making. However if you really want the line and marker in the same legend entry there are numerous hacks to let you do that. Easiest is probably to draw a marker + line off-canvas somewhere and label that. >>> >>> Cheers, Jody >>> >>> >>>> On Mar 9, 2019, at 7:22 AM, Raymond Osborn via Matplotlib-devel wrote: >>>> >>>> Is there any interest in adding an interpolation attribute to axes.Line2D objects similar to those in Axes.imshow? We often use bicubic interpolation using spicy.interpolate to generate smooth lines to connect markers, partly for aesthetic reasons, but partly for (what we maintain are) valid scientific reasons. However, there is no way to display the line along with the associated marker in legends, and it generates additional Line2D objects that are not really separate entities. >>>> >>>> I haven?t looked into how this might be done but I thought I would check first to see if this has been considered before and rejected for any reason. It obviously requires storing additional smoothed arrays and smoothing options, and perhaps there are other complications I am not aware of. >>>> >>>> Ray >>>> _______________________________________________ >>>> Matplotlib-devel mailing list >>>> Matplotlib-devel at python.org >>>> https://mail.python.org/mailman/listinfo/matplotlib-devel >>> >> > From tcaswell at gmail.com Sun Mar 10 19:29:45 2019 From: tcaswell at gmail.com (Thomas Caswell) Date: Sun, 10 Mar 2019 19:29:45 -0400 Subject: [Matplotlib-devel] Interpolations in Line2D objects In-Reply-To: References: <469371B0-A258-4371-BED9-547D428C16C9@mac.com> <3186D9E4-3B30-41FE-9ACF-3072D6C7793A@uvic.ca> <5A966D75-0290-4AC1-AC63-92284E56CB49@mac.com> Message-ID: > Interpolation in `imshow` is contentious, Interpolation in imshow is _hard_, but I would not say contentious. There is zero chance of it being removed. Further, I think that the Ray is asking about interpolation, not fitting. I think it is directly analogous in 1D, in both cases we have user input which is not uniform and we implicitly re-sample it to pick what pixels we are going to color. To that end, we currently do support 'interpolation' in Line2D under the name of 'drawstyle' which switches between linear interpolation and 0-order interpolation. However there are two problems I see with directly plugging in to that framework for higher-order interpolation 1) the way we call it is not aware of the current view limits and axes size in pixels (which you really want to intelligently pick the number of points to re-sample to) 2) the higher-order interpolators are in scipy (we use the interpolators in Agg for 2D, there may be 1D versions in Agg we can use). There is also some concern about how to handle this across all of the backends. For raster backends it is pretty straight forward (resample to the number of pixels), but for the vector backends it is less so (do we just pick some DPI to resample to? Does the underlying language natively support it (looks like at least SVG does not)?). https://github.com/pyviz/datashader/pull/200 is relevant to this discussion for what an intelligently re-sampling artist might look like. This is a feature that I think we want to get widely available, but I am not sure the best path (new package? optional scipy dependancy?). For merging the elements in the legend I would look at https://matplotlib.org/tutorials/intermediate/legend_guide.html#legend-handlers . It means would you have to move away from the auto collection, but it is probably worth it for nexpy. We support both skew axis and symlog axis in core Matplotlib, what do they not cover than nexpy needs? Tom On Sun, Mar 10, 2019 at 2:56 PM Raymond Osborn via Matplotlib-devel < matplotlib-devel at python.org> wrote: > Of course, contours involve smooth interpolations as well, so I?m not sure > I accept the premise that I am asking Matplotlib to expand its scope > unreasonably. I certainly hope that interpolations are not in danger of > being removed from imshow. > > If this is the consensus of the Matplotlib developers, then I will program > it myself in NeXpy (http://nexpy.github.io/nexpy/), where we have added > GUI handles to the less common Matplotlib features that we find ourselves > using all the time in our research, such as skew axes and symmetric log > plots. This is another such feature. It is not hard to implement with > scipy.interpolate, but I believe that there are many in your user community > who would find this an extremely useful option within Matplotlib, which is > why I decided to raise the issue. > > With best regards, > Ray > > > On Mar 10, 2019, at 11:41 AM, Jody Klymak wrote: > > > > Interpolation in `imshow` is contentious, to say the least, subject to > bugs, and disagreements about how out of bounds data should be handled, etc > etc.. However, mapping an image of arbitrary resolution to the figure > resolution is inherently an interpolation/smoothing operation, so we have > to do it to show the image at all. > > > > Conversely, drawing a line between two points is something most > renderers do for us. > > > > Cheers, Jody > > > >> On Mar 10, 2019, at 8:38 AM, Raymond Osborn wrote: > >> > >> Matplotlib already has entered this space by providing interpolation > options in imshow. There is no difference in the reasons for doing it and > the options would be, if anything, less complicated. Personally, I don?t > see this as data analysis. It?s more for presentational reasons, which I > believe is very much part of Matplotlib and not scipy. > >> > >> Ray > >> > >>> On Mar 10, 2019, at 10:14 AM, Jody Klymak wrote: > >>> > >>> Hi Ray, > >>> > >>> Thanks a lot for the interest in Matplotlib. On the other hand, I?d > be against this because the API for curve fitting would need to be > elaborate, and in my opinion has a better home in scipy or numpy. We are > trying to get away from data processing tasks inside Matplotlib, and leave > that to partner libraries, though a few exceptions still exist. > >>> > >>> As for legends, I?d argue pretty strongly that the data and the spline > are quite different entities and deserve differentiation in the legend > and/or caption of whatever figure you are making. However if you really > want the line and marker in the same legend entry there are numerous hacks > to let you do that. Easiest is probably to draw a marker + line off-canvas > somewhere and label that. > >>> > >>> Cheers, Jody > >>> > >>> > >>>> On Mar 9, 2019, at 7:22 AM, Raymond Osborn via Matplotlib-devel < > matplotlib-devel at python.org> wrote: > >>>> > >>>> Is there any interest in adding an interpolation attribute to > axes.Line2D objects similar to those in Axes.imshow? We often use bicubic > interpolation using spicy.interpolate to generate smooth lines to connect > markers, partly for aesthetic reasons, but partly for (what we maintain > are) valid scientific reasons. However, there is no way to display the line > along with the associated marker in legends, and it generates additional > Line2D objects that are not really separate entities. > >>>> > >>>> I haven?t looked into how this might be done but I thought I would > check first to see if this has been considered before and rejected for any > reason. It obviously requires storing additional smoothed arrays and > smoothing options, and perhaps there are other complications I am not aware > of. > >>>> > >>>> Ray > >>>> _______________________________________________ > >>>> Matplotlib-devel mailing list > >>>> Matplotlib-devel at python.org > >>>> https://mail.python.org/mailman/listinfo/matplotlib-devel > >>> > >> > > > > _______________________________________________ > Matplotlib-devel mailing list > Matplotlib-devel at python.org > https://mail.python.org/mailman/listinfo/matplotlib-devel > -- Thomas Caswell tcaswell at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From rayosborn at mac.com Sun Mar 10 20:35:47 2019 From: rayosborn at mac.com (Raymond Osborn) Date: Sun, 10 Mar 2019 19:35:47 -0500 Subject: [Matplotlib-devel] Interpolations in Line2D objects In-Reply-To: References: <469371B0-A258-4371-BED9-547D428C16C9@mac.com> <3186D9E4-3B30-41FE-9ACF-3072D6C7793A@uvic.ca> <5A966D75-0290-4AC1-AC63-92284E56CB49@mac.com> Message-ID: Tom, Thanks for your insight. The issue of matching the smoothing to the screen resolution is something that I have little experience of. It was at the back of my mind that Matplotlib developer expertise would probably be needed to do this properly. You have confirmed that it is not a trivial problem. My comment about skew axes and symbol plots was not very well phrased. They are indeed very well implemented in Matplotlib. What I was trying to say was that one of the goals of NeXpy is to make it easier for our users to access these more advanced features without having to consult the documentation, and that I hope one day to be able to turn on line interpolations just as easily with a checkbox or combo box. Thanks again, Ray > On Mar 10, 2019, at 6:29 PM, Thomas Caswell wrote: > > > Interpolation in `imshow` is contentious, > > Interpolation in imshow is _hard_, but I would not say contentious. There is zero chance of it being removed. > > Further, I think that the Ray is asking about interpolation, not fitting. I think it is directly analogous in 1D, in both cases we have user input which is not uniform and we implicitly re-sample it to pick what pixels we are going to color. > > To that end, we currently do support 'interpolation' in Line2D under the name of 'drawstyle' which switches between linear interpolation and 0-order interpolation. However there are two problems I see with directly plugging in to that framework for higher-order interpolation 1) the way we call it is not aware of the current view limits and axes size in pixels (which you really want to intelligently pick the number of points to re-sample to) 2) the higher-order interpolators are in scipy (we use the interpolators in Agg for 2D, there may be 1D versions in Agg we can use). > > There is also some concern about how to handle this across all of the backends. For raster backends it is pretty straight forward (resample to the number of pixels), but for the vector backends it is less so (do we just pick some DPI to resample to? Does the underlying language natively support it (looks like at least SVG does not)?). > > https://github.com/pyviz/datashader/pull/200 is relevant to this discussion for what an intelligently re-sampling artist might look like. > > This is a feature that I think we want to get widely available, but I am not sure the best path (new package? optional scipy dependancy?). > > For merging the elements in the legend I would look at https://matplotlib.org/tutorials/intermediate/legend_guide.html#legend-handlers . It means would you have to move away from the auto collection, but it is probably worth it for nexpy. > > We support both skew axis and symlog axis in core Matplotlib, what do they not cover than nexpy needs? > > Tom > > On Sun, Mar 10, 2019 at 2:56 PM Raymond Osborn via Matplotlib-devel > wrote: > Of course, contours involve smooth interpolations as well, so I?m not sure I accept the premise that I am asking Matplotlib to expand its scope unreasonably. I certainly hope that interpolations are not in danger of being removed from imshow. > > If this is the consensus of the Matplotlib developers, then I will program it myself in NeXpy (http://nexpy.github.io/nexpy/ ), where we have added GUI handles to the less common Matplotlib features that we find ourselves using all the time in our research, such as skew axes and symmetric log plots. This is another such feature. It is not hard to implement with scipy.interpolate, but I believe that there are many in your user community who would find this an extremely useful option within Matplotlib, which is why I decided to raise the issue. > > With best regards, > Ray > > > On Mar 10, 2019, at 11:41 AM, Jody Klymak > wrote: > > > > Interpolation in `imshow` is contentious, to say the least, subject to bugs, and disagreements about how out of bounds data should be handled, etc etc.. However, mapping an image of arbitrary resolution to the figure resolution is inherently an interpolation/smoothing operation, so we have to do it to show the image at all. > > > > Conversely, drawing a line between two points is something most renderers do for us. > > > > Cheers, Jody > > > >> On Mar 10, 2019, at 8:38 AM, Raymond Osborn > wrote: > >> > >> Matplotlib already has entered this space by providing interpolation options in imshow. There is no difference in the reasons for doing it and the options would be, if anything, less complicated. Personally, I don?t see this as data analysis. It?s more for presentational reasons, which I believe is very much part of Matplotlib and not scipy. > >> > >> Ray > >> > >>> On Mar 10, 2019, at 10:14 AM, Jody Klymak > wrote: > >>> > >>> Hi Ray, > >>> > >>> Thanks a lot for the interest in Matplotlib. On the other hand, I?d be against this because the API for curve fitting would need to be elaborate, and in my opinion has a better home in scipy or numpy. We are trying to get away from data processing tasks inside Matplotlib, and leave that to partner libraries, though a few exceptions still exist. > >>> > >>> As for legends, I?d argue pretty strongly that the data and the spline are quite different entities and deserve differentiation in the legend and/or caption of whatever figure you are making. However if you really want the line and marker in the same legend entry there are numerous hacks to let you do that. Easiest is probably to draw a marker + line off-canvas somewhere and label that. > >>> > >>> Cheers, Jody > >>> > >>> > >>>> On Mar 9, 2019, at 7:22 AM, Raymond Osborn via Matplotlib-devel > wrote: > >>>> > >>>> Is there any interest in adding an interpolation attribute to axes.Line2D objects similar to those in Axes.imshow? We often use bicubic interpolation using spicy.interpolate to generate smooth lines to connect markers, partly for aesthetic reasons, but partly for (what we maintain are) valid scientific reasons. However, there is no way to display the line along with the associated marker in legends, and it generates additional Line2D objects that are not really separate entities. > >>>> > >>>> I haven?t looked into how this might be done but I thought I would check first to see if this has been considered before and rejected for any reason. It obviously requires storing additional smoothed arrays and smoothing options, and perhaps there are other complications I am not aware of. > >>>> > >>>> Ray > >>>> _______________________________________________ > >>>> Matplotlib-devel mailing list > >>>> Matplotlib-devel at python.org > >>>> https://mail.python.org/mailman/listinfo/matplotlib-devel > >>> > >> > > > > _______________________________________________ > Matplotlib-devel mailing list > Matplotlib-devel at python.org > https://mail.python.org/mailman/listinfo/matplotlib-devel > > > -- > Thomas Caswell > tcaswell at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From antony.lee at institutoptique.fr Mon Mar 11 05:25:29 2019 From: antony.lee at institutoptique.fr (Antony Lee) Date: Mon, 11 Mar 2019 10:25:29 +0100 Subject: [Matplotlib-devel] Interpolations in Line2D objects In-Reply-To: References: <469371B0-A258-4371-BED9-547D428C16C9@mac.com> <3186D9E4-3B30-41FE-9ACF-3072D6C7793A@uvic.ca> <5A966D75-0290-4AC1-AC63-92284E56CB49@mac.com> Message-ID: My position largely echoes Jody's: the complexity of image interpolation (for example regarding the "matching screen resolution" issue raised by Tom) and scope creep both strongly argue against adding this feature to Line2D. Perhaps more constructively, I believe the desired feature (showing points at data, an interpolant line, and a single unified legend) can also be achieved using the markevery mechanism ( https://matplotlib.org/gallery/lines_bars_and_markers/markevery_demo.html) (store the interpolated line in the artist, but set markevery to only display the data points). Antony On Mon, Mar 11, 2019 at 1:35 AM Raymond Osborn via Matplotlib-devel < matplotlib-devel at python.org> wrote: > Tom, > Thanks for your insight. The issue of matching the smoothing to the screen > resolution is something that I have little experience of. It was at the > back of my mind that Matplotlib developer expertise would probably be > needed to do this properly. You have confirmed that it is not a trivial > problem. > > My comment about skew axes and symbol plots was not very well phrased. > They are indeed very well implemented in Matplotlib. What I was trying to > say was that one of the goals of NeXpy is to make it easier for our users > to access these more advanced features without having to consult the > documentation, and that I hope one day to be able to turn on line > interpolations just as easily with a checkbox or combo box. > > Thanks again, > Ray > > On Mar 10, 2019, at 6:29 PM, Thomas Caswell wrote: > > > Interpolation in `imshow` is contentious, > > Interpolation in imshow is _hard_, but I would not say contentious. There > is zero chance of it being removed. > > Further, I think that the Ray is asking about interpolation, not fitting. > I think it is directly analogous in 1D, in both cases we have user input > which is not uniform and we implicitly re-sample it to pick what pixels we > are going to color. > > To that end, we currently do support 'interpolation' in Line2D under the > name of 'drawstyle' which switches between linear interpolation and 0-order > interpolation. However there are two problems I see with directly plugging > in to that framework for higher-order interpolation 1) the way we call it > is not aware of the current view limits and axes size in pixels (which you > really want to intelligently pick the number of points to re-sample to) 2) > the higher-order interpolators are in scipy (we use the interpolators in > Agg for 2D, there may be 1D versions in Agg we can use). > > There is also some concern about how to handle this across all of the > backends. For raster backends it is pretty straight forward (resample to > the number of pixels), but for the vector backends it is less so (do we > just pick some DPI to resample to? Does the underlying language natively > support it (looks like at least SVG does not)?). > > https://github.com/pyviz/datashader/pull/200 is relevant to this > discussion for what an intelligently re-sampling artist might look like. > > This is a feature that I think we want to get widely available, but I am > not sure the best path (new package? optional scipy dependancy?). > > For merging the elements in the legend I would look at > https://matplotlib.org/tutorials/intermediate/legend_guide.html#legend-handlers > . It means would you have to move away from the auto collection, but it is > probably worth it for nexpy. > > We support both skew axis and symlog axis in core Matplotlib, what do they > not cover than nexpy needs? > > Tom > > On Sun, Mar 10, 2019 at 2:56 PM Raymond Osborn via Matplotlib-devel < > matplotlib-devel at python.org> wrote: > >> Of course, contours involve smooth interpolations as well, so I?m not >> sure I accept the premise that I am asking Matplotlib to expand its scope >> unreasonably. I certainly hope that interpolations are not in danger of >> being removed from imshow. >> >> If this is the consensus of the Matplotlib developers, then I will >> program it myself in NeXpy (http://nexpy.github.io/nexpy/), where we >> have added GUI handles to the less common Matplotlib features that we find >> ourselves using all the time in our research, such as skew axes and >> symmetric log plots. This is another such feature. It is not hard to >> implement with scipy.interpolate, but I believe that there are many in your >> user community who would find this an extremely useful option within >> Matplotlib, which is why I decided to raise the issue. >> >> With best regards, >> Ray >> >> > On Mar 10, 2019, at 11:41 AM, Jody Klymak wrote: >> > >> > Interpolation in `imshow` is contentious, to say the least, subject to >> bugs, and disagreements about how out of bounds data should be handled, etc >> etc.. However, mapping an image of arbitrary resolution to the figure >> resolution is inherently an interpolation/smoothing operation, so we have >> to do it to show the image at all. >> > >> > Conversely, drawing a line between two points is something most >> renderers do for us. >> > >> > Cheers, Jody >> > >> >> On Mar 10, 2019, at 8:38 AM, Raymond Osborn >> wrote: >> >> >> >> Matplotlib already has entered this space by providing interpolation >> options in imshow. There is no difference in the reasons for doing it and >> the options would be, if anything, less complicated. Personally, I don?t >> see this as data analysis. It?s more for presentational reasons, which I >> believe is very much part of Matplotlib and not scipy. >> >> >> >> Ray >> >> >> >>> On Mar 10, 2019, at 10:14 AM, Jody Klymak wrote: >> >>> >> >>> Hi Ray, >> >>> >> >>> Thanks a lot for the interest in Matplotlib. On the other hand, I?d >> be against this because the API for curve fitting would need to be >> elaborate, and in my opinion has a better home in scipy or numpy. We are >> trying to get away from data processing tasks inside Matplotlib, and leave >> that to partner libraries, though a few exceptions still exist. >> >>> >> >>> As for legends, I?d argue pretty strongly that the data and the >> spline are quite different entities and deserve differentiation in the >> legend and/or caption of whatever figure you are making. However if you >> really want the line and marker in the same legend entry there are numerous >> hacks to let you do that. Easiest is probably to draw a marker + line >> off-canvas somewhere and label that. >> >>> >> >>> Cheers, Jody >> >>> >> >>> >> >>>> On Mar 9, 2019, at 7:22 AM, Raymond Osborn via Matplotlib-devel < >> matplotlib-devel at python.org> wrote: >> >>>> >> >>>> Is there any interest in adding an interpolation attribute to >> axes.Line2D objects similar to those in Axes.imshow? We often use bicubic >> interpolation using spicy.interpolate to generate smooth lines to connect >> markers, partly for aesthetic reasons, but partly for (what we maintain >> are) valid scientific reasons. However, there is no way to display the line >> along with the associated marker in legends, and it generates additional >> Line2D objects that are not really separate entities. >> >>>> >> >>>> I haven?t looked into how this might be done but I thought I would >> check first to see if this has been considered before and rejected for any >> reason. It obviously requires storing additional smoothed arrays and >> smoothing options, and perhaps there are other complications I am not aware >> of. >> >>>> >> >>>> Ray >> >>>> _______________________________________________ >> >>>> Matplotlib-devel mailing list >> >>>> Matplotlib-devel at python.org >> >>>> https://mail.python.org/mailman/listinfo/matplotlib-devel >> >>> >> >> >> > >> >> _______________________________________________ >> Matplotlib-devel mailing list >> Matplotlib-devel at python.org >> https://mail.python.org/mailman/listinfo/matplotlib-devel >> > > > -- > Thomas Caswell > tcaswell at gmail.com > > > _______________________________________________ > Matplotlib-devel mailing list > Matplotlib-devel at python.org > https://mail.python.org/mailman/listinfo/matplotlib-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tcaswell at gmail.com Tue Mar 12 08:10:28 2019 From: tcaswell at gmail.com (Thomas Caswell) Date: Tue, 12 Mar 2019 08:10:28 -0400 Subject: [Matplotlib-devel] google season of docs Message-ID: Folks, Google is trying out a documentation version of GSoC [1]. Is anyone interested in leading this from our side? Tom [1] https://developers.google.com/season-of-docs/ -- Thomas Caswell tcaswell at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From bussonniermatthias at gmail.com Fri Mar 15 11:52:02 2019 From: bussonniermatthias at gmail.com (Matthias Bussonnier) Date: Fri, 15 Mar 2019 11:52:02 -0400 Subject: [Matplotlib-devel] BoF submission to SciPy 2019 Message-ID: Hello Matplotlib List, The SciPy conference would like to encourage you to submit proposals for Birds of a Feather (BoF) sessions at this year's SciPy! BoFs usually include short presentations by a panel and a moderator with the bulk of the time spent opening up the discussion to everyone in attendance, but the format is flexible. BoF topics can be of general interest, such as state-of-the-project BoFs, or based on the themes of the conference and the mini-symposia topics, or can be a great opportunity to collect informations from members of the SciPy community. We would like to encourage you to think about topics of interest and submit your proposals. Submission will be opened on March 18, 2019 (This Monday) and close on Friday, May 31st, 2019. You can submit you proposal here: https://www.scipy2019.scipy.org/bof-sessions. Past SciPy conferences have had a large variety of BoF sessions, including topics on Reproducibility, Jupyter Notebooks, Distributed Computing, Geospatial Packages in Python, Teaching Scientific Computing with Python, Python and Finance, NumFOCUS, Python in Astronomy, Collaborating and Contributing in Open Science, Education, and a Matplotlib Enhancement Proposal Discussion. Generally, if there is a topic where you think a number of people at SciPy will be interested, you should propose it! Please share this with anyone else in the community who you think would be a good candidate for organizing a BoF. The BoF committee will try to select the BoFs based on a number of criteria, and/or attempt to merge BoFs submission with a large overlap. Thanks in advance for your submission, and looking forward to see you at SciPy 2019, Austin Texas, July 8-14, 2019. Feel free to contact us if you have any questions, concerns or suggestions. -- Lindsey Heagy and Matthias Bussonnier for the SciPy organizers. scipybofs at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From story645 at gmail.com Thu Mar 28 17:01:47 2019 From: story645 at gmail.com (Hannah) Date: Thu, 28 Mar 2019 17:01:47 -0400 Subject: [Matplotlib-devel] Seeking GSOC 2019 Students Message-ID: Hello, Matplotlib is participating in Google Summer of Code this year under the Numfocus umbrella. Applications are due April 9. Please apply and encourage students you may think are a good fit to apply. Application instructions are at https://github.com/numfocus/gsoc Applicants are welcome and encouraged to propose their own projects or build on the project we have proposed, which is a collaboration with the geopandas library. GeoPandas allows users to work with geospatial data in Python by providing geospatial operations in Pandas and a high-level interface to multiple geometries to shapely. It also facilitates exploratory visualization of geospatial data via descartes and matplotlib. The visualization interface in geopandas is currently on the rough side; it generates simple polygon based maps that are inconsistent in terms of supporting matplotlib features such as color mapping and color bars. Find more information at https://github.com/matplotlib/matplotlib/wiki/GSOC-2019-Ideas-Page Please respond to this email with questions or ask here: https://gitter.im/matplotlib/matplotlib?utm_source=share-link&utm_medium=link&utm_campaign=share-link Thank you, -------------- next part -------------- An HTML attachment was scrubbed... URL: From nwuk at pyladies.com Tue Mar 5 12:35:09 2019 From: nwuk at pyladies.com (Northwest UK PyLadies) Date: Tue, 05 Mar 2019 17:35:09 -0000 Subject: [Matplotlib-devel] Fwd: Mentored sprints for underrepresented folks @PyCon US In-Reply-To: References: Message-ID: Mentored sprints for diverse beginners: May 4th 2019, 2:35pm Join us for the first PyCon US mentored sprints for diverse beginners We are very excited to announce the mentored sprints for diverse members of the Python community ??? *When: *4th of May 2019 from 2:35pm to 6:35 pm, during the main section of PyCon. Its main aim is to support folks from underrepresented groups in our community that want to start contributing to open source projects. We will provide mentorship during the day as well as git support and an introduction to open source contributions. *Applications for mentors and attendees are open until the 14th of March 2019!* Mentors /maintainers We are looking for mentors and/or core developers/maintainers of open source projects interested in taking part in the sprint and mentor the attendees over the day. What you need to know - The sprint will last from 2:35pm - 6:30pm but it will be divided in two slots of 2 hours so you can choose between a 2 and 4 hours commitment to the sprint. - You do not need to maintain a project or to have merge access to a project to mentor on the day - There can be more than one mentor per project. We will provide you with guidance and help to prepare for the day (i.e. have beginners friendly issues, provide advice on how to better serve a diverse community, and provide you with as much support as needed. - You do not need previous experience with sprints and/or mentoring. Go to mentors sign up Contributors/attendees - You do not need to have previous experience contributing to open source - We will provide on-site guidance and mentoring - We strongly encourage members from underrepresented groups in our community to attend - It is a great opportunity to learn and meet others in the community Go to contributors sign up If you want to contact the organisers please email us at nwuk at pyladies.com For more details visit https://us.pycon.org/2019/hatchery/mentoredsprints/ Please share with your network ? [image: OR] Share this [image: Fb] [image: Tw] [image: In] Tania, Mariatta, Nina and Nikoleta -------------- next part -------------- An HTML attachment was scrubbed... URL: From rob.a.mcdonald at gmail.com Sat Mar 30 18:44:17 2019 From: rob.a.mcdonald at gmail.com (Rob McDonald) Date: Sat, 30 Mar 2019 17:44:17 -0500 Subject: [Matplotlib-devel] What is draw_path's transform's destination? Message-ID: I'm implementing a custom path effect by inheriting from AbstractPathEffect and implementing draw_path as instructed here . That link references RenderBase.draw_path to define the required interface. Unfortunately, I can't find anywhere in the associated documentation that tells me what the transform argument really entails. I've also read the transforms tutorial , and while that explains the pipeline and all the intermediate transformations, it doesn't really settle what I have available to me in draw_path. It is clear that I can use it to transform coordinates from data to something -- but I don't know what to. For the big picture -- I am implementing a path effect to allow drawing hatched lines similar to this , which I did years ago in Matlab. Years before that, I've also done this in Java Graphics2D by implementing a custom stroke. (The Java approach is more applicable to the path effect approach, but I can't point to that code online anywhere.) Anyway, I have things mostly working -- and I am using the transform to go from data coordinates to something that looks orthogonal and reasonable on-screen. So, for minimum functionality, it works. However, I want to give the user the ability to control the length and spacing of the hatches -- which is in a coordinate system after the transformation is applied. So, in order to document this thing, I need to know what it is. Or, if there is a way to get intermediate stages of the transformation pipeline, that would work too. As for the user interface -- it seems to make the most sense to specify the hatch length and spacing in terms of something similar to a line width (typically points) or a marker size. I'm new to Python and matplotlib -- what is the Pythonic unit a user would expect to specify this in (and how do I achieve that with what is available in draw_path)? Thanks, Rob -------------- next part -------------- An HTML attachment was scrubbed... URL: From tcaswell at gmail.com Sun Mar 31 00:12:21 2019 From: tcaswell at gmail.com (Thomas Caswell) Date: Sun, 31 Mar 2019 00:12:21 -0400 Subject: [Matplotlib-devel] What is draw_path's transform's destination? In-Reply-To: References: Message-ID: The transform is from whatever coordinates the path is in to pixels. >From skimming the code on `Line2D` (and from the name) it looks like it is only the affine part of the path transformation. Looking at the method `_offset_transform` in the base class also supports the target coordinate system of the transform is pixels. That is a pretty nifty tool, is it going to end up someplace public when you are done? Tom On Sat, Mar 30, 2019 at 6:44 PM Rob McDonald wrote: > I'm implementing a custom path effect by inheriting from > AbstractPathEffect and implementing draw_path as instructed here > . > That link references RenderBase.draw_path > to > define the required interface. Unfortunately, I can't find anywhere in the > associated documentation that tells me what the transform argument really > entails. > > I've also read the transforms tutorial > , and > while that explains the pipeline and all the intermediate transformations, > it doesn't really settle what I have available to me in draw_path. It is > clear that I can use it to transform coordinates from data to something -- > but I don't know what to. > > For the big picture -- I am implementing a path effect to allow drawing > hatched lines similar to this > , > which I did years ago in Matlab. Years before that, I've also done this in > Java Graphics2D by implementing a custom stroke. (The Java approach is > more applicable to the path effect approach, but I can't point to that code > online anywhere.) > > Anyway, I have things mostly working -- and I am using the transform to go > from data coordinates to something that looks orthogonal and reasonable > on-screen. So, for minimum functionality, it works. However, I want to > give the user the ability to control the length and spacing of the hatches > -- which is in a coordinate system after the transformation is applied. > So, in order to document this thing, I need to know what it is. Or, if > there is a way to get intermediate stages of the transformation pipeline, > that would work too. > > As for the user interface -- it seems to make the most sense to specify > the hatch length and spacing in terms of something similar to a line width > (typically points) or a marker size. I'm new to Python and matplotlib -- > what is the Pythonic unit a user would expect to specify this in (and how > do I achieve that with what is available in draw_path)? > > Thanks, > > Rob > _______________________________________________ > Matplotlib-devel mailing list > Matplotlib-devel at python.org > https://mail.python.org/mailman/listinfo/matplotlib-devel > -- Thomas Caswell tcaswell at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From rob.a.mcdonald at gmail.com Sun Mar 31 00:51:03 2019 From: rob.a.mcdonald at gmail.com (Rob McDonald) Date: Sat, 30 Mar 2019 23:51:03 -0500 Subject: [Matplotlib-devel] What is draw_path's transform's destination? In-Reply-To: References: Message-ID: Thanks for the help, How are 'pixels' handled when going to a vector back end? I've seen some points_to_pixels methods around, but that isn't quite right. Is the best thing to do to allow the user to set the hatch spacing in pixels? I'll be happy to make it a contribution to the collection of path effects included in patheffects.py once I get things working smoothly. For best effect (for my needs), it will also need to work well with contours. I just found the docs that show that contours are already oriented (great news - I had to write a contour orienter in Matlab to get consistent behavior). Unfortunately, naively passing path_effects=[HatchedStroke()] to a plt.contour() call doesn't 'just work'. Is there a way to tell contour lines to be drawn with a different path effect? Contributing this work presents a bit of a naming collision -- I generally call these hatched lines. I would like to call this HatchedPathEffect or HatchedStroke when contributing it. However, matplotlib uses hatching to refer to filling an area with a pattern. While related, this is obviously different. Should I call it something else? (what is Parseltongue for HatchedStroke?) Rob On Sat, Mar 30, 2019 at 11:12 PM Thomas Caswell wrote: > The transform is from whatever coordinates the path is in to pixels. > > From skimming the code on `Line2D` (and from the name) it looks like it is > only the affine part of the path transformation. > > Looking at the method `_offset_transform` in the base class also supports > the target coordinate system of the transform is pixels. > > That is a pretty nifty tool, is it going to end up someplace public when > you are done? > > Tom > > On Sat, Mar 30, 2019 at 6:44 PM Rob McDonald > wrote: > >> I'm implementing a custom path effect by inheriting from >> AbstractPathEffect and implementing draw_path as instructed here >> . >> That link references RenderBase.draw_path >> to >> define the required interface. Unfortunately, I can't find anywhere in the >> associated documentation that tells me what the transform argument really >> entails. >> >> I've also read the transforms tutorial >> , >> and while that explains the pipeline and all the intermediate >> transformations, it doesn't really settle what I have available to me in >> draw_path. It is clear that I can use it to transform coordinates from >> data to something -- but I don't know what to. >> >> For the big picture -- I am implementing a path effect to allow drawing >> hatched lines similar to this >> , >> which I did years ago in Matlab. Years before that, I've also done this in >> Java Graphics2D by implementing a custom stroke. (The Java approach is >> more applicable to the path effect approach, but I can't point to that code >> online anywhere.) >> >> Anyway, I have things mostly working -- and I am using the transform to >> go from data coordinates to something that looks orthogonal and reasonable >> on-screen. So, for minimum functionality, it works. However, I want to >> give the user the ability to control the length and spacing of the hatches >> -- which is in a coordinate system after the transformation is applied. >> So, in order to document this thing, I need to know what it is. Or, if >> there is a way to get intermediate stages of the transformation pipeline, >> that would work too. >> >> As for the user interface -- it seems to make the most sense to specify >> the hatch length and spacing in terms of something similar to a line width >> (typically points) or a marker size. I'm new to Python and matplotlib -- >> what is the Pythonic unit a user would expect to specify this in (and how >> do I achieve that with what is available in draw_path)? >> >> Thanks, >> >> Rob >> _______________________________________________ >> Matplotlib-devel mailing list >> Matplotlib-devel at python.org >> https://mail.python.org/mailman/listinfo/matplotlib-devel >> > > > -- > Thomas Caswell > tcaswell at gmail.com > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rob.a.mcdonald at gmail.com Sun Mar 31 01:30:26 2019 From: rob.a.mcdonald at gmail.com (Rob McDonald) Date: Sun, 31 Mar 2019 00:30:26 -0500 Subject: [Matplotlib-devel] What is draw_path's transform's destination? In-Reply-To: References: Message-ID: On Sat, Mar 30, 2019 at 11:51 PM Rob McDonald wrote: > Unfortunately, naively passing path_effects=[HatchedStroke()] to a > plt.contour() call doesn't 'just work'. Is there a way to tell contour > lines to be drawn with a different path effect? > > OK -- so I made some progress on this... cp = plt.contour(x, y, z, colors=('k',), ) plt.setp(cp.collections, path_effects=[HatchedStroke()]) By and large works. However, some of the hatches appear 'off' the lines. I believe this is because some of the contour Path's might be generated as Bezier curves (not simple polylines). I need to interpolate along the path to generate hatches, but I don't have a full renderer -- and Path.interpolate doesn't do curves. I currently do the following to get to polylines newpath = tpath.cleaned() polys = newpath.to_polygons(closed_only=False) Which generally works, but the default settings (deep inside agg from what I can tell (agg_curves.cpp etc.)) produce very coarse approximations that are rather unsatisfying. Is there a better way to get a polyline from an arbitrary Path (that may include Bezier curves)? Someone has to have implemented a compound path evaluation routine... Alternately, is there a way to force contour to generate straight-line segments -- forcing the user to bump up the grid resolution if they want smooth curves? Actually, that doesn't work. I currently have an example with very fine resolution -- it appears that something in the Contour Path hierarchy is being clever and replacing the polyline segments with a smooth Bezier curve. Possibly via a simplify call -- if there isn't a way to evaluate the true Path in draw_path, then perhaps there is a way to turn off the simplify step contour is doing... Rob -------------- next part -------------- An HTML attachment was scrubbed... URL: