| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 8f39714 commit f5e6927
11 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -48,9 +48,9 @@ | |||
| 48 | 48 | # 3) gray level string: | |
| 49 | 49 | ax.set_title('Voltage vs. time chart', color='0.7') | |
| 50 | 50 | # 4) single letter color string | |
| 51 | - ax.set_xlabel('time (s)', color='c') | ||
| 51 | + ax.set_xlabel('Time [s]', color='c') | ||
| 52 | 52 | # 5) a named color: | |
| 53 | - ax.set_ylabel('voltage (mV)', color='peachpuff') | ||
| 53 | + ax.set_ylabel('Voltage [mV]', color='peachpuff') | ||
| 54 | 54 | # 6) a named xkcd color: | |
| 55 | 55 | ax.plot(t, s, 'xkcd:crimson') | |
| 56 | 56 | # 7) Cn notation: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -42,7 +42,7 @@ | |||
| 42 | 42 | ||
| 43 | 43 | If, as in this example, there are no discontinuities in the r, g, and b | |
| 44 | 44 | components, then it is quite simple: the second and third element of | |
| 45 | - each tuple, above, is the same--call it "``y``". The first element ("``x``") | ||
| 45 | + each tuple, above, is the same -- call it "``y``". The first element ("``x``") | ||
| 46 | 46 | defines interpolation intervals over the full range of 0 to 1, and it | |
| 47 | 47 | must span that whole range. In other words, the values of ``x`` divide the | |
| 48 | 48 | 0-to-1 range into a set of segments, and ``y`` gives the end-point color | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,19 +16,19 @@ | |||
| 16 | 16 | nse1 = np.random.randn(len(t)) # white noise 1 | |
| 17 | 17 | nse2 = np.random.randn(len(t)) # white noise 2 | |
| 18 | 18 | ||
| 19 | - # Two signals with a coherent part at 10Hz and a random part | ||
| 19 | + # Two signals with a coherent part at 10 Hz and a random part | ||
| 20 | 20 | s1 = np.sin(2 * np.pi * 10 * t) + nse1 | |
| 21 | 21 | s2 = np.sin(2 * np.pi * 10 * t) + nse2 | |
| 22 | 22 | ||
| 23 | 23 | fig, axs = plt.subplots(2, 1) | |
| 24 | 24 | axs[0].plot(t, s1, t, s2) | |
| 25 | 25 | axs[0].set_xlim(0, 2) | |
| 26 | - axs[0].set_xlabel('time') | ||
| 26 | + axs[0].set_xlabel('Time') | ||
| 27 | 27 | axs[0].set_ylabel('s1 and s2') | |
| 28 | 28 | axs[0].grid(True) | |
| 29 | 29 | ||
| 30 | 30 | cxy, f = axs[1].cohere(s1, s2, 256, 1. / dt) | |
| 31 | - axs[1].set_ylabel('coherence') | ||
| 31 | + axs[1].set_ylabel('Coherence') | ||
| 32 | 32 | ||
| 33 | 33 | fig.tight_layout() | |
| 34 | 34 | plt.show() | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -33,7 +33,7 @@ | |||
| 33 | 33 | ||
| 34 | 34 | ax1.plot(t, s1, t, s2) | |
| 35 | 35 | ax1.set_xlim(0, 5) | |
| 36 | - ax1.set_xlabel('time') | ||
| 36 | + ax1.set_xlabel('Time') | ||
| 37 | 37 | ax1.set_ylabel('s1 and s2') | |
| 38 | 38 | ax1.grid(True) | |
| 39 | 39 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,8 +11,8 @@ | |||
| 11 | 11 | fig = plt.figure() | |
| 12 | 12 | fig.subplots_adjust(top=0.8) | |
| 13 | 13 | ax1 = fig.add_subplot(211) | |
| 14 | - ax1.set_ylabel('volts') | ||
| 15 | - ax1.set_title('a sine wave') | ||
| 14 | + ax1.set_ylabel('Voltage [V]') | ||
| 15 | + ax1.set_title('A sine wave') | ||
| 16 | 16 | ||
| 17 | 17 | t = np.arange(0.0, 1.0, 0.01) | |
| 18 | 18 | s = np.sin(2 * np.pi * t) | |
@@ -23,7 +23,7 @@ | |||
| 23 | 23 | ||
| 24 | 24 | ax2 = fig.add_axes([0.15, 0.1, 0.7, 0.3]) | |
| 25 | 25 | n, bins, patches = ax2.hist(np.random.randn(1000), 50) | |
| 26 | - ax2.set_xlabel('time (s)') | ||
| 26 | + ax2.set_xlabel('Time [s]') | ||
| 27 | 27 | ||
| 28 | 28 | plt.show() | |
| 29 | 29 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,8 +16,8 @@ | |||
| 16 | 16 | plt.text(1, -0.6, r'$\sum_{i=0}^\infty x_i$', fontsize=20) | |
| 17 | 17 | plt.text(0.6, 0.6, r'$\mathcal{A}\mathrm{sin}(2 \omega t)$', | |
| 18 | 18 | fontsize=20) | |
| 19 | - plt.xlabel('time (s)') | ||
| 20 | - plt.ylabel('volts (mV)') | ||
| 19 | + plt.xlabel('Time [s]') | ||
| 20 | + plt.ylabel('Voltage [mV]') | ||
| 21 | 21 | plt.show() | |
| 22 | 22 | ||
| 23 | 23 | ############################################################################# | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -76,11 +76,11 @@ | |||
| 76 | 76 | # ============== | |
| 77 | 77 | # | |
| 78 | 78 | # Some of the path components require multiple vertices to specify them: | |
| 79 | - # for example CURVE 3 is a `bézier | ||
| 79 | + # for example CURVE 3 is a `Bézier | ||
| 80 | 80 | # <https://en.wikipedia.org/wiki/B%C3%A9zier_curve>`_ curve with one | |
| 81 | 81 | # control point and one end point, and CURVE4 has three vertices for the | |
| 82 | 82 | # two control points and the end point. The example below shows a | |
| 83 | - # CURVE4 Bézier spline -- the bézier curve will be contained in the | ||
| 83 | + # CURVE4 Bézier spline -- the Bézier curve will be contained in the | ||
| 84 | 84 | # convex hull of the start point, the two control points, and the end | |
| 85 | 85 | # point | |
| 86 | 86 | ||
@@ -139,8 +139,8 @@ | |||
| 139 | 139 | # for each histogram bar: the rectangle width is the bin width and the | |
| 140 | 140 | # rectangle height is the number of datapoints in that bin. First we'll | |
| 141 | 141 | # create some random normally distributed data and compute the | |
| 142 | - # histogram. Because numpy returns the bin edges and not centers, the | ||
| 143 | - # length of ``bins`` is 1 greater than the length of ``n`` in the | ||
| 142 | + # histogram. Because NumPy returns the bin edges and not centers, the | ||
| 143 | + # length of ``bins`` is one greater than the length of ``n`` in the | ||
| 144 | 144 | # example below:: | |
| 145 | 145 | # | |
| 146 | 146 | # # histogram our data with numpy | |
@@ -159,10 +159,10 @@ | |||
| 159 | 159 | # | |
| 160 | 160 | # Now we have to construct our compound path, which will consist of a | |
| 161 | 161 | # series of ``MOVETO``, ``LINETO`` and ``CLOSEPOLY`` for each rectangle. | |
| 162 | - # For each rectangle, we need 5 vertices: 1 for the ``MOVETO``, 3 for | ||
| 163 | - # the ``LINETO``, and 1 for the ``CLOSEPOLY``. As indicated in the | ||
| 164 | - # table above, the vertex for the closepoly is ignored but we still need | ||
| 165 | - # it to keep the codes aligned with the vertices:: | ||
| 162 | + # For each rectangle, we need five vertices: one for the ``MOVETO``, | ||
| 163 | + # three for the ``LINETO``, and one for the ``CLOSEPOLY``. As indicated | ||
| 164 | + # in the table above, the vertex for the closepoly is ignored but we still | ||
| 165 | + # need it to keep the codes aligned with the vertices:: | ||
| 166 | 166 | # | |
| 167 | 167 | # nverts = nrects*(1+3+1) | |
| 168 | 168 | # verts = np.zeros((nverts, 2)) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -123,8 +123,8 @@ class in the Matplotlib API, and the one you will be working with most | |||
| 123 | 123 | fig = plt.figure() | |
| 124 | 124 | fig.subplots_adjust(top=0.8) | |
| 125 | 125 | ax1 = fig.add_subplot(211) | |
| 126 | - ax1.set_ylabel('volts') | ||
| 127 | - ax1.set_title('a sine wave') | ||
| 126 | + ax1.set_ylabel('Voltage [V]') | ||
| 127 | + ax1.set_title('A sine wave') | ||
| 128 | 128 | ||
| 129 | 129 | t = np.arange(0.0, 1.0, 0.01) | |
| 130 | 130 | s = np.sin(2*np.pi*t) | |
@@ -136,7 +136,7 @@ class in the Matplotlib API, and the one you will be working with most | |||
| 136 | 136 | ax2 = fig.add_axes([0.15, 0.1, 0.7, 0.3]) | |
| 137 | 137 | n, bins, patches = ax2.hist(np.random.randn(1000), 50, | |
| 138 | 138 | facecolor='yellow', edgecolor='yellow') | |
| 139 | - ax2.set_xlabel('time (s)') | ||
| 139 | + ax2.set_xlabel('Time [s]') | ||
| 140 | 140 | ||
| 141 | 141 | plt.show() | |
| 142 | 142 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -263,7 +263,7 @@ def example_plot(ax, fontsize=12, hide_labels=False): | |||
| 263 | 263 | ||
| 264 | 264 | ########################################## | |
| 265 | 265 | # If there are more than two columns, the *wspace* is shared between them, | |
| 266 | - # so here the wspace is divided in 2, with a *wspace* of 0.1 between each | ||
| 266 | + # so here the wspace is divided in two, with a *wspace* of 0.1 between each | ||
| 267 | 267 | # column: | |
| 268 | 268 | ||
| 269 | 269 | fig, axs = plt.subplots(2, 3, layout="constrained") | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -295,8 +295,10 @@ def f(t): | |||
| 295 | 295 | # plt.figure(2) # a second figure | |
| 296 | 296 | # plt.plot([4, 5, 6]) # creates a subplot() by default | |
| 297 | 297 | # | |
| 298 | - # plt.figure(1) # figure 1 current; subplot(212) still current | ||
| 299 | - # plt.subplot(211) # make subplot(211) in figure1 current | ||
| 298 | + # plt.figure(1) # first figure current; | ||
| 299 | + # # subplot(212) still current | ||
| 300 | + # plt.subplot(211) # make subplot(211) in the first figure | ||
| 301 | + # # current | ||
| 300 | 302 | # plt.title('Easy as 1, 2, 3') # subplot 211 title | |
| 301 | 303 | # | |
| 302 | 304 | # You can clear the current figure with `~.pyplot.clf` | |
| Back | FazBrowse Home | New Git URL |
0 commit comments