Skip to content

Path snapping does not respect quantization scale appropriate for Retina displays #2697

Closed
@piannucci

Description

@piannucci

Here's a toy version of something I'm working on:

import numpy as np, pylab as pl
N = M = 10
n = 1000
a = (np.random.standard_normal((n,N,M)) + 1j * np.random.standard_normal((n,N,M))) * .5**.5
b = np.linalg.svd(a)
pl.clf()
for i in xrange(b[1].shape[1]):
    _=pl.hist(b[1][:,i], bins=100, histtype='step', normed=True)

If you run this with the macosx backend on a Retina display and carefully resize the window, you will find that the path snapping algorithm is snapping to the nearest two-pixel boundary, rather than the intended behavior of snapping to the nearest one-pixel boundary.

I speculate that this is also an issue with marker placement and hatching.

Two solutions are apparent.

One is for the macosx backend to do a little dance of rescaling the transform matrices before and after passing paths through the path iterator. This seems like a pain and not very portable. I believe that the other backends will be growing high-DPI flavors soon! [edit: just took a look and it seems like only the macosx backend uses the PathCleanupIterator. Is that correct?]

The other solution is for the path iterator to take the image magnification factor as an argument, and thread this through the code to the actual path snapper.

Incidentally, we might consider renaming the image magnification factor since it matters for vectors too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions