[Matplotlib-devel] Interpolations in Line2D objects

Jody Klymak jklymak at uvic.ca
Sun Mar 10 12:41:49 EDT 2019


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 <rayosborn at mac.com> 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 <jklymak at uvic.ca> 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
>> 
> 



More information about the Matplotlib-devel mailing list