Search code examples
pythonmatplotlibgraphmarkers

Re-sizing matplotlib markers


I see a ton of questing on re-sizing marker relative to the window and or position, but all I want to do is make the markers bigger.

I tried this but it doesn't like the markersize argument

plt.figure(figsize=(8, 6), dpi=80, markersize = 2)
for c, i, target_name, marker in zip("rgby", [0, 1, 2, 3], target_names,('*','x','1','d')):
    plt.scatter(X_r2[y == i, 0], X_r2[y == i, 1], c=c, label=target_name, marker=marker)
plt.legend()
plt.title(title)
plt.show

I know it must be super easy, but cant seem to find it, thanks!


Solution

  • in plt.scatter(X_r2[y == i, 0], X_r2[y == i, 1], c=c, label=target_name, marker=marker) and s = x where x is the size you'd like eg.

    plt.scatter(X_r2[y == i, 0], X_r2[y == i, 1], s=40, c=c, label=target_name, marker=marker)