Drawing filled circles (discs)

sidimok <sidimok@...287...> writes:

It works just fine, however the colorbar I'm getting with the following
commands is very tiny.

norm = matplotlib.colors.Normalize(vmin=x[0], vmax=x[-1]) # just an example
cb = matplotlib.colorbar.ColorbarBase(ax, cmap=matplotlib.cm.jet, norm=norm)

It would help to give a complete example. ColorbarBase itself does not
create a colorbar but is useful for drawing a colorbar in existing axes.

···

--
Jouni K. Sepp�nen
http://www.iki.fi/jks

Jouni K. Seppänen wrote:

It would help to give a complete example. ColorbarBase itself does not
create a colorbar but is useful for drawing a colorbar in existing axes.

Well, let's take the one you've proposed the last time. How than can i put a
colorbar beside the plot?

#!/usr/bin/env python

import matplotlib
from matplotlib.patches import Circle
import pylab

def myscatter(ax, colormap, x, y, radii, colors):
    for x1,y1,r,c in zip(x, y, radii, colormap(colors)):
        ax.add_patch(Circle((x1,y1), r, fc=c))

fig=pylab.figure()
ax=fig.add_subplot(111)

myscatter(ax, matplotlib.cm.jet,
          pylab.rand(20), pylab.rand(20), 0.1*pylab.rand(20),
pylab.rand(20))

ax.axis('equal')
pylab.show()

···

--
View this message in context: http://www.nabble.com/Drawing-filled-circles-(discs)-tf4441651.html#a12777776
Sent from the matplotlib - users mailing list archive at Nabble.com.