adding all files done so far
This commit is contained in:
21
bayes-learning/test.py
Normal file
21
bayes-learning/test.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
import matplotlib.colors
|
||||
|
||||
x = np.linspace(-3, 3)
|
||||
X, Y = np.meshgrid(x, x)
|
||||
Z = np.exp(-(X**2 + Y**2))
|
||||
fig, (ax, ax2) = plt.subplots(ncols=2)
|
||||
|
||||
colors = ["red", "orange", "gold", "limegreen", "k",
|
||||
"#550011", "purple", "seagreen"]
|
||||
|
||||
ax.set_title("contour with color list")
|
||||
contour = ax.contourf(X, Y, Z, colors=colors)
|
||||
|
||||
ax2.set_title("contour with colormap")
|
||||
cmap = matplotlib.colors.ListedColormap(colors)
|
||||
contour = ax2.contourf(X, Y, Z, cmap=cmap)
|
||||
fig.colorbar(contour)
|
||||
|
||||
plt.show()
|
||||
Reference in New Issue
Block a user