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?
I would use ax.autoscale(enable=False)
before your call to scatter
.
If you want to limit autoscale
's reach, set the axis
kwarg to "x"
(i.e. ax.autoscale(enable=False, axis="x")
You can control the x and y axes limits: plt.xlim(xmin,xmax)
Same with y-axis
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With