| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,14 +12,14 @@ | |||
| 12 | 12 | ||
| 13 | 13 | # make data | |
| 14 | 14 | X, Y = np.meshgrid(np.linspace(-3, 3, 256), np.linspace(-3, 3, 256)) | |
| 15 | - Z = (1 - X/2. + X**5 + Y**3)*np.exp(-X**2-Y**2) | ||
| 15 | + Z = (1 - X/2. + X**5 + Y**3) * np.exp(-X**2 - Y**2) | ||
| 16 | 16 | Z = Z - Z.min() | |
| 17 | - levs = np.linspace(np.min(Z), np.max(Z), 7) | ||
| 17 | + levels = np.linspace(np.min(Z), np.max(Z), 7) | ||
| 18 | 18 | ||
| 19 | 19 | # plot | |
| 20 | 20 | fig, ax = plt.subplots() | |
| 21 | 21 | ||
| 22 | - plt.contourf(X, Y, Z, levels=levs) | ||
| 23 | - plt.contour(X, Y, Z, levels=levs, colors="white", linewidths=0.5) | ||
| 22 | + ax.contourf(X, Y, Z, levels=levels) | ||
| 23 | + ax.contour(X, Y, Z, levels=levels, colors="white", linewidths=0.5) | ||
| 24 | 24 | ||
| 25 | 25 | plt.show() | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,10 +19,8 @@ | |||
| 19 | 19 | ||
| 20 | 20 | # plot | |
| 21 | 21 | fig, ax = plt.subplots() | |
| 22 | + ax.grid(False) | ||
| 22 | 23 | ||
| 23 | - ax.imshow(Z, extent=[0, 8, 0, 8], interpolation="nearest", | ||
| 24 | - cmap=plt.get_cmap('Blues'), vmin=0, vmax=1.6) | ||
| 25 | - | ||
| 26 | - ax.set(xticks=[], yticks=[]) | ||
| 24 | + ax.imshow(Z) | ||
| 27 | 25 | ||
| 28 | 26 | plt.show() | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,7 +27,8 @@ | |||
| 27 | 27 | ||
| 28 | 28 | # plot | |
| 29 | 29 | fig, ax = plt.subplots() | |
| 30 | + ax.grid(False) | ||
| 30 | 31 | ||
| 31 | - ax.pcolormesh(X, Y, Z, vmin=0, vmax=1.5, shading='nearest') | ||
| 32 | + ax.pcolormesh(X, Y, Z, vmin=0, vmax=1.5) | ||
| 32 | 33 | ||
| 33 | 34 | plt.show() | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,15 +11,15 @@ | |||
| 11 | 11 | plt.style.use('mpl_plot_gallery') | |
| 12 | 12 | ||
| 13 | 13 | # make data | |
| 14 | - T = np.linspace(0, 2*np.pi, 8) | ||
| 15 | - X, Y = 4 + 1 * np.cos(T), 4 + 1 * np.sin(T) | ||
| 16 | - U, V = 1.5 * np.cos(T), 1.5 * np.sin(T) | ||
| 14 | + phi = np.linspace(0, 2 * np.pi, 8) | ||
| 15 | + x, y = 4 + 1 * np.cos(phi), 4 + 1 * np.sin(phi) | ||
| 16 | + u, v = 1.5 * np.cos(phi), 1.5 * np.sin(phi) | ||
| 17 | 17 | ||
| 18 | 18 | # plot | |
| 19 | 19 | fig, ax = plt.subplots() | |
| 20 | 20 | ||
| 21 | - plt.quiver(X, Y, U, V, color="C0", angles='xy', | ||
| 22 | - scale_units='xy', scale=0.5, width=.05) | ||
| 21 | + ax.quiver(x, y, u, v, color="C0", angles='xy', | ||
| 22 | + scale_units='xy', scale=0.5, width=.05) | ||
| 23 | 23 | ||
| 24 | 24 | ax.set(xlim=(0, 8), xticks=np.arange(1, 8), | |
| 25 | 25 | ylim=(0, 8), yticks=np.arange(1, 8)) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,13 +11,13 @@ | |||
| 11 | 11 | ||
| 12 | 12 | # make data: | |
| 13 | 13 | np.random.seed(3) | |
| 14 | - X = 0.5 + np.arange(8) | ||
| 15 | - Y = np.random.uniform(2, 7, len(X)) | ||
| 14 | + x = 0.5 + np.arange(8) | ||
| 15 | + y = np.random.uniform(2, 7, len(x)) | ||
| 16 | 16 | ||
| 17 | 17 | # plot | |
| 18 | 18 | fig, ax = plt.subplots() | |
| 19 | 19 | ||
| 20 | - ax.bar(X, Y, width=1, edgecolor="white", linewidth=0.7) | ||
| 20 | + ax.bar(x, y, width=1, edgecolor="white", linewidth=0.7) | ||
| 21 | 21 | ||
| 22 | 22 | ax.set(xlim=(0, 8), xticks=np.arange(1, 8), | |
| 23 | 23 | ylim=(0, 8), yticks=np.arange(1, 8)) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,12 +12,12 @@ | |||
| 12 | 12 | ||
| 13 | 13 | ||
| 14 | 14 | # make data | |
| 15 | - X = [1, 2, 3, 4] | ||
| 16 | - colors = plt.get_cmap('Blues')(np.linspace(0.2, 0.7, len(X))) | ||
| 15 | + x = [1, 2, 3, 4] | ||
| 16 | + colors = plt.get_cmap('Blues')(np.linspace(0.2, 0.7, len(x))) | ||
| 17 | 17 | ||
| 18 | 18 | # plot | |
| 19 | 19 | fig, ax = plt.subplots() | |
| 20 | - ax.pie(X, colors=colors, radius=3, center=(4, 4), | ||
| 20 | + ax.pie(x, colors=colors, radius=3, center=(4, 4), | ||
| 21 | 21 | wedgeprops={"linewidth": 1, "edgecolor": "white"}, frame=True) | |
| 22 | 22 | ||
| 23 | 23 | ax.set(xlim=(0, 8), xticks=np.arange(1, 8), | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,13 +12,13 @@ | |||
| 12 | 12 | plt.style.use('mpl_plot_gallery') | |
| 13 | 13 | ||
| 14 | 14 | # make data | |
| 15 | - X = np.linspace(0, 10, 100) | ||
| 16 | - Y = 4 + 2 * np.sin(2 * X) | ||
| 15 | + x = np.linspace(0, 10, 100) | ||
| 16 | + y = 4 + 2 * np.sin(2 * x) | ||
| 17 | 17 | ||
| 18 | 18 | # plot | |
| 19 | 19 | fig, ax = plt.subplots() | |
| 20 | 20 | ||
| 21 | - ax.plot(X, Y, linewidth=2.0) | ||
| 21 | + ax.plot(x, y, linewidth=2.0) | ||
| 22 | 22 | ||
| 23 | 23 | ax.set(xlim=(0, 8), xticks=np.arange(1, 8), | |
| 24 | 24 | ylim=(0, 8), yticks=np.arange(1, 8)) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,15 +12,16 @@ | |||
| 12 | 12 | ||
| 13 | 13 | # make the data | |
| 14 | 14 | np.random.seed(3) | |
| 15 | - X = 4 + np.random.normal(0, 2, 24) | ||
| 16 | - Y = 4 + np.random.normal(0, 2, len(X)) | ||
| 15 | + x = 4 + np.random.normal(0, 2, 24) | ||
| 16 | + y = 4 + np.random.normal(0, 2, len(x)) | ||
| 17 | 17 | # size and color: | |
| 18 | - S = np.random.uniform(15, 80, len(X)) | ||
| 18 | + sizes = np.random.uniform(15, 80, len(x)) | ||
| 19 | + colors = np.random.uniform(15, 80, len(x)) | ||
| 19 | 20 | ||
| 20 | 21 | # plot | |
| 21 | 22 | fig, ax = plt.subplots() | |
| 22 | 23 | ||
| 23 | - ax.scatter(X, Y, s=S, c=-S, cmap=plt.get_cmap('Blues'), vmin=-100, vmax=0) | ||
| 24 | + ax.scatter(x, y, s=sizes, c=colors, vmin=-100, vmax=0) | ||
| 24 | 25 | ||
| 25 | 26 | ax.set(xlim=(0, 8), xticks=np.arange(1, 8), | |
| 26 | 27 | ylim=(0, 8), yticks=np.arange(1, 8)) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,13 +12,13 @@ | |||
| 12 | 12 | ||
| 13 | 13 | # make data | |
| 14 | 14 | np.random.seed(3) | |
| 15 | - X = 0.5 + np.arange(8) | ||
| 16 | - Y = np.random.uniform(2, 7, len(X)) | ||
| 15 | + x = 0.5 + np.arange(8) | ||
| 16 | + y = np.random.uniform(2, 7, len(x)) | ||
| 17 | 17 | ||
| 18 | 18 | # plot | |
| 19 | 19 | fig, ax = plt.subplots() | |
| 20 | 20 | ||
| 21 | - ax.stem(X, Y, bottom=0, linefmt="-", markerfmt="d") | ||
| 21 | + ax.stem(x, y) | ||
| 22 | 22 | ||
| 23 | 23 | ax.set(xlim=(0, 8), xticks=np.arange(1, 8), | |
| 24 | 24 | ylim=(0, 8), yticks=np.arange(1, 8)) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,13 +12,13 @@ | |||
| 12 | 12 | ||
| 13 | 13 | # make data | |
| 14 | 14 | np.random.seed(3) | |
| 15 | - X = 0.5 + np.arange(8) | ||
| 16 | - Y = np.random.uniform(2, 7, len(X)) | ||
| 15 | + x = 0.5 + np.arange(8) | ||
| 16 | + y = np.random.uniform(2, 7, len(x)) | ||
| 17 | 17 | ||
| 18 | 18 | # plot | |
| 19 | 19 | fig, ax = plt.subplots() | |
| 20 | 20 | ||
| 21 | - ax.step(X, Y, linewidth=2.5) | ||
| 21 | + ax.step(x, y, linewidth=2.5) | ||
| 22 | 22 | ||
| 23 | 23 | ax.set(xlim=(0, 8), xticks=np.arange(1, 8), | |
| 24 | 24 | ylim=(0, 8), yticks=np.arange(1, 8)) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments