<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">> Interpolation in `imshow` is contentious, <br></div><div dir="ltr"><br></div><div>Interpolation in imshow is _hard_, but I would not say contentious.  There is zero chance of it being removed.  </div><div><br></div><div>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.</div><div><br></div><div>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).  </div><div><br></div><div>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)?).</div><div><br></div><div><a href="https://github.com/pyviz/datashader/pull/200">https://github.com/pyviz/datashader/pull/200</a> is relevant to this discussion for what an intelligently re-sampling artist might look like.</div><div><br></div><div>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?).</div><div><br></div><div>For merging the elements in the legend I would look at <a href="https://matplotlib.org/tutorials/intermediate/legend_guide.html#legend-handlers">https://matplotlib.org/tutorials/intermediate/legend_guide.html#legend-handlers</a> .  It means would you have to move away from the auto collection, but it is probably worth it for nexpy.</div><div><br></div><div>We support both skew axis and symlog axis in core Matplotlib, what do they not cover than nexpy needs?</div><div><br></div><div>Tom</div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Mar 10, 2019 at 2:56 PM Raymond Osborn via Matplotlib-devel <<a href="mailto:matplotlib-devel@python.org">matplotlib-devel@python.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">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.<br>
<br>
If this is the consensus of the Matplotlib developers, then I will program it myself in NeXpy (<a href="http://nexpy.github.io/nexpy/" rel="noreferrer" target="_blank">http://nexpy.github.io/nexpy/</a>), 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.<br>
<br>
With best regards,<br>
Ray<br>
<br>
> On Mar 10, 2019, at 11:41 AM, Jody Klymak <<a href="mailto:jklymak@uvic.ca" target="_blank">jklymak@uvic.ca</a>> wrote:<br>
> <br>
> 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. <br>
> <br>
> Conversely, drawing a line between two points is something most renderers do for us.    <br>
> <br>
> Cheers,   Jody<br>
> <br>
>> On Mar 10, 2019, at  8:38 AM, Raymond Osborn <<a href="mailto:rayosborn@mac.com" target="_blank">rayosborn@mac.com</a>> wrote:<br>
>> <br>
>> 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. <br>
>> <br>
>> Ray <br>
>> <br>
>>> On Mar 10, 2019, at 10:14 AM, Jody Klymak <<a href="mailto:jklymak@uvic.ca" target="_blank">jklymak@uvic.ca</a>> wrote:<br>
>>> <br>
>>> Hi Ray,<br>
>>> <br>
>>> 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. <br>
>>> <br>
>>> 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.  <br>
>>> <br>
>>> Cheers,  Jody<br>
>>> <br>
>>> <br>
>>>> On Mar 9, 2019, at  7:22 AM, Raymond Osborn via Matplotlib-devel <<a href="mailto:matplotlib-devel@python.org" target="_blank">matplotlib-devel@python.org</a>> wrote:<br>
>>>> <br>
>>>> 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.<br>
>>>> <br>
>>>> 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.<br>
>>>> <br>
>>>> Ray<br>
>>>> _______________________________________________<br>
>>>> Matplotlib-devel mailing list<br>
>>>> <a href="mailto:Matplotlib-devel@python.org" target="_blank">Matplotlib-devel@python.org</a><br>
>>>> <a href="https://mail.python.org/mailman/listinfo/matplotlib-devel" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/matplotlib-devel</a><br>
>>> <br>
>> <br>
> <br>
<br>
_______________________________________________<br>
Matplotlib-devel mailing list<br>
<a href="mailto:Matplotlib-devel@python.org" target="_blank">Matplotlib-devel@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/matplotlib-devel" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/matplotlib-devel</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature">Thomas Caswell<br><a href="mailto:tcaswell@gmail.com" target="_blank">tcaswell@gmail.com</a></div>