Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8532081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:37:55+00:00 2026-06-11T09:37:55+00:00

I am plotting tiled images in a similar way to the working code shown

  • 0

I am plotting tiled images in a similar way to the working code shown below:

import Image
import matplotlib.pyplot as plt
import random
import numpy

def r():
    return random.randrange(50,200)

imsize = 100
rngsize = 5

rng = range(rngsize)
for i in rng:
    for j in rng:
        im = Image.new('RGB', (imsize, imsize), (r(),r(),r()))
        plt.imshow(im, aspect='equal', extent=numpy.array([i, i+1, j, j+1])*imsize)

plt.xlim(-5,imsize * rngsize + 5)
plt.ylim(-5,imsize * rngsize + 5)
plt.show()

enter image description here

The problem is: as you pan and zoom, zoomscale-independent white stripes appear between the image edges, which is very undesireable. I guess this has to do with resampling and antialiasing, but have no idea how to solve it “the right way”, specialy for not knowing exact implementation details of matplotlib’s rendering engine.

With Cairo and HTML Canvas, you can draw “to the pixel corner” or “to the pixel center” (translating by 0.5 pixel) thus avoiding anti-aliasing effects. Would there be a way to do that with Matplotlib?

Thanks for any help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T09:37:56+00:00Added an answer on June 11, 2026 at 9:37 am

    You can simply fill in the values to a larger numpy array and plot the entire composite image in one shot. I’ve adapted your code above for a minimal example but with different sized images you’ll need to take a different step size.

    F = numpy.zeros((imsize*rngsize,imsize*rngsize,3))
    
    for i in rng:
        for j in rng:
            F[i*imsize:(i+1)*imsize, 
              j*imsize:(j+1)*imsize, :] = (r(), r(), r())
    
    plt.imshow(F, interpolation = 'nearest')
    plt.show()
    

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

plotting module def plotGraph(X,Y): fignum = random.randint(0,sys.maxint) plt.figure(fignum) ### Plotting arrangements ### return fignum
I am plotting a confusion matrix with matplotlib with the following code: from numpy
I'm plotting a bunch of UTM coordinates using a matplotlib.pyplot.scatter. I also have a
I am plotting a heatmap in matplotlib using: plt.pcolor(rand(5,5)) how can I annotate the
When plotting a graph with a discontinuity/asymptote/singularity/whatever, is there any automatic way to prevent
I'm plotting data in Python using matplotlib. I am updating the data of the
I've been working on a computational physics project (plotting related rates of chemical reactants
I am plotting a function of two parameters with matplotlib. I copied an example
For most of my interactive plotting with matplotlib, I don't want to use latex
I'm plotting several images at once, sharing axes, because I use it for exploratory

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.