python - Matplotlib imshow() grid uneven when grid size is large -



python - Matplotlib imshow() grid uneven when grid size is large -

i trying utilize imshow() function in matplotlib plot color values in 177 x 177 grid. when run next code on little (30x30) grid (i.e. set width = 30), image produces has nice, evenly sized squares. when run on larger grid (150x150), squares not evenly proportioned. stretched in 1 or both dimensions. here's simplified version of code i'm using:

grid = [[]]*width in range(width): grid[i] = [[]]*width j in range(width): grid[i][j] = (random(), random(), random()) plt.imshow(grid, interpolation="none", aspect=1) plt.savefig("test.png")

any thought how create grid even? i've tried of aspect ratio stuff discussed here, didn't seem solve problem. i'm using python 2.7.6 , matplotlib version 1.3.1.

edit: here image showing cells big gird if zoom way in. obtained using different coloring function, in clusters of 9 cells colored increasing hue. more shows uneven shapes. can include code if want, same behavior (much less complicated) random code.

and here's looks (again, zoomed in) when utilize little grid:

okay, figured out. problem wasn't using high plenty dpi when saved image. plt.savefig("test.png", dpi=1000)yields image in big grid depicted evenly-sized squares.

by not increasing dpi larger grid, trying plot more info in same amount of pixels, resolution decreasing point cells becoming miss-shapen.

python matplotlib imshow

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -