Created
October 12, 2020 11:41
-
-
Save iancze/09b83f9f27b179e63e3c688881761b63 to your computer and use it in GitHub Desktop.
Matplotlib rasterized=True demonstration.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import numpy as np | |
n = 100000 | |
x = np.random.normal(size=n) | |
y = np.random.normal(size=n) | |
pkw = {"marker": "o", "alpha": 0.1, "mew": 0, "ms": 2, "ls": ""} | |
fig, ax = plt.subplots(nrows=1) | |
ax.plot(x, y, **pkw) | |
ax.set_aspect("equal") | |
plt.savefig("scatter.pdf") | |
fig, ax = plt.subplots(nrows=1) | |
ax.plot(x, y, "o", **pkw, rasterized=True) | |
ax.set_aspect("equal") | |
plt.savefig("scatter-rasterized.pdf", dpi=600) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment