[Matplotlib-devel] Internals of smooth plotting in matplotlib

Chris Barker - NOAA Federal chris.barker at noaa.gov
Mon May 6 13:10:32 EDT 2019


Now I want to plot smooth plot using these points. If I just plot
corresponding pixels I might have wholes in the image if I zoom in,


You really don’t want to do that.

so that it is not good. If I just poly line (there is such function in java
Graphics2D object) based on these points I have another problem. I have to
convert each point into onscreen pixel coordinates (I can use floor(..)


I would use round(), but still, drawing in pixel coordinates will result in
somewhat jagged lines.

The way around that is to use “antialiased” drawing. I would be shocked if
there wasn’t a Java lib for that.

Most MPL back-ends use the antigrain library (AGG) which is s particularly
good renderer, but any antialiasing renderer should be pretty good.

You also mention zooming — make sure you zoom before converting to pixel
coords as well.

HTH,

-CHB



or rounding to the nearest int when doing it). And that results in jagged
step like line that  you can see here

https://i.imgur.com/t26WDut.png

That does not happen in matplotlib when let say using fig.plot(...)
function. Output is always smooth which is what I want as well. Is there a
particular place in code where I can see how that is done?

--
Dmitri Priimak

_______________________________________________
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: <http://mail.python.org/pipermail/matplotlib-devel/attachments/20190506/a4defc4d/attachment.html>


More information about the Matplotlib-devel mailing list