Skip to content

Instantly share code, notes, and snippets.

@szdr
Created July 8, 2016 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save szdr/55970f711d61080373fc9bbf6a124e33 to your computer and use it in GitHub Desktop.
Save szdr/55970f711d61080373fc9bbf6a124e33 to your computer and use it in GitHub Desktop.
カラーバー付き散布図
import numpy as np
import matplotlib.cm as cm
import matplotlib.pyplot as plt
if __name__ == '__main__':
N = 100
X = np.random.rand(N, 2)
y = np.random.rand(N) * 2 - 1
sc = plt.scatter(X[:, 0], X[:, 1], vmin=-1, vmax=1, c=y, cmap=cm.seismic)
plt.colorbar(sc)
plt.savefig("demo.png")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment