From 525b1f9ac4583248b3395c155d86675e1702df2c Mon Sep 17 00:00:00 2001 From: Michael Grund Date: Sun, 14 Feb 2021 12:58:34 +0100 Subject: [PATCH 01/22] Create vectors.py --- examples/gallery/line/vectors.py | 140 +++++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 examples/gallery/line/vectors.py diff --git a/examples/gallery/line/vectors.py b/examples/gallery/line/vectors.py new file mode 100644 index 00000000000..66fbbf00d50 --- /dev/null +++ b/examples/gallery/line/vectors.py @@ -0,0 +1,140 @@ +""" +Vectors +------- + +The :meth:`pygmt.Figure.plot` method can plot individual types of vectors. +There are three classes of vectors: Cartesian, circular and geographic. While +their use is slightly different, they all share common modifiers that affect +how they are displayed. + +The following vectors are available: + +- **v**: vector, ``x```, ``y``, ``direction`` +- **m**: math arc angle, ``x```, ``y``, ``direction`` +- **=**: geographic vector, ``x```, ``y``, ``direction`` + +Upper-case versions **V** and **M** are similar to **v** and **m** but expect geographic +azimuths and distances. + +""" + +import numpy as np +import pygmt + +fig = pygmt.Figure() +fig.basemap(region=[0, 60, -50, 50], + projection="X10c/10c", + frame=True) + +################################ +# plot simple horizontal vectors + +x=5 +y=40 +idx=1 + +for vecstyle in [ + "v0.5c+e", # (1) simple vector with arrow head at the end + "v0.3c+bc+ea+a80", # (2) vector with arrow head at the end and a circle at the beginning + "v0.3c+bt+et+a80", # (3) vector with terminal lines at beginning and end + "v0.85c+bi+ea+h0.5", # (4) vector with tail at the beginning and an arrow with modified vector head at the end + "v0.7c+bar+et", # (5) vector with half-sided arrow head at the beginning and terminal line at the end +]: + fig.plot(x=x, y=y, style=vecstyle, direction=([0], [4]), pen="2p", color ="red3") + fig.text(x=16.5, y=y+3.5, text="(" + str(idx) + ")") + y -= 10 # move the next vector down + idx+=1 + +################################ +# (6)-(8) plot simple vertical vectors using different pens and colors + +x=37 +y=-5 + +vectorsv =[ + ["v1.2c+e+b+h0.5", "lightgreen", "4p,seagreen"], # (6) + ["v1.2c+bi+eA+h0.2", "lightblue", "2p,dodgerblue4"], # (7) + ["v1.3c+bi+ea+h0.4+r", "orchid", "2p,darkmagenta"]] # (8) + +for vector in vectorsv: + fig.plot(x=x, + y=y, + direction=([90], [5]), + style=vector[0], + color=vector[1], + pen=vector[2]) + + fig.text(x = x-3, + y = 43.5, + text = "(" + str(idx) + ")") + + x+=7.5 + idx+=1 + + +################################ +# (9)-(12) circular vectors + +# (9) plot a math angle arc with its center at 10/-26, +# a radius of 1 and a start angle of 0 and end angle of 300 degrees +data = np.array([[10, -26, 1, 0, 300]]) +fig.plot(data=data, + style="m0.5c+ea", + color="red3", + pen="2p,gray25") + +fig.text(x = 10, + y = -43, + text = "(" + str(idx) + ")") +idx+=1 + +# (10-12) plot math angle arcs with different radii +# and start/end vector modifiers +x=20 +y=-40 +startdir=0 +stopdir=90 +radius=2.5 +pen="1.5p,gray25" +xtext=24.5 + +for arcstyle in [ + "m0.5c+ea+ba+r", # (9) + "m0.5c+ea+ba", # (10) + "m0.5c+ea" # (11) +]: + + data = np.array([[x, y, radius, startdir, stopdir]]) + fig.plot(data=data, + style=arcstyle, + color="red3", + pen=pen) + + fig.text(x = xtext+3, + y = -43, + text = "(" + str(idx) + ")") + + radius-=0.5 + xtext+=4.55 + idx+=1 + +################################ +# (13) set of vectors with arrow ends starting from one center point + +x = np.repeat(48, 8) +y = np.repeat(-23, 8) +lengths = np.repeat(1.5, 8) + +fig.plot(x=x, + y=y, + direction=([80,50,10, 100, 260,115, 180, 230], lengths), + style="V0.5c+e", + color="slateblue", + pen="1.5p") + +fig.text(x = 48, + y = -43, + text = "(" + str(idx) + ")") +idx+=1 + +fig.show() From 8479e60185fa663beb65b5f3261d1f9aac481fe5 Mon Sep 17 00:00:00 2001 From: Michael Grund Date: Sun, 14 Feb 2021 13:06:42 +0100 Subject: [PATCH 02/22] formatting etc. --- examples/gallery/line/vectors.py | 132 +++++++++++++------------------ 1 file changed, 56 insertions(+), 76 deletions(-) diff --git a/examples/gallery/line/vectors.py b/examples/gallery/line/vectors.py index 66fbbf00d50..5a039100b7c 100644 --- a/examples/gallery/line/vectors.py +++ b/examples/gallery/line/vectors.py @@ -22,54 +22,48 @@ import pygmt fig = pygmt.Figure() -fig.basemap(region=[0, 60, -50, 50], - projection="X10c/10c", - frame=True) +fig.basemap(region=[0, 60, -50, 50], projection="X10c/10c", frame=True) ################################ -# plot simple horizontal vectors +# plot simple horizontal vectors -x=5 -y=40 -idx=1 +x = 5 +y = 40 +idx = 1 for vecstyle in [ - "v0.5c+e", # (1) simple vector with arrow head at the end + "v0.5c+e", # (1) simple vector with arrow head at the end "v0.3c+bc+ea+a80", # (2) vector with arrow head at the end and a circle at the beginning "v0.3c+bt+et+a80", # (3) vector with terminal lines at beginning and end - "v0.85c+bi+ea+h0.5", # (4) vector with tail at the beginning and an arrow with modified vector head at the end - "v0.7c+bar+et", # (5) vector with half-sided arrow head at the beginning and terminal line at the end + "v0.85c+bi+ea+h0.5", # (4) vector with tail at the beginning and an arrow with modified vector head at the end + "v0.7c+bar+et", # (5) vector with half-sided arrow head at the beginning and terminal line at the end ]: - fig.plot(x=x, y=y, style=vecstyle, direction=([0], [4]), pen="2p", color ="red3") - fig.text(x=16.5, y=y+3.5, text="(" + str(idx) + ")") + fig.plot(x=x, y=y, style=vecstyle, direction=([0], [4]), pen="2p", color="red3") + fig.text(x=16.5, y=y + 3.5, text="(" + str(idx) + ")") y -= 10 # move the next vector down - idx+=1 + idx += 1 ################################ # (6)-(8) plot simple vertical vectors using different pens and colors -x=37 -y=-5 +x = 37 +y = -5 -vectorsv =[ - ["v1.2c+e+b+h0.5", "lightgreen", "4p,seagreen"], # (6) - ["v1.2c+bi+eA+h0.2", "lightblue", "2p,dodgerblue4"], # (7) - ["v1.3c+bi+ea+h0.4+r", "orchid", "2p,darkmagenta"]] # (8) +vectorsv = [ + ["v1.2c+e+b+h0.5", "lightgreen", "4p,seagreen"], # (6) + ["v1.2c+bi+eA+h0.2", "lightblue", "2p,dodgerblue4"], # (7) + ["v1.3c+bi+ea+h0.4+r", "orchid", "2p,darkmagenta"], +] # (8) for vector in vectorsv: - fig.plot(x=x, - y=y, - direction=([90], [5]), - style=vector[0], - color=vector[1], - pen=vector[2]) - - fig.text(x = x-3, - y = 43.5, - text = "(" + str(idx) + ")") + fig.plot( + x=x, y=y, direction=([90], [5]), style=vector[0], color=vector[1], pen=vector[2] + ) - x+=7.5 - idx+=1 + fig.text(x=x - 3, y=43.5, text="(" + str(idx) + ")") + + x += 7.5 + idx += 1 ################################ @@ -78,46 +72,32 @@ # (9) plot a math angle arc with its center at 10/-26, # a radius of 1 and a start angle of 0 and end angle of 300 degrees data = np.array([[10, -26, 1, 0, 300]]) -fig.plot(data=data, - style="m0.5c+ea", - color="red3", - pen="2p,gray25") +fig.plot(data=data, style="m0.5c+ea", color="red3", pen="2p,gray25") -fig.text(x = 10, - y = -43, - text = "(" + str(idx) + ")") -idx+=1 +fig.text(x=10, y=-43, text="(" + str(idx) + ")") +idx += 1 # (10-12) plot math angle arcs with different radii # and start/end vector modifiers -x=20 -y=-40 -startdir=0 -stopdir=90 -radius=2.5 -pen="1.5p,gray25" -xtext=24.5 - -for arcstyle in [ - "m0.5c+ea+ba+r", # (9) - "m0.5c+ea+ba", # (10) - "m0.5c+ea" # (11) -]: +x = 20 +y = -40 +startdir = 0 +stopdir = 90 +radius = 2.5 +pen = "1.5p,gray25" +xtext = 24.5 + +for arcstyle in ["m0.5c+ea+ba+r", "m0.5c+ea+ba", "m0.5c+ea"]: # (9) # (10) # (11) data = np.array([[x, y, radius, startdir, stopdir]]) - fig.plot(data=data, - style=arcstyle, - color="red3", - pen=pen) - - fig.text(x = xtext+3, - y = -43, - text = "(" + str(idx) + ")") - - radius-=0.5 - xtext+=4.55 - idx+=1 - + fig.plot(data=data, style=arcstyle, color="red3", pen=pen) + + fig.text(x=xtext + 3, y=-43, text="(" + str(idx) + ")") + + radius -= 0.5 + xtext += 4.55 + idx += 1 + ################################ # (13) set of vectors with arrow ends starting from one center point @@ -125,16 +105,16 @@ y = np.repeat(-23, 8) lengths = np.repeat(1.5, 8) -fig.plot(x=x, - y=y, - direction=([80,50,10, 100, 260,115, 180, 230], lengths), - style="V0.5c+e", - color="slateblue", - pen="1.5p") - -fig.text(x = 48, - y = -43, - text = "(" + str(idx) + ")") -idx+=1 +fig.plot( + x=x, + y=y, + direction=([80, 50, 10, 100, 260, 115, 180, 230], lengths), + style="V0.5c+e", + color="slateblue", + pen="1.5p", +) + +fig.text(x=48, y=-43, text="(" + str(idx) + ")") +idx += 1 fig.show() From 7342953f3b91d93dbde46e694ebaccf8207cf10c Mon Sep 17 00:00:00 2001 From: Michael Grund Date: Sun, 14 Feb 2021 16:11:23 +0100 Subject: [PATCH 03/22] adjustments --- examples/gallery/line/vectors.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/examples/gallery/line/vectors.py b/examples/gallery/line/vectors.py index 5a039100b7c..6f2bdd3c611 100644 --- a/examples/gallery/line/vectors.py +++ b/examples/gallery/line/vectors.py @@ -25,7 +25,7 @@ fig.basemap(region=[0, 60, -50, 50], projection="X10c/10c", frame=True) ################################ -# plot simple horizontal vectors +# Plot simple horizontal vectors (1)-(5) x = 5 y = 40 @@ -44,7 +44,7 @@ idx += 1 ################################ -# (6)-(8) plot simple vertical vectors using different pens and colors +# Plot simple vertical vectors using different pens and colors (6)-(8) x = 37 y = -5 @@ -52,8 +52,8 @@ vectorsv = [ ["v1.2c+e+b+h0.5", "lightgreen", "4p,seagreen"], # (6) ["v1.2c+bi+eA+h0.2", "lightblue", "2p,dodgerblue4"], # (7) - ["v1.3c+bi+ea+h0.4+r", "orchid", "2p,darkmagenta"], -] # (8) + ["v1.3c+bi+ea+h0.4+r", "orchid", "2p,darkmagenta"], # (8) +] for vector in vectorsv: fig.plot( @@ -67,7 +67,7 @@ ################################ -# (9)-(12) circular vectors +# Plot circular vectors (9)-(12) # (9) plot a math angle arc with its center at 10/-26, # a radius of 1 and a start angle of 0 and end angle of 300 degrees @@ -77,29 +77,33 @@ fig.text(x=10, y=-43, text="(" + str(idx) + ")") idx += 1 -# (10-12) plot math angle arcs with different radii -# and start/end vector modifiers +# (10-12) plot math angle arcs starting at 0 degrees and ending at 90 degrees +# with different radii and start/end vector modifiers x = 20 y = -40 startdir = 0 stopdir = 90 -radius = 2.5 +radius = 1.5 pen = "1.5p,gray25" xtext = 24.5 -for arcstyle in ["m0.5c+ea+ba+r", "m0.5c+ea+ba", "m0.5c+ea"]: # (9) # (10) # (11) +for arcstyle in [ + "m0.5c+ea+ba+r", # (9) right-sided half-arrow heads at beginning and end + "m0.5c+ea+ba", # (10) arrow head at beginning and end + "m0.5c+ea", # (11) arrow head at the vector end +]: data = np.array([[x, y, radius, startdir, stopdir]]) fig.plot(data=data, style=arcstyle, color="red3", pen=pen) fig.text(x=xtext + 3, y=-43, text="(" + str(idx) + ")") - radius -= 0.5 + radius += 0.5 xtext += 4.55 idx += 1 ################################ -# (13) set of vectors with arrow ends starting from one center point +# Plot set of vectors with arrow ends starting from one center point (13) x = np.repeat(48, 8) y = np.repeat(-23, 8) From fbc28660b01cd4d51dc19f6ef0d5e6554c229354 Mon Sep 17 00:00:00 2001 From: Michael Grund Date: Sun, 14 Feb 2021 16:59:33 +0100 Subject: [PATCH 04/22] modified docs --- examples/gallery/line/vectors.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/examples/gallery/line/vectors.py b/examples/gallery/line/vectors.py index 6f2bdd3c611..8936b86d576 100644 --- a/examples/gallery/line/vectors.py +++ b/examples/gallery/line/vectors.py @@ -2,16 +2,19 @@ Vectors ------- -The :meth:`pygmt.Figure.plot` method can plot individual types of vectors. -There are three classes of vectors: Cartesian, circular and geographic. While -their use is slightly different, they all share common modifiers that affect -how they are displayed. +The :meth:`pygmt.Figure.plot` method can plot three classes of vectors: +Cartesian, circular and geographic. While their use is slightly different, +they all share common modifiers that affect how they are displayed. +We must specify the vector type and the modifiers by passing the corresponding +shortcuts listed below to the ``style``` argument. Additionally, we must define +the vector directions (angle and length, azimuth and length, or x and y +components) via the ``direction`` argument. The following vectors are available: -- **v**: vector, ``x```, ``y``, ``direction`` -- **m**: math arc angle, ``x```, ``y``, ``direction`` -- **=**: geographic vector, ``x```, ``y``, ``direction`` +- **v**: cartesian +- **m**: circular +- **=**: geographic Upper-case versions **V** and **M** are similar to **v** and **m** but expect geographic azimuths and distances. @@ -119,6 +122,5 @@ ) fig.text(x=48, y=-43, text="(" + str(idx) + ")") -idx += 1 fig.show() From 07820eecc015d4bcfe64c256ae16ed07f6953c36 Mon Sep 17 00:00:00 2001 From: Michael Grund Date: Sun, 14 Feb 2021 17:27:21 +0100 Subject: [PATCH 05/22] corrected typos --- examples/gallery/line/vectors.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/gallery/line/vectors.py b/examples/gallery/line/vectors.py index 8936b86d576..a568db96d28 100644 --- a/examples/gallery/line/vectors.py +++ b/examples/gallery/line/vectors.py @@ -6,14 +6,14 @@ Cartesian, circular and geographic. While their use is slightly different, they all share common modifiers that affect how they are displayed. We must specify the vector type and the modifiers by passing the corresponding -shortcuts listed below to the ``style``` argument. Additionally, we must define +shortcuts listed below to the ``style`` argument. Additionally, we must define the vector directions (angle and length, azimuth and length, or x and y components) via the ``direction`` argument. The following vectors are available: - **v**: cartesian -- **m**: circular +- **m**: circular (math angle arc) - **=**: geographic Upper-case versions **V** and **M** are similar to **v** and **m** but expect geographic @@ -35,7 +35,7 @@ idx = 1 for vecstyle in [ - "v0.5c+e", # (1) simple vector with arrow head at the end + "v0.5c+e", # (1) simple vector (angle of 0 degrees and length of 4) with arrow head at the end "v0.3c+bc+ea+a80", # (2) vector with arrow head at the end and a circle at the beginning "v0.3c+bt+et+a80", # (3) vector with terminal lines at beginning and end "v0.85c+bi+ea+h0.5", # (4) vector with tail at the beginning and an arrow with modified vector head at the end @@ -55,7 +55,7 @@ vectorsv = [ ["v1.2c+e+b+h0.5", "lightgreen", "4p,seagreen"], # (6) ["v1.2c+bi+eA+h0.2", "lightblue", "2p,dodgerblue4"], # (7) - ["v1.3c+bi+ea+h0.4+r", "orchid", "2p,darkmagenta"], # (8) + ["v1.3c+bi+ea+h0.4+r", "white", "2p,darkmagenta"], # (8) ] for vector in vectorsv: From 7b468df53e4a830b03000c9e1797de91ad757c3e Mon Sep 17 00:00:00 2001 From: Michael Grund Date: Tue, 16 Feb 2021 17:30:45 +0100 Subject: [PATCH 06/22] added example showing different vector heads and tails --- examples/gallery/line/vector-heads-tails.py | 40 +++++++ examples/gallery/line/vectors.py | 126 -------------------- 2 files changed, 40 insertions(+), 126 deletions(-) create mode 100644 examples/gallery/line/vector-heads-tails.py delete mode 100644 examples/gallery/line/vectors.py diff --git a/examples/gallery/line/vector-heads-tails.py b/examples/gallery/line/vector-heads-tails.py new file mode 100644 index 00000000000..b3b0cf5c0ae --- /dev/null +++ b/examples/gallery/line/vector-heads-tails.py @@ -0,0 +1,40 @@ +""" +Vectors heads and tails +------- + +The :meth:`pygmt.Figure.plot` method can plot vectors with individual +heads and tails. We must specify the modifiers (together with the vector type) +by passing the corresponding shortcuts to the ``style`` argument. + +""" + +import pygmt + +fig = pygmt.Figure() +fig.basemap(region=[0, 10, 0, 15], projection="X15c/10c", frame='+t"Vector heads and tails"') + +x=1 +y=14 +angle=0 # in degrees, measured counter-clockwise from horizontal +length=7 + +for vecstyle in [ + "v0c", # vector without head and tail (line) + "v0.6c+bA+eA+a50", # plain open arrow at the beginning and end of the vector path, angle of the vector head apex is set to 50 + "v0.4c+bI+eI", # plain open tail at the beginning and end + "v0.3c+bt+et+a80", # terminal line at the beginning and end, angle of the vector head apep is set to 80 + "v0.6c+e", # arrow head at the end + "v0.6c+bc+ea", # circle at the beginning and an arrow head at the end + "v0.6c+bt+ea", # terminal line at the beginning and an arrow head at the end + "v1c+e+h0.5", # arrow head at the end, shape of the vector head is set to 0.5 + "v1c+b+e+h0.5", # modified arrow heads at the beginning and end + "v1c+bi+ea+h0.5", # tail at the beginning and an arrow with modified vector head at the end + "v1c+bar+ea+h0.8", # half-sided arrow head (right side) at the beginning and an arrow at the end + "v1c+bar+eal+h0.5", # half-sided arrow heads at the beginning (right side) and end (left side) + "v1c+bi+ea+r+h0.5+a45", # half-sided tail at the beginning and arrow at the at the end (right side for both) +]: + fig.plot(x=x, y=y, style=vecstyle, direction=([angle], [length]), pen="2p", color="red3") + fig.text(x=6, y=y, text=vecstyle, justify="ML", offset="0.2c/0c") + y -= 1 # move the next vector down + +fig.show() \ No newline at end of file diff --git a/examples/gallery/line/vectors.py b/examples/gallery/line/vectors.py deleted file mode 100644 index a568db96d28..00000000000 --- a/examples/gallery/line/vectors.py +++ /dev/null @@ -1,126 +0,0 @@ -""" -Vectors -------- - -The :meth:`pygmt.Figure.plot` method can plot three classes of vectors: -Cartesian, circular and geographic. While their use is slightly different, -they all share common modifiers that affect how they are displayed. -We must specify the vector type and the modifiers by passing the corresponding -shortcuts listed below to the ``style`` argument. Additionally, we must define -the vector directions (angle and length, azimuth and length, or x and y -components) via the ``direction`` argument. - -The following vectors are available: - -- **v**: cartesian -- **m**: circular (math angle arc) -- **=**: geographic - -Upper-case versions **V** and **M** are similar to **v** and **m** but expect geographic -azimuths and distances. - -""" - -import numpy as np -import pygmt - -fig = pygmt.Figure() -fig.basemap(region=[0, 60, -50, 50], projection="X10c/10c", frame=True) - -################################ -# Plot simple horizontal vectors (1)-(5) - -x = 5 -y = 40 -idx = 1 - -for vecstyle in [ - "v0.5c+e", # (1) simple vector (angle of 0 degrees and length of 4) with arrow head at the end - "v0.3c+bc+ea+a80", # (2) vector with arrow head at the end and a circle at the beginning - "v0.3c+bt+et+a80", # (3) vector with terminal lines at beginning and end - "v0.85c+bi+ea+h0.5", # (4) vector with tail at the beginning and an arrow with modified vector head at the end - "v0.7c+bar+et", # (5) vector with half-sided arrow head at the beginning and terminal line at the end -]: - fig.plot(x=x, y=y, style=vecstyle, direction=([0], [4]), pen="2p", color="red3") - fig.text(x=16.5, y=y + 3.5, text="(" + str(idx) + ")") - y -= 10 # move the next vector down - idx += 1 - -################################ -# Plot simple vertical vectors using different pens and colors (6)-(8) - -x = 37 -y = -5 - -vectorsv = [ - ["v1.2c+e+b+h0.5", "lightgreen", "4p,seagreen"], # (6) - ["v1.2c+bi+eA+h0.2", "lightblue", "2p,dodgerblue4"], # (7) - ["v1.3c+bi+ea+h0.4+r", "white", "2p,darkmagenta"], # (8) -] - -for vector in vectorsv: - fig.plot( - x=x, y=y, direction=([90], [5]), style=vector[0], color=vector[1], pen=vector[2] - ) - - fig.text(x=x - 3, y=43.5, text="(" + str(idx) + ")") - - x += 7.5 - idx += 1 - - -################################ -# Plot circular vectors (9)-(12) - -# (9) plot a math angle arc with its center at 10/-26, -# a radius of 1 and a start angle of 0 and end angle of 300 degrees -data = np.array([[10, -26, 1, 0, 300]]) -fig.plot(data=data, style="m0.5c+ea", color="red3", pen="2p,gray25") - -fig.text(x=10, y=-43, text="(" + str(idx) + ")") -idx += 1 - -# (10-12) plot math angle arcs starting at 0 degrees and ending at 90 degrees -# with different radii and start/end vector modifiers -x = 20 -y = -40 -startdir = 0 -stopdir = 90 -radius = 1.5 -pen = "1.5p,gray25" -xtext = 24.5 - -for arcstyle in [ - "m0.5c+ea+ba+r", # (9) right-sided half-arrow heads at beginning and end - "m0.5c+ea+ba", # (10) arrow head at beginning and end - "m0.5c+ea", # (11) arrow head at the vector end -]: - - data = np.array([[x, y, radius, startdir, stopdir]]) - fig.plot(data=data, style=arcstyle, color="red3", pen=pen) - - fig.text(x=xtext + 3, y=-43, text="(" + str(idx) + ")") - - radius += 0.5 - xtext += 4.55 - idx += 1 - -################################ -# Plot set of vectors with arrow ends starting from one center point (13) - -x = np.repeat(48, 8) -y = np.repeat(-23, 8) -lengths = np.repeat(1.5, 8) - -fig.plot( - x=x, - y=y, - direction=([80, 50, 10, 100, 260, 115, 180, 230], lengths), - style="V0.5c+e", - color="slateblue", - pen="1.5p", -) - -fig.text(x=48, y=-43, text="(" + str(idx) + ")") - -fig.show() From b44f1b0aff3c91a3a8370897796c239515904503 Mon Sep 17 00:00:00 2001 From: Michael Grund Date: Tue, 16 Feb 2021 17:35:28 +0100 Subject: [PATCH 07/22] formatting --- examples/gallery/line/vector-heads-tails.py | 44 +++++++++++---------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/examples/gallery/line/vector-heads-tails.py b/examples/gallery/line/vector-heads-tails.py index b3b0cf5c0ae..ac9f695d3d5 100644 --- a/examples/gallery/line/vector-heads-tails.py +++ b/examples/gallery/line/vector-heads-tails.py @@ -11,30 +11,34 @@ import pygmt fig = pygmt.Figure() -fig.basemap(region=[0, 10, 0, 15], projection="X15c/10c", frame='+t"Vector heads and tails"') +fig.basemap( + region=[0, 10, 0, 15], projection="X15c/10c", frame='+t"Vector heads and tails"' +) -x=1 -y=14 -angle=0 # in degrees, measured counter-clockwise from horizontal -length=7 +x = 1 +y = 14 +angle = 0 # in degrees, measured counter-clockwise from horizontal +length = 7 for vecstyle in [ - "v0c", # vector without head and tail (line) - "v0.6c+bA+eA+a50", # plain open arrow at the beginning and end of the vector path, angle of the vector head apex is set to 50 - "v0.4c+bI+eI", # plain open tail at the beginning and end - "v0.3c+bt+et+a80", # terminal line at the beginning and end, angle of the vector head apep is set to 80 - "v0.6c+e", # arrow head at the end - "v0.6c+bc+ea", # circle at the beginning and an arrow head at the end - "v0.6c+bt+ea", # terminal line at the beginning and an arrow head at the end - "v1c+e+h0.5", # arrow head at the end, shape of the vector head is set to 0.5 - "v1c+b+e+h0.5", # modified arrow heads at the beginning and end - "v1c+bi+ea+h0.5", # tail at the beginning and an arrow with modified vector head at the end - "v1c+bar+ea+h0.8", # half-sided arrow head (right side) at the beginning and an arrow at the end - "v1c+bar+eal+h0.5", # half-sided arrow heads at the beginning (right side) and end (left side) - "v1c+bi+ea+r+h0.5+a45", # half-sided tail at the beginning and arrow at the at the end (right side for both) + "v0c", # vector without head and tail (line) + "v0.6c+bA+eA+a50", # plain open arrow at the beginning and end of the vector path, angle of the vector head apex is set to 50 + "v0.4c+bI+eI", # plain open tail at the beginning and end + "v0.3c+bt+et+a80", # terminal line at the beginning and end, angle of the vector head apep is set to 80 + "v0.6c+e", # arrow head at the end + "v0.6c+bc+ea", # circle at the beginning and an arrow head at the end + "v0.6c+bt+ea", # terminal line at the beginning and an arrow head at the end + "v1c+e+h0.5", # arrow head at the end, shape of the vector head is set to 0.5 + "v1c+b+e+h0.5", # modified arrow heads at the beginning and end + "v1c+bi+ea+h0.5", # tail at the beginning and an arrow with modified vector head at the end + "v1c+bar+ea+h0.8", # half-sided arrow head (right side) at the beginning and an arrow at the end + "v1c+bar+eal+h0.5", # half-sided arrow heads at the beginning (right side) and end (left side) + "v1c+bi+ea+r+h0.5+a45", # half-sided tail at the beginning and arrow at the at the end (right side for both) ]: - fig.plot(x=x, y=y, style=vecstyle, direction=([angle], [length]), pen="2p", color="red3") + fig.plot( + x=x, y=y, style=vecstyle, direction=([angle], [length]), pen="2p", color="red3" + ) fig.text(x=6, y=y, text=vecstyle, justify="ML", offset="0.2c/0c") y -= 1 # move the next vector down -fig.show() \ No newline at end of file +fig.show() From 6341270f2879af69225429aef03e1f35860a1022 Mon Sep 17 00:00:00 2001 From: Michael Grund Date: Tue, 16 Feb 2021 17:51:51 +0100 Subject: [PATCH 08/22] corrected typo --- examples/gallery/line/vector-heads-tails.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gallery/line/vector-heads-tails.py b/examples/gallery/line/vector-heads-tails.py index ac9f695d3d5..b32a1c78250 100644 --- a/examples/gallery/line/vector-heads-tails.py +++ b/examples/gallery/line/vector-heads-tails.py @@ -1,5 +1,5 @@ """ -Vectors heads and tails +Vector heads and tails ------- The :meth:`pygmt.Figure.plot` method can plot vectors with individual From 5aaac63d9578c5ee2ee2bfc3aad59350e16b4230 Mon Sep 17 00:00:00 2001 From: Michael Grund Date: Wed, 17 Feb 2021 17:01:00 +0100 Subject: [PATCH 09/22] Update examples/gallery/line/vector-heads-tails.py Co-authored-by: Dongdong Tian --- examples/gallery/line/vector-heads-tails.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gallery/line/vector-heads-tails.py b/examples/gallery/line/vector-heads-tails.py index b32a1c78250..2890aea08d3 100644 --- a/examples/gallery/line/vector-heads-tails.py +++ b/examples/gallery/line/vector-heads-tails.py @@ -1,6 +1,6 @@ """ Vector heads and tails -------- +---------------------- The :meth:`pygmt.Figure.plot` method can plot vectors with individual heads and tails. We must specify the modifiers (together with the vector type) From 46f59d5f7a2bfb338fa120506041b9868f1837a9 Mon Sep 17 00:00:00 2001 From: Michael Grund Date: Wed, 17 Feb 2021 18:04:42 +0100 Subject: [PATCH 10/22] modifications based on review --- examples/gallery/line/vector-heads-tails.py | 66 ++++++++++++++++----- 1 file changed, 50 insertions(+), 16 deletions(-) diff --git a/examples/gallery/line/vector-heads-tails.py b/examples/gallery/line/vector-heads-tails.py index 2890aea08d3..a1f8eaa8825 100644 --- a/examples/gallery/line/vector-heads-tails.py +++ b/examples/gallery/line/vector-heads-tails.py @@ -2,10 +2,31 @@ Vector heads and tails ---------------------- -The :meth:`pygmt.Figure.plot` method can plot vectors with individual -heads and tails. We must specify the modifiers (together with the vector type) -by passing the corresponding shortcuts to the ``style`` argument. +Many modules in PyGMT allow to plot vectors with individual +heads and tails. For this purpose, several modifiers may be appended to +the corresponding vector-producing options for specifying the placement +of vector heads and tails, their shapes, and the justification of the vector. +To place a vector head at the beginning of the vector path +simply append **+b** to the vector-producing option (use **+e** to place +one at the end). Optionally, append **+t** for a terminal line, **+c** for a +circle, **+a** for arrow (default), **+i** for tail, **+A** for plain open +arrow, and **+I** for plain open tail. Further append **+l** or **+r** to +only draw the left or right half-sides of the selected head/tail +(default is both sides). In this context left and right refers to the side of +the vector line when viewed from the beginning point to the end point of a +line segment. The angle $\theta$ of the vector head apex can be set using +**+a**_angle_ (default is 30). The shape of the vector head can be adjusted +using **+h**_shape_ (e.g. `+h0.5`). + +For further modifiers see the **_Vector Attributes_** subsection of the +corresponding module. + +In the following we use the :meth:`pygmt.Figure.plot` method to plot vectors +with individual heads and tails. We must specify the modifiers (together with +the vector type) by passing the corresponding shortcuts to the ``style`` +argument. + """ import pygmt @@ -21,19 +42,32 @@ length = 7 for vecstyle in [ - "v0c", # vector without head and tail (line) - "v0.6c+bA+eA+a50", # plain open arrow at the beginning and end of the vector path, angle of the vector head apex is set to 50 - "v0.4c+bI+eI", # plain open tail at the beginning and end - "v0.3c+bt+et+a80", # terminal line at the beginning and end, angle of the vector head apep is set to 80 - "v0.6c+e", # arrow head at the end - "v0.6c+bc+ea", # circle at the beginning and an arrow head at the end - "v0.6c+bt+ea", # terminal line at the beginning and an arrow head at the end - "v1c+e+h0.5", # arrow head at the end, shape of the vector head is set to 0.5 - "v1c+b+e+h0.5", # modified arrow heads at the beginning and end - "v1c+bi+ea+h0.5", # tail at the beginning and an arrow with modified vector head at the end - "v1c+bar+ea+h0.8", # half-sided arrow head (right side) at the beginning and an arrow at the end - "v1c+bar+eal+h0.5", # half-sided arrow heads at the beginning (right side) and end (left side) - "v1c+bi+ea+r+h0.5+a45", # half-sided tail at the beginning and arrow at the at the end (right side for both) + # vector without head and tail (line) + "v0c", + # plain open arrow at beginning and end, angle of the vector head apex is set to 50 + "v0.6c+bA+eA+a50", + # plain open tail at beginning and end + "v0.4c+bI+eI", + # terminal line at beginning and end, angle of vector head apex is set to 80 + "v0.3c+bt+et+a80", + # arrow head at end + "v0.6c+e", + # circle at beginning and arrow head at end + "v0.6c+bc+ea", + # terminal line at beginning and arrow head at end + "v0.6c+bt+ea", + # arrow head at end, shape of vector head is set to 0.5 + "v1c+e+h0.5", + # modified arrow heads at beginning and end + "v1c+b+e+h0.5", + # tail at beginning and arrow with modified vector head at end + "v1c+bi+ea+h0.5", + # half-sided arrow head (right side) at beginning and arrow at the end + "v1c+bar+ea+h0.8", + # half-sided arrow heads at beginning (right side) and end (left side) + "v1c+bar+eal+h0.5", + # half-sided tail at beginning and arrow at end (right side for both) + "v1c+bi+ea+r+h0.5+a45", ]: fig.plot( x=x, y=y, style=vecstyle, direction=([angle], [length]), pen="2p", color="red3" From c07ffb7f9d47c250dada07384fb570bcd23fe6df Mon Sep 17 00:00:00 2001 From: Michael Grund Date: Wed, 17 Feb 2021 18:07:50 +0100 Subject: [PATCH 11/22] added Meghans suggestion --- examples/gallery/line/vector-heads-tails.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gallery/line/vector-heads-tails.py b/examples/gallery/line/vector-heads-tails.py index a1f8eaa8825..d802de8e6b2 100644 --- a/examples/gallery/line/vector-heads-tails.py +++ b/examples/gallery/line/vector-heads-tails.py @@ -25,7 +25,7 @@ In the following we use the :meth:`pygmt.Figure.plot` method to plot vectors with individual heads and tails. We must specify the modifiers (together with the vector type) by passing the corresponding shortcuts to the ``style`` -argument. +parameter. """ From 7d38f4163c2f8f9491b38e4a93c0891f4eeea417 Mon Sep 17 00:00:00 2001 From: Michael Grund Date: Thu, 18 Feb 2021 17:28:37 +0100 Subject: [PATCH 12/22] some formatting --- examples/gallery/line/vector-heads-tails.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/gallery/line/vector-heads-tails.py b/examples/gallery/line/vector-heads-tails.py index d802de8e6b2..c63bca78296 100644 --- a/examples/gallery/line/vector-heads-tails.py +++ b/examples/gallery/line/vector-heads-tails.py @@ -15,11 +15,11 @@ only draw the left or right half-sides of the selected head/tail (default is both sides). In this context left and right refers to the side of the vector line when viewed from the beginning point to the end point of a -line segment. The angle $\theta$ of the vector head apex can be set using -**+a**_angle_ (default is 30). The shape of the vector head can be adjusted -using **+h**_shape_ (e.g. `+h0.5`). +line segment. The angle :math:`theta` of the vector head apex can be set using +**+a**\ *angle* (default is 30). The shape of the vector head can be adjusted +using **+h**\ *shape* (e.g. ``+h0.5``). -For further modifiers see the **_Vector Attributes_** subsection of the +For further modifiers see the *Vector Attributes* subsection of the corresponding module. In the following we use the :meth:`pygmt.Figure.plot` method to plot vectors From 65520a6b59e3c9f55b9236673a02dfb8c1ebe6dd Mon Sep 17 00:00:00 2001 From: Michael Grund Date: Thu, 18 Feb 2021 17:49:02 +0100 Subject: [PATCH 13/22] formatting theta --- examples/gallery/line/vector-heads-tails.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gallery/line/vector-heads-tails.py b/examples/gallery/line/vector-heads-tails.py index c63bca78296..06c8908cfab 100644 --- a/examples/gallery/line/vector-heads-tails.py +++ b/examples/gallery/line/vector-heads-tails.py @@ -15,7 +15,7 @@ only draw the left or right half-sides of the selected head/tail (default is both sides). In this context left and right refers to the side of the vector line when viewed from the beginning point to the end point of a -line segment. The angle :math:`theta` of the vector head apex can be set using +line segment. The angle :math:`\theta` of the vector head apex can be set using **+a**\ *angle* (default is 30). The shape of the vector head can be adjusted using **+h**\ *shape* (e.g. ``+h0.5``). From a2f0edefb138afc9874e4db8ad32cce006828369 Mon Sep 17 00:00:00 2001 From: Michael Grund Date: Thu, 18 Feb 2021 18:25:05 +0100 Subject: [PATCH 14/22] formatting theta --- examples/gallery/line/vector-heads-tails.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gallery/line/vector-heads-tails.py b/examples/gallery/line/vector-heads-tails.py index 06c8908cfab..4b56a936ad1 100644 --- a/examples/gallery/line/vector-heads-tails.py +++ b/examples/gallery/line/vector-heads-tails.py @@ -15,7 +15,7 @@ only draw the left or right half-sides of the selected head/tail (default is both sides). In this context left and right refers to the side of the vector line when viewed from the beginning point to the end point of a -line segment. The angle :math:`\theta` of the vector head apex can be set using +line segment. The angle :math:`{\theta}` of the vector head apex can be set using **+a**\ *angle* (default is 30). The shape of the vector head can be adjusted using **+h**\ *shape* (e.g. ``+h0.5``). From c7591814801d9a7baed45b9e5f12c7278d7db388 Mon Sep 17 00:00:00 2001 From: Michael Grund Date: Thu, 18 Feb 2021 18:48:43 +0100 Subject: [PATCH 15/22] removed theta --- examples/gallery/line/vector-heads-tails.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/gallery/line/vector-heads-tails.py b/examples/gallery/line/vector-heads-tails.py index 4b56a936ad1..a25eb87438e 100644 --- a/examples/gallery/line/vector-heads-tails.py +++ b/examples/gallery/line/vector-heads-tails.py @@ -15,7 +15,7 @@ only draw the left or right half-sides of the selected head/tail (default is both sides). In this context left and right refers to the side of the vector line when viewed from the beginning point to the end point of a -line segment. The angle :math:`{\theta}` of the vector head apex can be set using +line segment. The angle of the vector head apex can be set using **+a**\ *angle* (default is 30). The shape of the vector head can be adjusted using **+h**\ *shape* (e.g. ``+h0.5``). @@ -24,8 +24,8 @@ In the following we use the :meth:`pygmt.Figure.plot` method to plot vectors with individual heads and tails. We must specify the modifiers (together with -the vector type) by passing the corresponding shortcuts to the ``style`` -parameter. +the vector type, here ``v``) by passing the corresponding shortcuts to the +``style`` parameter. """ From 325200514ca1e98893610b0c87d3d6e117c61d14 Mon Sep 17 00:00:00 2001 From: Michael Grund Date: Thu, 18 Feb 2021 23:01:12 +0100 Subject: [PATCH 16/22] Update examples/gallery/line/vector-heads-tails.py Co-authored-by: Dongdong Tian --- examples/gallery/line/vector-heads-tails.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gallery/line/vector-heads-tails.py b/examples/gallery/line/vector-heads-tails.py index a25eb87438e..80990bf0659 100644 --- a/examples/gallery/line/vector-heads-tails.py +++ b/examples/gallery/line/vector-heads-tails.py @@ -4,7 +4,7 @@ Many modules in PyGMT allow to plot vectors with individual heads and tails. For this purpose, several modifiers may be appended to -the corresponding vector-producing options for specifying the placement +the corresponding vector-producing parameters for specifying the placement of vector heads and tails, their shapes, and the justification of the vector. To place a vector head at the beginning of the vector path From b6d065c31a7541a5fa5dc1295ca5a53cd91009d0 Mon Sep 17 00:00:00 2001 From: Michael Grund Date: Thu, 18 Feb 2021 23:01:20 +0100 Subject: [PATCH 17/22] Update examples/gallery/line/vector-heads-tails.py Co-authored-by: Dongdong Tian --- examples/gallery/line/vector-heads-tails.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/gallery/line/vector-heads-tails.py b/examples/gallery/line/vector-heads-tails.py index 80990bf0659..3ca6a63bbcf 100644 --- a/examples/gallery/line/vector-heads-tails.py +++ b/examples/gallery/line/vector-heads-tails.py @@ -9,9 +9,9 @@ To place a vector head at the beginning of the vector path simply append **+b** to the vector-producing option (use **+e** to place -one at the end). Optionally, append **+t** for a terminal line, **+c** for a -circle, **+a** for arrow (default), **+i** for tail, **+A** for plain open -arrow, and **+I** for plain open tail. Further append **+l** or **+r** to +one at the end). Optionally, append **t** for a terminal line, **c** for a +circle, **a** for arrow (default), **i** for tail, **A** for plain open +arrow, and **I** for plain open tail. Further append **+l** or **+r** to only draw the left or right half-sides of the selected head/tail (default is both sides). In this context left and right refers to the side of the vector line when viewed from the beginning point to the end point of a From 0cb0438ad645c068b6ebfd85d5f8d0825dd354ce Mon Sep 17 00:00:00 2001 From: Michael Grund Date: Fri, 19 Feb 2021 16:07:07 +0100 Subject: [PATCH 18/22] Update examples/gallery/line/vector-heads-tails.py Co-authored-by: Dongdong Tian --- examples/gallery/line/vector-heads-tails.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gallery/line/vector-heads-tails.py b/examples/gallery/line/vector-heads-tails.py index 3ca6a63bbcf..deac367a813 100644 --- a/examples/gallery/line/vector-heads-tails.py +++ b/examples/gallery/line/vector-heads-tails.py @@ -72,7 +72,7 @@ fig.plot( x=x, y=y, style=vecstyle, direction=([angle], [length]), pen="2p", color="red3" ) - fig.text(x=6, y=y, text=vecstyle, justify="ML", offset="0.2c/0c") + fig.text(x=6, y=y, text=vecstyle, font="Courier-Bold", justify="ML", offset="0.2c/0c") y -= 1 # move the next vector down fig.show() From c4d4ad9ccb7e9825c81d9bcb916d7ac062d08af3 Mon Sep 17 00:00:00 2001 From: Michael Grund Date: Fri, 19 Feb 2021 16:18:33 +0100 Subject: [PATCH 19/22] updates based on review --- examples/gallery/line/vector-heads-tails.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/examples/gallery/line/vector-heads-tails.py b/examples/gallery/line/vector-heads-tails.py index deac367a813..c57574495cd 100644 --- a/examples/gallery/line/vector-heads-tails.py +++ b/examples/gallery/line/vector-heads-tails.py @@ -11,13 +11,14 @@ simply append **+b** to the vector-producing option (use **+e** to place one at the end). Optionally, append **t** for a terminal line, **c** for a circle, **a** for arrow (default), **i** for tail, **A** for plain open -arrow, and **I** for plain open tail. Further append **+l** or **+r** to -only draw the left or right half-sides of the selected head/tail -(default is both sides). In this context left and right refers to the side of -the vector line when viewed from the beginning point to the end point of a -line segment. The angle of the vector head apex can be set using -**+a**\ *angle* (default is 30). The shape of the vector head can be adjusted -using **+h**\ *shape* (e.g. ``+h0.5``). +arrow, and **I** for plain open tail. Further append **l** or **r** (e.g. +``+bar``) to only draw the left or right half-sides of the selected head/tail +(default is both sides) or use **+l** or **+r** to apply simultaneously to both +sides. In this context left and right refers to the side of the vector line +when viewed from the beginning point to the end point of a line segment. +The angle of the vector head apex can be set using **+a**\ *angle* +(default is 30). The shape of the vector head can be adjusted using +**+h**\ *shape* (e.g. ``+h0.5``). For further modifiers see the *Vector Attributes* subsection of the corresponding module. @@ -72,7 +73,9 @@ fig.plot( x=x, y=y, style=vecstyle, direction=([angle], [length]), pen="2p", color="red3" ) - fig.text(x=6, y=y, text=vecstyle, font="Courier-Bold", justify="ML", offset="0.2c/0c") + fig.text( + x=6, y=y, text=vecstyle, font="Courier-Bold", justify="ML", offset="0.2c/0c" + ) y -= 1 # move the next vector down fig.show() From 3877278fbec2213569e2d6617458519dc8ced46e Mon Sep 17 00:00:00 2001 From: Michael Grund Date: Fri, 19 Feb 2021 18:24:36 +0100 Subject: [PATCH 20/22] Update examples/gallery/line/vector-heads-tails.py Co-authored-by: Meghan Jones --- examples/gallery/line/vector-heads-tails.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gallery/line/vector-heads-tails.py b/examples/gallery/line/vector-heads-tails.py index c57574495cd..9990d23bc50 100644 --- a/examples/gallery/line/vector-heads-tails.py +++ b/examples/gallery/line/vector-heads-tails.py @@ -2,7 +2,7 @@ Vector heads and tails ---------------------- -Many modules in PyGMT allow to plot vectors with individual +Many modules in PyGMT allow plotting vectors with individual heads and tails. For this purpose, several modifiers may be appended to the corresponding vector-producing parameters for specifying the placement of vector heads and tails, their shapes, and the justification of the vector. From e8bdc838a382f4500519ca7ce244e7176a7f7542 Mon Sep 17 00:00:00 2001 From: Michael Grund Date: Fri, 19 Feb 2021 18:24:45 +0100 Subject: [PATCH 21/22] Update examples/gallery/line/vector-heads-tails.py Co-authored-by: Meghan Jones --- examples/gallery/line/vector-heads-tails.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gallery/line/vector-heads-tails.py b/examples/gallery/line/vector-heads-tails.py index 9990d23bc50..11f378ea248 100644 --- a/examples/gallery/line/vector-heads-tails.py +++ b/examples/gallery/line/vector-heads-tails.py @@ -14,7 +14,7 @@ arrow, and **I** for plain open tail. Further append **l** or **r** (e.g. ``+bar``) to only draw the left or right half-sides of the selected head/tail (default is both sides) or use **+l** or **+r** to apply simultaneously to both -sides. In this context left and right refers to the side of the vector line +sides. In this context left and right refer to the side of the vector line when viewed from the beginning point to the end point of a line segment. The angle of the vector head apex can be set using **+a**\ *angle* (default is 30). The shape of the vector head can be adjusted using From 847b40888a929a5c886e91dcddaa0587bda89be8 Mon Sep 17 00:00:00 2001 From: Michael Grund Date: Fri, 19 Feb 2021 19:29:20 +0100 Subject: [PATCH 22/22] removed trailing white spaces --- examples/gallery/line/vector-heads-tails.py | 44 ++++++++++----------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/examples/gallery/line/vector-heads-tails.py b/examples/gallery/line/vector-heads-tails.py index 11f378ea248..d7c2c0aee6b 100644 --- a/examples/gallery/line/vector-heads-tails.py +++ b/examples/gallery/line/vector-heads-tails.py @@ -2,32 +2,32 @@ Vector heads and tails ---------------------- -Many modules in PyGMT allow plotting vectors with individual -heads and tails. For this purpose, several modifiers may be appended to -the corresponding vector-producing parameters for specifying the placement -of vector heads and tails, their shapes, and the justification of the vector. +Many modules in PyGMT allow plotting vectors with individual +heads and tails. For this purpose, several modifiers may be appended to +the corresponding vector-producing parameters for specifying the placement +of vector heads and tails, their shapes, and the justification of the vector. -To place a vector head at the beginning of the vector path -simply append **+b** to the vector-producing option (use **+e** to place -one at the end). Optionally, append **t** for a terminal line, **c** for a -circle, **a** for arrow (default), **i** for tail, **A** for plain open +To place a vector head at the beginning of the vector path +simply append **+b** to the vector-producing option (use **+e** to place +one at the end). Optionally, append **t** for a terminal line, **c** for a +circle, **a** for arrow (default), **i** for tail, **A** for plain open arrow, and **I** for plain open tail. Further append **l** or **r** (e.g. -``+bar``) to only draw the left or right half-sides of the selected head/tail -(default is both sides) or use **+l** or **+r** to apply simultaneously to both -sides. In this context left and right refer to the side of the vector line -when viewed from the beginning point to the end point of a line segment. -The angle of the vector head apex can be set using **+a**\ *angle* -(default is 30). The shape of the vector head can be adjusted using -**+h**\ *shape* (e.g. ``+h0.5``). +``+bar``) to only draw the left or right half-sides of the selected head/tail +(default is both sides) or use **+l** or **+r** to apply simultaneously to both +sides. In this context left and right refer to the side of the vector line +when viewed from the beginning point to the end point of a line segment. +The angle of the vector head apex can be set using **+a**\ *angle* +(default is 30). The shape of the vector head can be adjusted using +**+h**\ *shape* (e.g. ``+h0.5``). -For further modifiers see the *Vector Attributes* subsection of the -corresponding module. +For further modifiers see the *Vector Attributes* subsection of the +corresponding module. + +In the following we use the :meth:`pygmt.Figure.plot` method to plot vectors +with individual heads and tails. We must specify the modifiers (together with +the vector type, here ``v``) by passing the corresponding shortcuts to the +``style`` parameter. -In the following we use the :meth:`pygmt.Figure.plot` method to plot vectors -with individual heads and tails. We must specify the modifiers (together with -the vector type, here ``v``) by passing the corresponding shortcuts to the -``style`` parameter. - """ import pygmt