Created
August 11, 2021 14:42
-
-
Save klunkean/2c335294f2fa27371491317f1bc2ee39 to your computer and use it in GitHub Desktop.
Plot of cos(tan(rica)) where rica in [0, pi]
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
from matplotlib.pyplot import subplots | |
from numpy import cos, tan, linspace, pi | |
fig, ax = subplots(1,1) | |
rica = linspace(0,pi,500) | |
costa_rica = cos(tan(rica)) | |
# | |
ax.plot( | |
rica, | |
costa_rica, | |
"k" | |
) | |
bs = [-1, -2/3,-.25,.25,2/3] | |
colors = ["#002b7f","#ffffff", "#ce1126","#ffffff", "#002b7f"] | |
for c, b in zip(colors, bs): | |
ax.fill_between(rica, b, costa_rica, color=c, where=costa_rica>b) | |
ax.set_title(r"$f(rica)=\cos(\tan(rica))$", fontsize=20); | |
ax.set_xlabel(r"$rica$", fontsize=16) | |
ax.set_ylabel(r"$f(rica)$", fontsize=16) | |
fig.set_size_inches(12,7) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment