pyplot.scatter changes the data limits of the axis

Posted by Erotemic on Stack Overflow See other posts from Stack Overflow or by Erotemic
Published on 2013-11-11T21:27:12Z Indexed on 2013/11/11 21:53 UTC
Read the original article Hit count: 284

Filed under:
|

I have some code which plots some points. I substituted ax.scatter for ax.plot so I could control the color of each point individually. However when I make this change the axis x and y ranges seem to increase.

I can't pinpoint why this is happening. The only thing I've changed is plot to scatter.

This code makes an axis that is too big

    ax.scatter(x, y, c=color_list, s=pts_size, marker='o', edgecolor='none')
    #ax.plot(x, y, linestyle='None', marker='o', markerfacecolor=pts_color, markersize=pts_size, markeredgewidth=0)

This code does the right thing (but I can't control the color)

    #ax.scatter(x, y, c=color_list, s=pts_size, marker='o', edgecolor='none')
    ax.plot(x, y, linestyle='None', marker='o', markerfacecolor=pts_color, markersize=pts_size, markeredgewidth=0)

Is there a way I can call scatter such that it doesn't mess with my current axis limits?

© Stack Overflow or respective owner

Related posts about python

Related posts about matplotlib