From: Benjamin R. <ben...@ou...> - 2012-02-09 02:11:35
|
On Wednesday, February 8, 2012, Jerzy Karczmarczuk < jer...@un...> wrote: > >> I am experiencing missing "segments" in the output of imshow().... >> >> Here is a minimal example: >> >> I have attached an example of the output. In theory, there should be >> a continuous line from the left side of the picture to the right side. >> The problem seems to occur across backends. Additionally, the >> thickness of the segments is not uniform. Some are thinner than the >> rest. Decreasing the value of N seems to make the issue go away. >> Increasing the value of N makes the problem worse. >> >> Any ideas on what is going on and how I can fix it? >> > Imshow scales your geometry according to the figure size, and if you > *insist* on having the "nearest" interpolation, you may lose pixels > while drawing, it is as simple as that. No miracles. > > How to fix it? > 1. Use bilinear, or sinc, or any smooth interpolation. > 2. Make your figure big enough, say plt.figure(figsize=(14,14)). > > Jerzy Karczmarczuk > > Agreed. Your example above is basically the equivalent of rasterizing a line (without anti-aliasing) and then down-scaling and possibly causing some stretching due to changes in aspect ratio. Because imshow() is unaware the you are actually drawing a line, the backends can not take advantage of their "bag-o-tricks" to make it look good. Perhaps the example you provided was an oversimplified version of the problem you are having? Cheers! Ben Root |