Skip to content

Misalignment imshow vs. grid lines #1441

Open
@rougier

Description

@rougier

The following script show a mis-alignment between grid lines and image patterns while they should be aligned:

import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt

n = 16
fig = plt.figure(figsize=(6,6))
Z = np.zeros((n,n))
Z[::2,::2] = Z[1::2,1::2] = 1
plt.imshow(Z, interpolation='none', cmap=plt.cm.gray, extent=[0,n,0,n], alpha=0.25)
plt.xticks(np.arange(0,n), []), plt.yticks(np.arange(0,n), [])
plt.grid(ls='solid')
delta = 0.01
plt.xlim(1-delta,1+delta), plt.ylim(1-delta,1+delta)
plt.savefig('pylab-grid.png')
plt.savefig('pylab-grid.pdf')

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy