1

I have a smallish matrix and I want to do imshow with it with interpolation='nearest'. But this makes discrete square blocks. Is it possible to make the blocks circular and also control the size of the block?

1
  • it would be nice if you could post a working sample of your code that is using interpolation='nearest'... Commented Aug 3, 2013 at 16:00

1 Answer 1

2

All imshow plots are designed to fill the space of the plots ("im" is short for image and images fill the plot space), which is inconsistent with your desire to plot circles.

A scatter plot in a grid would be an easy route to a grid of circle. Here's an example:

enter image description here

from pylab import *

N = 10
r0 = 0.6
x = linspace(0, 1, 10)
y = linspace(0, 1, 10)
X, Y = meshgrid(x, y)
size = rand(N,N)
c = size
scatter(X,Y,s=700*size, marker='o', c=c)

show()

You can get more control if you use plotting primitives. Two such examples from the matplolib gallery are here and here.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.