Created
November 25, 2013 04:38
-
-
Save tomr-stargazer/7636445 to your computer and use it in GitHub Desktop.
Demo of how to do cool colorful folded
This file contains 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 numpy as np | |
import matplotlib.pyplot as plt | |
# Let's make some "dummy" data -- a time coordinate "x" and corresponding data "y". | |
x = np.arange(500) | |
y = np.sin(x/20.) + x/250. | |
period= 20 * 2*np.pi | |
# And then fold it on the period. | |
modulated = (x % period)/period | |
fig = plt.figure() | |
# Subplot makes two plots | |
plt.subplot(2,1,1) | |
# Scatter makes a scatterplot; when we set the "c=" keyword it colors in the points based on the array you give it. | |
plt.scatter(x,y, c=x) | |
plt.subplot(2,1,2) | |
plt.scatter(modulated, y, c=x) | |
plt.colorbar() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment