From 6b9d64bb8ef59a00ab11293aeb15f91bd5051f7f Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 8 Jan 2025 11:26:00 +0100 Subject: [PATCH 01/37] Create hlines_vlines.py --- examples/gallery/lines/hlines_vlines.py | 76 +++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 examples/gallery/lines/hlines_vlines.py diff --git a/examples/gallery/lines/hlines_vlines.py b/examples/gallery/lines/hlines_vlines.py new file mode 100644 index 00000000000..9b987ef4fff --- /dev/null +++ b/examples/gallery/lines/hlines_vlines.py @@ -0,0 +1,76 @@ +""" +Horizontal and vertical lines +============================= + +The :meth:`pygmt.Figure.hlines` and :meth:`pygmt.Figure.vlines` +methods allow to plot horizontal and vertical lines in +Cartesian, Geographic and Polar projections. +""" + +# %% +import pygmt + +fig = pygmt.Figure() + +fig.basemap(region=[0, 10, 0, 10], projection="X10c/10c", frame=["+thlines Cartesian", "af"]) + +fig.hlines(y=9, pen="1.5p,red3", label="Line 1") +fig.hlines(y=8, xmin=2, xmax=8, pen="1.5p,gray30,-", label="Line 2") +fig.hlines(y=[6, 7], xmin=3, xmax=7, pen="1.5p,black,.", label="Line 3") +fig.hlines(y=[4, 5], xmin=4, xmax=9, pen="1.5p,salmon", label="Line 4") +fig.hlines(y=[2, 3], xmin=[0, 1], xmax=[7, 7.5], pen="1.5p,dodgerblue3", label="Line 5") +fig.legend(position="JBR+jBR+o0.2c", box= "+gwhite+p1p") + +fig.shift_origin(xshift="w+2c") + +fig.basemap(region=[0, 10, 0, 10], projection="X10c/10c", frame=["+tvlines Cartesian", "af"]) +fig.vlines(x=1, pen="1.5p,red3", label="Line 1") +fig.vlines(x=2, ymin=2, ymax=8, pen="1.5p,gray30,-", label="Line 2") +fig.vlines(x=[3, 4], ymin=3, ymax=7, pen="1.5p,black,.", label="Line 3") +fig.vlines(x=[5, 6], ymin=4, ymax=9, pen="1.5p,salmon", label="Line 4") +fig.vlines(x=[7, 8], ymin=[0, 1], ymax=[7, 7.5], pen="1.5p,dodgerblue3", label="Line 5") +fig.legend() + +# %% +# The same can be done for geographic projections where horizontal means +# the lines are plotted as parallels along constant latitude and vertical +# lines are plotted as parallels along constant longitude. + +fig = pygmt.Figure() + +fig.basemap(region="g", projection="R15c", frame=["+thlines Geographic", "af"]) +fig.hlines(70, xmin=0, xmax=360, pen="1.5p,red3", label = "line1") +fig.hlines(50, xmin=20, xmax=160, pen="1.5p,gray30,-", label = "line2") +fig.hlines(-30, xmin=60, xmax=270, pen="1.5p,dodgerblue3", label = "line2") +fig.legend() + +fig.shift_origin(xshift="w+2c") + +fig.basemap(region="g", projection="R15c", frame=["+tvlines Geographic", "af"]) +fig.vlines(70, ymin=-90, ymax=90, pen="1.5p,red3", label = "line1") +fig.vlines(120, ymin=-50, ymax=70, pen="1.5p,gray30,-", label = "line2") +fig.vlines(230, ymin=-70, ymax=80, pen="1.5p,dodgerblue3", label = "line2") +fig.legend() + +# %% +# When using polar projections horizonal means lines are plotted as +# arcs along a constant radius while vertical lines are plotted as +# straight lines along radius at a specified azimuth. + +fig = pygmt.Figure() + +fig.basemap(region=[0, 360, 0, 1], projection="P10c", frame=["+thlines Polar", "af"]) +fig.hlines(0.8, xmin=0, xmax=360, pen="1.5p,red3", label = "line1") +fig.hlines(0.5, xmin=30, xmax=160, pen="1.5p,gray30,-", label = "line2") +fig.hlines(0.25, xmin=60, xmax=270, pen="1.5p,dodgerblue3", label = "line2") +fig.legend() + +fig.shift_origin(xshift="w+2c") + +fig.basemap(region=[0, 360, 0, 1], projection="P10c", frame=["+tvlines Polar", "af"]) +fig.vlines(120, ymin=0, ymax=1, pen="1.5p,red3", label = "line1") +fig.vlines(190, ymin=0.2, ymax=0.8, pen="1.5p,gray30,-", label = "line2") +fig.vlines(320, ymin=0.5, ymax=0.9, pen="1.5p,dodgerblue3", label = "line2") +fig.legend() + +fig.show() From c3c3dcf2cd8445e690b5bbb7250d5e38310ee13f Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 8 Jan 2025 11:30:26 +0100 Subject: [PATCH 02/37] Update hlines_vlines.py --- examples/gallery/lines/hlines_vlines.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/gallery/lines/hlines_vlines.py b/examples/gallery/lines/hlines_vlines.py index 9b987ef4fff..40f3a467eb6 100644 --- a/examples/gallery/lines/hlines_vlines.py +++ b/examples/gallery/lines/hlines_vlines.py @@ -2,8 +2,8 @@ Horizontal and vertical lines ============================= -The :meth:`pygmt.Figure.hlines` and :meth:`pygmt.Figure.vlines` -methods allow to plot horizontal and vertical lines in +The :meth:`pygmt.Figure.hlines` and :meth:`pygmt.Figure.vlines` +methods allow to plot horizontal and vertical lines in Cartesian, Geographic and Polar projections. """ @@ -32,7 +32,7 @@ fig.legend() # %% -# The same can be done for geographic projections where horizontal means +# The same can be done for geographic projections where horizontal means # the lines are plotted as parallels along constant latitude and vertical # lines are plotted as parallels along constant longitude. @@ -53,8 +53,8 @@ fig.legend() # %% -# When using polar projections horizonal means lines are plotted as -# arcs along a constant radius while vertical lines are plotted as +# When using polar projections horizonal means lines are plotted as +# arcs along a constant radius while vertical lines are plotted as # straight lines along radius at a specified azimuth. fig = pygmt.Figure() From 5c2ea76041bf72dbc9dd252dc9c1d348ac95b658 Mon Sep 17 00:00:00 2001 From: actions-bot <58130806+actions-bot@users.noreply.github.com> Date: Wed, 8 Jan 2025 10:31:42 +0000 Subject: [PATCH 03/37] [format-command] fixes --- examples/gallery/lines/hlines_vlines.py | 34 ++++++++++++++----------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/examples/gallery/lines/hlines_vlines.py b/examples/gallery/lines/hlines_vlines.py index 40f3a467eb6..642a7a66406 100644 --- a/examples/gallery/lines/hlines_vlines.py +++ b/examples/gallery/lines/hlines_vlines.py @@ -12,18 +12,22 @@ fig = pygmt.Figure() -fig.basemap(region=[0, 10, 0, 10], projection="X10c/10c", frame=["+thlines Cartesian", "af"]) +fig.basemap( + region=[0, 10, 0, 10], projection="X10c/10c", frame=["+thlines Cartesian", "af"] +) fig.hlines(y=9, pen="1.5p,red3", label="Line 1") fig.hlines(y=8, xmin=2, xmax=8, pen="1.5p,gray30,-", label="Line 2") fig.hlines(y=[6, 7], xmin=3, xmax=7, pen="1.5p,black,.", label="Line 3") fig.hlines(y=[4, 5], xmin=4, xmax=9, pen="1.5p,salmon", label="Line 4") fig.hlines(y=[2, 3], xmin=[0, 1], xmax=[7, 7.5], pen="1.5p,dodgerblue3", label="Line 5") -fig.legend(position="JBR+jBR+o0.2c", box= "+gwhite+p1p") +fig.legend(position="JBR+jBR+o0.2c", box="+gwhite+p1p") fig.shift_origin(xshift="w+2c") -fig.basemap(region=[0, 10, 0, 10], projection="X10c/10c", frame=["+tvlines Cartesian", "af"]) +fig.basemap( + region=[0, 10, 0, 10], projection="X10c/10c", frame=["+tvlines Cartesian", "af"] +) fig.vlines(x=1, pen="1.5p,red3", label="Line 1") fig.vlines(x=2, ymin=2, ymax=8, pen="1.5p,gray30,-", label="Line 2") fig.vlines(x=[3, 4], ymin=3, ymax=7, pen="1.5p,black,.", label="Line 3") @@ -39,17 +43,17 @@ fig = pygmt.Figure() fig.basemap(region="g", projection="R15c", frame=["+thlines Geographic", "af"]) -fig.hlines(70, xmin=0, xmax=360, pen="1.5p,red3", label = "line1") -fig.hlines(50, xmin=20, xmax=160, pen="1.5p,gray30,-", label = "line2") -fig.hlines(-30, xmin=60, xmax=270, pen="1.5p,dodgerblue3", label = "line2") +fig.hlines(70, xmin=0, xmax=360, pen="1.5p,red3", label="line1") +fig.hlines(50, xmin=20, xmax=160, pen="1.5p,gray30,-", label="line2") +fig.hlines(-30, xmin=60, xmax=270, pen="1.5p,dodgerblue3", label="line2") fig.legend() fig.shift_origin(xshift="w+2c") fig.basemap(region="g", projection="R15c", frame=["+tvlines Geographic", "af"]) -fig.vlines(70, ymin=-90, ymax=90, pen="1.5p,red3", label = "line1") -fig.vlines(120, ymin=-50, ymax=70, pen="1.5p,gray30,-", label = "line2") -fig.vlines(230, ymin=-70, ymax=80, pen="1.5p,dodgerblue3", label = "line2") +fig.vlines(70, ymin=-90, ymax=90, pen="1.5p,red3", label="line1") +fig.vlines(120, ymin=-50, ymax=70, pen="1.5p,gray30,-", label="line2") +fig.vlines(230, ymin=-70, ymax=80, pen="1.5p,dodgerblue3", label="line2") fig.legend() # %% @@ -60,17 +64,17 @@ fig = pygmt.Figure() fig.basemap(region=[0, 360, 0, 1], projection="P10c", frame=["+thlines Polar", "af"]) -fig.hlines(0.8, xmin=0, xmax=360, pen="1.5p,red3", label = "line1") -fig.hlines(0.5, xmin=30, xmax=160, pen="1.5p,gray30,-", label = "line2") -fig.hlines(0.25, xmin=60, xmax=270, pen="1.5p,dodgerblue3", label = "line2") +fig.hlines(0.8, xmin=0, xmax=360, pen="1.5p,red3", label="line1") +fig.hlines(0.5, xmin=30, xmax=160, pen="1.5p,gray30,-", label="line2") +fig.hlines(0.25, xmin=60, xmax=270, pen="1.5p,dodgerblue3", label="line2") fig.legend() fig.shift_origin(xshift="w+2c") fig.basemap(region=[0, 360, 0, 1], projection="P10c", frame=["+tvlines Polar", "af"]) -fig.vlines(120, ymin=0, ymax=1, pen="1.5p,red3", label = "line1") -fig.vlines(190, ymin=0.2, ymax=0.8, pen="1.5p,gray30,-", label = "line2") -fig.vlines(320, ymin=0.5, ymax=0.9, pen="1.5p,dodgerblue3", label = "line2") +fig.vlines(120, ymin=0, ymax=1, pen="1.5p,red3", label="line1") +fig.vlines(190, ymin=0.2, ymax=0.8, pen="1.5p,gray30,-", label="line2") +fig.vlines(320, ymin=0.5, ymax=0.9, pen="1.5p,dodgerblue3", label="line2") fig.legend() fig.show() From ddc8c066e66f997c1e060abad7328ab6c6c220a9 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 8 Jan 2025 11:36:29 +0100 Subject: [PATCH 04/37] add fig.show --- examples/gallery/lines/hlines_vlines.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/gallery/lines/hlines_vlines.py b/examples/gallery/lines/hlines_vlines.py index 642a7a66406..b5e08e97152 100644 --- a/examples/gallery/lines/hlines_vlines.py +++ b/examples/gallery/lines/hlines_vlines.py @@ -35,6 +35,8 @@ fig.vlines(x=[7, 8], ymin=[0, 1], ymax=[7, 7.5], pen="1.5p,dodgerblue3", label="Line 5") fig.legend() +fig.show() + # %% # The same can be done for geographic projections where horizontal means # the lines are plotted as parallels along constant latitude and vertical @@ -56,6 +58,8 @@ fig.vlines(230, ymin=-70, ymax=80, pen="1.5p,dodgerblue3", label="line2") fig.legend() +fig.show() + # %% # When using polar projections horizonal means lines are plotted as # arcs along a constant radius while vertical lines are plotted as From 49f777fc5d61b30313f17be1d663b68c6b47c980 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 8 Jan 2025 11:38:01 +0100 Subject: [PATCH 05/37] update text --- examples/gallery/lines/hlines_vlines.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/gallery/lines/hlines_vlines.py b/examples/gallery/lines/hlines_vlines.py index b5e08e97152..c57add9fc06 100644 --- a/examples/gallery/lines/hlines_vlines.py +++ b/examples/gallery/lines/hlines_vlines.py @@ -47,7 +47,7 @@ fig.basemap(region="g", projection="R15c", frame=["+thlines Geographic", "af"]) fig.hlines(70, xmin=0, xmax=360, pen="1.5p,red3", label="line1") fig.hlines(50, xmin=20, xmax=160, pen="1.5p,gray30,-", label="line2") -fig.hlines(-30, xmin=60, xmax=270, pen="1.5p,dodgerblue3", label="line2") +fig.hlines(-30, xmin=60, xmax=270, pen="1.5p,dodgerblue3", label="line3") fig.legend() fig.shift_origin(xshift="w+2c") @@ -55,7 +55,7 @@ fig.basemap(region="g", projection="R15c", frame=["+tvlines Geographic", "af"]) fig.vlines(70, ymin=-90, ymax=90, pen="1.5p,red3", label="line1") fig.vlines(120, ymin=-50, ymax=70, pen="1.5p,gray30,-", label="line2") -fig.vlines(230, ymin=-70, ymax=80, pen="1.5p,dodgerblue3", label="line2") +fig.vlines(230, ymin=-70, ymax=80, pen="1.5p,dodgerblue3", label="line3") fig.legend() fig.show() @@ -70,7 +70,7 @@ fig.basemap(region=[0, 360, 0, 1], projection="P10c", frame=["+thlines Polar", "af"]) fig.hlines(0.8, xmin=0, xmax=360, pen="1.5p,red3", label="line1") fig.hlines(0.5, xmin=30, xmax=160, pen="1.5p,gray30,-", label="line2") -fig.hlines(0.25, xmin=60, xmax=270, pen="1.5p,dodgerblue3", label="line2") +fig.hlines(0.25, xmin=60, xmax=270, pen="1.5p,dodgerblue3", label="line3") fig.legend() fig.shift_origin(xshift="w+2c") @@ -78,7 +78,7 @@ fig.basemap(region=[0, 360, 0, 1], projection="P10c", frame=["+tvlines Polar", "af"]) fig.vlines(120, ymin=0, ymax=1, pen="1.5p,red3", label="line1") fig.vlines(190, ymin=0.2, ymax=0.8, pen="1.5p,gray30,-", label="line2") -fig.vlines(320, ymin=0.5, ymax=0.9, pen="1.5p,dodgerblue3", label="line2") +fig.vlines(320, ymin=0.5, ymax=0.9, pen="1.5p,dodgerblue3", label="line3") fig.legend() fig.show() From e41387f49cf0d9124f86e31120e8da2917d7d31b Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 8 Jan 2025 11:46:17 +0100 Subject: [PATCH 06/37] add descriptions --- examples/gallery/lines/hlines_vlines.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/examples/gallery/lines/hlines_vlines.py b/examples/gallery/lines/hlines_vlines.py index c57add9fc06..c6fa5351707 100644 --- a/examples/gallery/lines/hlines_vlines.py +++ b/examples/gallery/lines/hlines_vlines.py @@ -16,22 +16,25 @@ region=[0, 10, 0, 10], projection="X10c/10c", frame=["+thlines Cartesian", "af"] ) +# add a red horizontal line at y=9 without specifying limits fig.hlines(y=9, pen="1.5p,red3", label="Line 1") +# add a gray dashed horizontal line at y=8 with x limits at 2 and 8 fig.hlines(y=8, xmin=2, xmax=8, pen="1.5p,gray30,-", label="Line 2") -fig.hlines(y=[6, 7], xmin=3, xmax=7, pen="1.5p,black,.", label="Line 3") -fig.hlines(y=[4, 5], xmin=4, xmax=9, pen="1.5p,salmon", label="Line 4") +# add two salmon-colored horizontal lines at y=6 and y=7 both with x limits at 3 and 7 +fig.hlines(y=[6, 7], xmin=3, xmax=7, pen="1.5p,salmon", label="Line 3") +# add two black dotted horizontal lines at y=4 and y=5 both with x limits at 4 and 9 +fig.hlines(y=[4, 5], xmin=4, xmax=9, pen="1.5p,black,.", label="Line 4") +# add two blue horizontal lines at y=2 and y=3 with different x limits fig.hlines(y=[2, 3], xmin=[0, 1], xmax=[7, 7.5], pen="1.5p,dodgerblue3", label="Line 5") -fig.legend(position="JBR+jBR+o0.2c", box="+gwhite+p1p") +fig.legend(position="JBR+jBR+o0.2c", box= "+gwhite+p1p") fig.shift_origin(xshift="w+2c") -fig.basemap( - region=[0, 10, 0, 10], projection="X10c/10c", frame=["+tvlines Cartesian", "af"] -) +fig.basemap(region=[0, 10, 0, 10], projection="X10c/10c", frame=["+tvlines Cartesian", "af"]) fig.vlines(x=1, pen="1.5p,red3", label="Line 1") fig.vlines(x=2, ymin=2, ymax=8, pen="1.5p,gray30,-", label="Line 2") -fig.vlines(x=[3, 4], ymin=3, ymax=7, pen="1.5p,black,.", label="Line 3") -fig.vlines(x=[5, 6], ymin=4, ymax=9, pen="1.5p,salmon", label="Line 4") +fig.vlines(x=[3, 4], ymin=3, ymax=7, pen="1.5p,salmon", label="Line 3") +fig.vlines(x=[5, 6], ymin=4, ymax=9, pen="1.5p,black,.", label="Line 4") fig.vlines(x=[7, 8], ymin=[0, 1], ymax=[7, 7.5], pen="1.5p,dodgerblue3", label="Line 5") fig.legend() From 0354586a37eb2910db3fb7cc82958bd7754c42af Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 8 Jan 2025 11:52:01 +0100 Subject: [PATCH 07/37] add texts --- examples/gallery/lines/hlines_vlines.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/examples/gallery/lines/hlines_vlines.py b/examples/gallery/lines/hlines_vlines.py index c6fa5351707..0cd84716ad4 100644 --- a/examples/gallery/lines/hlines_vlines.py +++ b/examples/gallery/lines/hlines_vlines.py @@ -12,11 +12,9 @@ fig = pygmt.Figure() -fig.basemap( - region=[0, 10, 0, 10], projection="X10c/10c", frame=["+thlines Cartesian", "af"] -) +fig.basemap(region=[0, 10, 0, 10], projection="X10c/10c", frame=["+thlines Cartesian", "af"]) -# add a red horizontal line at y=9 without specifying limits +# add a red horizontal line at y=9 without specifying x limits fig.hlines(y=9, pen="1.5p,red3", label="Line 1") # add a gray dashed horizontal line at y=8 with x limits at 2 and 8 fig.hlines(y=8, xmin=2, xmax=8, pen="1.5p,gray30,-", label="Line 2") @@ -31,10 +29,15 @@ fig.shift_origin(xshift="w+2c") fig.basemap(region=[0, 10, 0, 10], projection="X10c/10c", frame=["+tvlines Cartesian", "af"]) +# add a red vertical line at x=1 without specifying y limits fig.vlines(x=1, pen="1.5p,red3", label="Line 1") +# add a gray dashed vertical line at x=2 with y limits at 2 and 8 fig.vlines(x=2, ymin=2, ymax=8, pen="1.5p,gray30,-", label="Line 2") +# add two salmon-colored vertical lines at x=3 and x=4 both with y limits at 3 and 7 fig.vlines(x=[3, 4], ymin=3, ymax=7, pen="1.5p,salmon", label="Line 3") +# add two black dotted vertical lines at x=5 and x=6 both with y limits at 4 and 9 fig.vlines(x=[5, 6], ymin=4, ymax=9, pen="1.5p,black,.", label="Line 4") +# add two blue vertical lines at x=7 and x=8 with different y limits fig.vlines(x=[7, 8], ymin=[0, 1], ymax=[7, 7.5], pen="1.5p,dodgerblue3", label="Line 5") fig.legend() From b3d5970b7182b4293e043c21f79508ff1d904101 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 8 Jan 2025 11:59:12 +0100 Subject: [PATCH 08/37] update texts --- examples/gallery/lines/hlines_vlines.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/examples/gallery/lines/hlines_vlines.py b/examples/gallery/lines/hlines_vlines.py index 0cd84716ad4..87f05dcd817 100644 --- a/examples/gallery/lines/hlines_vlines.py +++ b/examples/gallery/lines/hlines_vlines.py @@ -51,17 +51,23 @@ fig = pygmt.Figure() fig.basemap(region="g", projection="R15c", frame=["+thlines Geographic", "af"]) -fig.hlines(70, xmin=0, xmax=360, pen="1.5p,red3", label="line1") -fig.hlines(50, xmin=20, xmax=160, pen="1.5p,gray30,-", label="line2") -fig.hlines(-30, xmin=60, xmax=270, pen="1.5p,dodgerblue3", label="line3") +# add a red horizontal line at a latitude of 70°N without specifying longitude limits +fig.hlines(70, xmin=0, xmax=360, pen="1.5p,red3", label = "line1") +# add a blue line at a latitude of 50°N with longitude limits at 20°E and 160°E +fig.hlines(50, xmin=20, xmax=160, pen="1.5p,dodgerblue3", label = "line2") +# add a gray dashed horizontal line at a latitude of 30°S with longitude limits at 60°E and 270°E +fig.hlines(-30, xmin=60, xmax=270, pen="1.5p,gray30,-", label = "line3") fig.legend() fig.shift_origin(xshift="w+2c") fig.basemap(region="g", projection="R15c", frame=["+tvlines Geographic", "af"]) -fig.vlines(70, ymin=-90, ymax=90, pen="1.5p,red3", label="line1") -fig.vlines(120, ymin=-50, ymax=70, pen="1.5p,gray30,-", label="line2") -fig.vlines(230, ymin=-70, ymax=80, pen="1.5p,dodgerblue3", label="line3") +# add a red vertical line at a longitude of 70°E without specifying latitude limits +fig.vlines(70, ymin=-90, ymax=90, pen="1.5p,red3", label = "line1") +# add a blue vertical line at a longitude of 120°E with latitude limits at 50°S and 70°N +fig.vlines(120, ymin=-50, ymax=70, pen="1.5p,dodgerblue3", label = "line2") +# add a gray dashed vertical line at a longitude of 230°E with latitude limits at 70°S and 80°N +fig.vlines(230, ymin=-70, ymax=80, pen="1.5p,gray30,-", label = "line3") fig.legend() fig.show() From 6fd69f37c42b1f538908cc7d46c9969ed78118b9 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 8 Jan 2025 12:04:56 +0100 Subject: [PATCH 09/37] add texts --- examples/gallery/lines/hlines_vlines.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/examples/gallery/lines/hlines_vlines.py b/examples/gallery/lines/hlines_vlines.py index 87f05dcd817..967b56493a9 100644 --- a/examples/gallery/lines/hlines_vlines.py +++ b/examples/gallery/lines/hlines_vlines.py @@ -80,17 +80,23 @@ fig = pygmt.Figure() fig.basemap(region=[0, 360, 0, 1], projection="P10c", frame=["+thlines Polar", "af"]) -fig.hlines(0.8, xmin=0, xmax=360, pen="1.5p,red3", label="line1") -fig.hlines(0.5, xmin=30, xmax=160, pen="1.5p,gray30,-", label="line2") -fig.hlines(0.25, xmin=60, xmax=270, pen="1.5p,dodgerblue3", label="line3") +# add a red horizontal line along a radius of 0.8 without specifying azimuth limits +fig.hlines(0.8, xmin=0, xmax=360, pen="1.5p,red3", label = "line1") +# add a blue horizontal line along a radius of 0.5 with azimuth limits at 30° and 160° +fig.hlines(0.5, xmin=30, xmax=160, pen="1.5p,dodgerblue3", label = "line2") +# add a gray dashed horizontal line along a radius of 0.25 with azimuth limits at 60° and 270° +fig.hlines(0.25, xmin=60, xmax=270, pen="1.5p,gray30,-", label = "line3") fig.legend() fig.shift_origin(xshift="w+2c") fig.basemap(region=[0, 360, 0, 1], projection="P10c", frame=["+tvlines Polar", "af"]) -fig.vlines(120, ymin=0, ymax=1, pen="1.5p,red3", label="line1") -fig.vlines(190, ymin=0.2, ymax=0.8, pen="1.5p,gray30,-", label="line2") -fig.vlines(320, ymin=0.5, ymax=0.9, pen="1.5p,dodgerblue3", label="line3") +# add a red vertical line along at an azimuth of 120° with radius limits at 0 and 1. +fig.vlines(120, ymin=0, ymax=1, pen="1.5p,red3", label = "line1") +# add a blue vertical line along at an azimuth of 190° with radius limits at 0.2 and 0.8. +fig.vlines(190, ymin=0.2, ymax=0.8, pen="1.5p,dodgerblue3", label = "line2") +# add a gray dashed vertical line along at an azimuth of 320° with radius limits at 0.5 and 0.9. +fig.vlines(320, ymin=0.5, ymax=0.9, pen="1.5p,gray30,-", label = "line3") fig.legend() fig.show() From edbf3f6204b114fbcc5b3972c40e10270fe564d5 Mon Sep 17 00:00:00 2001 From: actions-bot <58130806+actions-bot@users.noreply.github.com> Date: Wed, 8 Jan 2025 11:05:51 +0000 Subject: [PATCH 10/37] [format-command] fixes --- examples/gallery/lines/hlines_vlines.py | 34 ++++++++++++++----------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/examples/gallery/lines/hlines_vlines.py b/examples/gallery/lines/hlines_vlines.py index 967b56493a9..77496bcd800 100644 --- a/examples/gallery/lines/hlines_vlines.py +++ b/examples/gallery/lines/hlines_vlines.py @@ -12,7 +12,9 @@ fig = pygmt.Figure() -fig.basemap(region=[0, 10, 0, 10], projection="X10c/10c", frame=["+thlines Cartesian", "af"]) +fig.basemap( + region=[0, 10, 0, 10], projection="X10c/10c", frame=["+thlines Cartesian", "af"] +) # add a red horizontal line at y=9 without specifying x limits fig.hlines(y=9, pen="1.5p,red3", label="Line 1") @@ -24,11 +26,13 @@ fig.hlines(y=[4, 5], xmin=4, xmax=9, pen="1.5p,black,.", label="Line 4") # add two blue horizontal lines at y=2 and y=3 with different x limits fig.hlines(y=[2, 3], xmin=[0, 1], xmax=[7, 7.5], pen="1.5p,dodgerblue3", label="Line 5") -fig.legend(position="JBR+jBR+o0.2c", box= "+gwhite+p1p") +fig.legend(position="JBR+jBR+o0.2c", box="+gwhite+p1p") fig.shift_origin(xshift="w+2c") -fig.basemap(region=[0, 10, 0, 10], projection="X10c/10c", frame=["+tvlines Cartesian", "af"]) +fig.basemap( + region=[0, 10, 0, 10], projection="X10c/10c", frame=["+tvlines Cartesian", "af"] +) # add a red vertical line at x=1 without specifying y limits fig.vlines(x=1, pen="1.5p,red3", label="Line 1") # add a gray dashed vertical line at x=2 with y limits at 2 and 8 @@ -52,22 +56,22 @@ fig.basemap(region="g", projection="R15c", frame=["+thlines Geographic", "af"]) # add a red horizontal line at a latitude of 70°N without specifying longitude limits -fig.hlines(70, xmin=0, xmax=360, pen="1.5p,red3", label = "line1") +fig.hlines(70, xmin=0, xmax=360, pen="1.5p,red3", label="line1") # add a blue line at a latitude of 50°N with longitude limits at 20°E and 160°E -fig.hlines(50, xmin=20, xmax=160, pen="1.5p,dodgerblue3", label = "line2") +fig.hlines(50, xmin=20, xmax=160, pen="1.5p,dodgerblue3", label="line2") # add a gray dashed horizontal line at a latitude of 30°S with longitude limits at 60°E and 270°E -fig.hlines(-30, xmin=60, xmax=270, pen="1.5p,gray30,-", label = "line3") +fig.hlines(-30, xmin=60, xmax=270, pen="1.5p,gray30,-", label="line3") fig.legend() fig.shift_origin(xshift="w+2c") fig.basemap(region="g", projection="R15c", frame=["+tvlines Geographic", "af"]) # add a red vertical line at a longitude of 70°E without specifying latitude limits -fig.vlines(70, ymin=-90, ymax=90, pen="1.5p,red3", label = "line1") +fig.vlines(70, ymin=-90, ymax=90, pen="1.5p,red3", label="line1") # add a blue vertical line at a longitude of 120°E with latitude limits at 50°S and 70°N -fig.vlines(120, ymin=-50, ymax=70, pen="1.5p,dodgerblue3", label = "line2") +fig.vlines(120, ymin=-50, ymax=70, pen="1.5p,dodgerblue3", label="line2") # add a gray dashed vertical line at a longitude of 230°E with latitude limits at 70°S and 80°N -fig.vlines(230, ymin=-70, ymax=80, pen="1.5p,gray30,-", label = "line3") +fig.vlines(230, ymin=-70, ymax=80, pen="1.5p,gray30,-", label="line3") fig.legend() fig.show() @@ -81,22 +85,22 @@ fig.basemap(region=[0, 360, 0, 1], projection="P10c", frame=["+thlines Polar", "af"]) # add a red horizontal line along a radius of 0.8 without specifying azimuth limits -fig.hlines(0.8, xmin=0, xmax=360, pen="1.5p,red3", label = "line1") +fig.hlines(0.8, xmin=0, xmax=360, pen="1.5p,red3", label="line1") # add a blue horizontal line along a radius of 0.5 with azimuth limits at 30° and 160° -fig.hlines(0.5, xmin=30, xmax=160, pen="1.5p,dodgerblue3", label = "line2") +fig.hlines(0.5, xmin=30, xmax=160, pen="1.5p,dodgerblue3", label="line2") # add a gray dashed horizontal line along a radius of 0.25 with azimuth limits at 60° and 270° -fig.hlines(0.25, xmin=60, xmax=270, pen="1.5p,gray30,-", label = "line3") +fig.hlines(0.25, xmin=60, xmax=270, pen="1.5p,gray30,-", label="line3") fig.legend() fig.shift_origin(xshift="w+2c") fig.basemap(region=[0, 360, 0, 1], projection="P10c", frame=["+tvlines Polar", "af"]) # add a red vertical line along at an azimuth of 120° with radius limits at 0 and 1. -fig.vlines(120, ymin=0, ymax=1, pen="1.5p,red3", label = "line1") +fig.vlines(120, ymin=0, ymax=1, pen="1.5p,red3", label="line1") # add a blue vertical line along at an azimuth of 190° with radius limits at 0.2 and 0.8. -fig.vlines(190, ymin=0.2, ymax=0.8, pen="1.5p,dodgerblue3", label = "line2") +fig.vlines(190, ymin=0.2, ymax=0.8, pen="1.5p,dodgerblue3", label="line2") # add a gray dashed vertical line along at an azimuth of 320° with radius limits at 0.5 and 0.9. -fig.vlines(320, ymin=0.5, ymax=0.9, pen="1.5p,gray30,-", label = "line3") +fig.vlines(320, ymin=0.5, ymax=0.9, pen="1.5p,gray30,-", label="line3") fig.legend() fig.show() From 66f05ff436836983feeff74e22961791ae5527eb Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 8 Jan 2025 12:09:15 +0100 Subject: [PATCH 11/37] fix lengths --- examples/gallery/lines/hlines_vlines.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/examples/gallery/lines/hlines_vlines.py b/examples/gallery/lines/hlines_vlines.py index 77496bcd800..2370410b168 100644 --- a/examples/gallery/lines/hlines_vlines.py +++ b/examples/gallery/lines/hlines_vlines.py @@ -59,7 +59,8 @@ fig.hlines(70, xmin=0, xmax=360, pen="1.5p,red3", label="line1") # add a blue line at a latitude of 50°N with longitude limits at 20°E and 160°E fig.hlines(50, xmin=20, xmax=160, pen="1.5p,dodgerblue3", label="line2") -# add a gray dashed horizontal line at a latitude of 30°S with longitude limits at 60°E and 270°E +# add a gray dashed horizontal line at a latitude of 30°S with longitude limits at 60°E +# and 270°E fig.hlines(-30, xmin=60, xmax=270, pen="1.5p,gray30,-", label="line3") fig.legend() @@ -70,7 +71,8 @@ fig.vlines(70, ymin=-90, ymax=90, pen="1.5p,red3", label="line1") # add a blue vertical line at a longitude of 120°E with latitude limits at 50°S and 70°N fig.vlines(120, ymin=-50, ymax=70, pen="1.5p,dodgerblue3", label="line2") -# add a gray dashed vertical line at a longitude of 230°E with latitude limits at 70°S and 80°N +# add a gray dashed vertical line at a longitude of 230°E with latitude limits at 70°S +# and 80°N fig.vlines(230, ymin=-70, ymax=80, pen="1.5p,gray30,-", label="line3") fig.legend() @@ -85,21 +87,23 @@ fig.basemap(region=[0, 360, 0, 1], projection="P10c", frame=["+thlines Polar", "af"]) # add a red horizontal line along a radius of 0.8 without specifying azimuth limits -fig.hlines(0.8, xmin=0, xmax=360, pen="1.5p,red3", label="line1") +fig.hlines(0.8, pen="1.5p,red3", label="line1") # add a blue horizontal line along a radius of 0.5 with azimuth limits at 30° and 160° fig.hlines(0.5, xmin=30, xmax=160, pen="1.5p,dodgerblue3", label="line2") -# add a gray dashed horizontal line along a radius of 0.25 with azimuth limits at 60° and 270° +# add a gray dashed horizontal line along a radius of 0.25 with azimuth limits at 60° +# and 270° fig.hlines(0.25, xmin=60, xmax=270, pen="1.5p,gray30,-", label="line3") fig.legend() fig.shift_origin(xshift="w+2c") fig.basemap(region=[0, 360, 0, 1], projection="P10c", frame=["+tvlines Polar", "af"]) -# add a red vertical line along at an azimuth of 120° with radius limits at 0 and 1. -fig.vlines(120, ymin=0, ymax=1, pen="1.5p,red3", label="line1") +# add a red vertical line along at an azimuth of 120° without specifying radius limits +fig.vlines(120, pen="1.5p,red3", label="line1") # add a blue vertical line along at an azimuth of 190° with radius limits at 0.2 and 0.8. fig.vlines(190, ymin=0.2, ymax=0.8, pen="1.5p,dodgerblue3", label="line2") -# add a gray dashed vertical line along at an azimuth of 320° with radius limits at 0.5 and 0.9. +# add a gray dashed vertical line along at an azimuth of 320° with radius limits at 0.5 +# and 0.9. fig.vlines(320, ymin=0.5, ymax=0.9, pen="1.5p,gray30,-", label="line3") fig.legend() From fbeb177cde886c0f2b0a44c81c31d12b9b42ca0d Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 8 Jan 2025 12:10:06 +0100 Subject: [PATCH 12/37] make consistent --- examples/gallery/lines/hlines_vlines.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/gallery/lines/hlines_vlines.py b/examples/gallery/lines/hlines_vlines.py index 2370410b168..41c5000b62b 100644 --- a/examples/gallery/lines/hlines_vlines.py +++ b/examples/gallery/lines/hlines_vlines.py @@ -100,10 +100,10 @@ fig.basemap(region=[0, 360, 0, 1], projection="P10c", frame=["+tvlines Polar", "af"]) # add a red vertical line along at an azimuth of 120° without specifying radius limits fig.vlines(120, pen="1.5p,red3", label="line1") -# add a blue vertical line along at an azimuth of 190° with radius limits at 0.2 and 0.8. +# add a blue vertical line along at an azimuth of 190° with radius limits at 0.2 and 0.8 fig.vlines(190, ymin=0.2, ymax=0.8, pen="1.5p,dodgerblue3", label="line2") # add a gray dashed vertical line along at an azimuth of 320° with radius limits at 0.5 -# and 0.9. +# and 0.9 fig.vlines(320, ymin=0.5, ymax=0.9, pen="1.5p,gray30,-", label="line3") fig.legend() From 9cfe59e7dc526436e254a3c817dd50ddb525582e Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 8 Jan 2025 12:13:46 +0100 Subject: [PATCH 13/37] Update hlines_vlines.py --- examples/gallery/lines/hlines_vlines.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/examples/gallery/lines/hlines_vlines.py b/examples/gallery/lines/hlines_vlines.py index 41c5000b62b..e3640a4302f 100644 --- a/examples/gallery/lines/hlines_vlines.py +++ b/examples/gallery/lines/hlines_vlines.py @@ -8,6 +8,8 @@ """ # %% +# In Cartesian projections lines are plotted as straight lines. + import pygmt fig = pygmt.Figure() @@ -59,7 +61,7 @@ fig.hlines(70, xmin=0, xmax=360, pen="1.5p,red3", label="line1") # add a blue line at a latitude of 50°N with longitude limits at 20°E and 160°E fig.hlines(50, xmin=20, xmax=160, pen="1.5p,dodgerblue3", label="line2") -# add a gray dashed horizontal line at a latitude of 30°S with longitude limits at 60°E +# add a gray dashed horizontal line at a latitude of 30°S with longitude limits at 60°E # and 270°E fig.hlines(-30, xmin=60, xmax=270, pen="1.5p,gray30,-", label="line3") fig.legend() @@ -71,7 +73,7 @@ fig.vlines(70, ymin=-90, ymax=90, pen="1.5p,red3", label="line1") # add a blue vertical line at a longitude of 120°E with latitude limits at 50°S and 70°N fig.vlines(120, ymin=-50, ymax=70, pen="1.5p,dodgerblue3", label="line2") -# add a gray dashed vertical line at a longitude of 230°E with latitude limits at 70°S +# add a gray dashed vertical line at a longitude of 230°E with latitude limits at 70°S # and 80°N fig.vlines(230, ymin=-70, ymax=80, pen="1.5p,gray30,-", label="line3") fig.legend() @@ -90,7 +92,7 @@ fig.hlines(0.8, pen="1.5p,red3", label="line1") # add a blue horizontal line along a radius of 0.5 with azimuth limits at 30° and 160° fig.hlines(0.5, xmin=30, xmax=160, pen="1.5p,dodgerblue3", label="line2") -# add a gray dashed horizontal line along a radius of 0.25 with azimuth limits at 60° +# add a gray dashed horizontal line along a radius of 0.25 with azimuth limits at 60° # and 270° fig.hlines(0.25, xmin=60, xmax=270, pen="1.5p,gray30,-", label="line3") fig.legend() @@ -102,7 +104,7 @@ fig.vlines(120, pen="1.5p,red3", label="line1") # add a blue vertical line along at an azimuth of 190° with radius limits at 0.2 and 0.8 fig.vlines(190, ymin=0.2, ymax=0.8, pen="1.5p,dodgerblue3", label="line2") -# add a gray dashed vertical line along at an azimuth of 320° with radius limits at 0.5 +# add a gray dashed vertical line along at an azimuth of 320° with radius limits at 0.5 # and 0.9 fig.vlines(320, ymin=0.5, ymax=0.9, pen="1.5p,gray30,-", label="line3") fig.legend() From b07b9902d2fc7775e14ac621fbf83afb0c3c5f14 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 8 Jan 2025 12:14:41 +0100 Subject: [PATCH 14/37] fix typo --- examples/gallery/lines/hlines_vlines.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/gallery/lines/hlines_vlines.py b/examples/gallery/lines/hlines_vlines.py index e3640a4302f..e646ab0a4a3 100644 --- a/examples/gallery/lines/hlines_vlines.py +++ b/examples/gallery/lines/hlines_vlines.py @@ -50,7 +50,7 @@ fig.show() # %% -# The same can be done for geographic projections where horizontal means +# The same can be done for Geographic projections where horizontal means # the lines are plotted as parallels along constant latitude and vertical # lines are plotted as parallels along constant longitude. @@ -81,7 +81,7 @@ fig.show() # %% -# When using polar projections horizonal means lines are plotted as +# When using Polar projections horizonal means lines are plotted as # arcs along a constant radius while vertical lines are plotted as # straight lines along radius at a specified azimuth. From 26f94ac33a26484f7c6717ac6118a24a4aa3e892 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 8 Jan 2025 12:39:43 +0100 Subject: [PATCH 15/37] add x and y --- examples/gallery/lines/hlines_vlines.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/examples/gallery/lines/hlines_vlines.py b/examples/gallery/lines/hlines_vlines.py index e646ab0a4a3..37340a984a3 100644 --- a/examples/gallery/lines/hlines_vlines.py +++ b/examples/gallery/lines/hlines_vlines.py @@ -58,24 +58,24 @@ fig.basemap(region="g", projection="R15c", frame=["+thlines Geographic", "af"]) # add a red horizontal line at a latitude of 70°N without specifying longitude limits -fig.hlines(70, xmin=0, xmax=360, pen="1.5p,red3", label="line1") +fig.hlines(y=70, xmin=0, xmax=360, pen="1.5p,red3", label="line1") # add a blue line at a latitude of 50°N with longitude limits at 20°E and 160°E -fig.hlines(50, xmin=20, xmax=160, pen="1.5p,dodgerblue3", label="line2") +fig.hlines(y=50, xmin=20, xmax=160, pen="1.5p,dodgerblue3", label="line2") # add a gray dashed horizontal line at a latitude of 30°S with longitude limits at 60°E # and 270°E -fig.hlines(-30, xmin=60, xmax=270, pen="1.5p,gray30,-", label="line3") +fig.hlines(y=-30, xmin=60, xmax=270, pen="1.5p,gray30,-", label="line3") fig.legend() fig.shift_origin(xshift="w+2c") fig.basemap(region="g", projection="R15c", frame=["+tvlines Geographic", "af"]) # add a red vertical line at a longitude of 70°E without specifying latitude limits -fig.vlines(70, ymin=-90, ymax=90, pen="1.5p,red3", label="line1") +fig.vlines(x=70, ymin=-90, ymax=90, pen="1.5p,red3", label="line1") # add a blue vertical line at a longitude of 120°E with latitude limits at 50°S and 70°N -fig.vlines(120, ymin=-50, ymax=70, pen="1.5p,dodgerblue3", label="line2") +fig.vlines(x=120, ymin=-50, ymax=70, pen="1.5p,dodgerblue3", label="line2") # add a gray dashed vertical line at a longitude of 230°E with latitude limits at 70°S # and 80°N -fig.vlines(230, ymin=-70, ymax=80, pen="1.5p,gray30,-", label="line3") +fig.vlines(x=230, ymin=-70, ymax=80, pen="1.5p,gray30,-", label="line3") fig.legend() fig.show() @@ -89,24 +89,24 @@ fig.basemap(region=[0, 360, 0, 1], projection="P10c", frame=["+thlines Polar", "af"]) # add a red horizontal line along a radius of 0.8 without specifying azimuth limits -fig.hlines(0.8, pen="1.5p,red3", label="line1") +fig.hlines(y=0.8, pen="1.5p,red3", label="line1") # add a blue horizontal line along a radius of 0.5 with azimuth limits at 30° and 160° -fig.hlines(0.5, xmin=30, xmax=160, pen="1.5p,dodgerblue3", label="line2") +fig.hlines(y=0.5, xmin=30, xmax=160, pen="1.5p,dodgerblue3", label="line2") # add a gray dashed horizontal line along a radius of 0.25 with azimuth limits at 60° # and 270° -fig.hlines(0.25, xmin=60, xmax=270, pen="1.5p,gray30,-", label="line3") +fig.hlines(y=0.25, xmin=60, xmax=270, pen="1.5p,gray30,-", label="line3") fig.legend() fig.shift_origin(xshift="w+2c") fig.basemap(region=[0, 360, 0, 1], projection="P10c", frame=["+tvlines Polar", "af"]) # add a red vertical line along at an azimuth of 120° without specifying radius limits -fig.vlines(120, pen="1.5p,red3", label="line1") +fig.vlines(x=120, pen="1.5p,red3", label="line1") # add a blue vertical line along at an azimuth of 190° with radius limits at 0.2 and 0.8 -fig.vlines(190, ymin=0.2, ymax=0.8, pen="1.5p,dodgerblue3", label="line2") +fig.vlines(x=190, ymin=0.2, ymax=0.8, pen="1.5p,dodgerblue3", label="line2") # add a gray dashed vertical line along at an azimuth of 320° with radius limits at 0.5 # and 0.9 -fig.vlines(320, ymin=0.5, ymax=0.9, pen="1.5p,gray30,-", label="line3") +fig.vlines(x=320, ymin=0.5, ymax=0.9, pen="1.5p,gray30,-", label="line3") fig.legend() fig.show() From b5be723b7558e83cbb3a457fb8c9ed765a850c6d Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 8 Jan 2025 12:41:29 +0100 Subject: [PATCH 16/37] fix typos --- examples/gallery/lines/hlines_vlines.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gallery/lines/hlines_vlines.py b/examples/gallery/lines/hlines_vlines.py index 37340a984a3..27b3d3da9e5 100644 --- a/examples/gallery/lines/hlines_vlines.py +++ b/examples/gallery/lines/hlines_vlines.py @@ -81,7 +81,7 @@ fig.show() # %% -# When using Polar projections horizonal means lines are plotted as +# When using Polar projections horizontal means lines are plotted as # arcs along a constant radius while vertical lines are plotted as # straight lines along radius at a specified azimuth. From c29ae862d37b0de39ff6b8d65b9abab9db542412 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 8 Jan 2025 14:21:24 +0100 Subject: [PATCH 17/37] Update hlines_vlines.py --- examples/gallery/lines/hlines_vlines.py | 36 ++++++++++++------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/examples/gallery/lines/hlines_vlines.py b/examples/gallery/lines/hlines_vlines.py index 27b3d3da9e5..ab11bcab17b 100644 --- a/examples/gallery/lines/hlines_vlines.py +++ b/examples/gallery/lines/hlines_vlines.py @@ -23,11 +23,11 @@ # add a gray dashed horizontal line at y=8 with x limits at 2 and 8 fig.hlines(y=8, xmin=2, xmax=8, pen="1.5p,gray30,-", label="Line 2") # add two salmon-colored horizontal lines at y=6 and y=7 both with x limits at 3 and 7 -fig.hlines(y=[6, 7], xmin=3, xmax=7, pen="1.5p,salmon", label="Line 3") +fig.hlines(y=[6, 7], xmin=3, xmax=7, pen="1.5p,salmon", label="Lines 3 & 4") # add two black dotted horizontal lines at y=4 and y=5 both with x limits at 4 and 9 -fig.hlines(y=[4, 5], xmin=4, xmax=9, pen="1.5p,black,.", label="Line 4") +fig.hlines(y=[4, 5], xmin=4, xmax=9, pen="1.5p,black,.", label="Lines 5 & 6") # add two blue horizontal lines at y=2 and y=3 with different x limits -fig.hlines(y=[2, 3], xmin=[0, 1], xmax=[7, 7.5], pen="1.5p,dodgerblue3", label="Line 5") +fig.hlines(y=[2, 3], xmin=[0, 1], xmax=[7, 7.5], pen="1.5p,dodgerblue3", label="Lines 7 & 8") fig.legend(position="JBR+jBR+o0.2c", box="+gwhite+p1p") fig.shift_origin(xshift="w+2c") @@ -40,11 +40,11 @@ # add a gray dashed vertical line at x=2 with y limits at 2 and 8 fig.vlines(x=2, ymin=2, ymax=8, pen="1.5p,gray30,-", label="Line 2") # add two salmon-colored vertical lines at x=3 and x=4 both with y limits at 3 and 7 -fig.vlines(x=[3, 4], ymin=3, ymax=7, pen="1.5p,salmon", label="Line 3") +fig.vlines(x=[3, 4], ymin=3, ymax=7, pen="1.5p,salmon", label="Lines 3 & 4") # add two black dotted vertical lines at x=5 and x=6 both with y limits at 4 and 9 -fig.vlines(x=[5, 6], ymin=4, ymax=9, pen="1.5p,black,.", label="Line 4") +fig.vlines(x=[5, 6], ymin=4, ymax=9, pen="1.5p,black,.", label="Lines 5 & 6") # add two blue vertical lines at x=7 and x=8 with different y limits -fig.vlines(x=[7, 8], ymin=[0, 1], ymax=[7, 7.5], pen="1.5p,dodgerblue3", label="Line 5") +fig.vlines(x=[7, 8], ymin=[0, 1], ymax=[7, 7.5], pen="1.5p,dodgerblue3", label="Lines 7 & 8") fig.legend() fig.show() @@ -58,24 +58,24 @@ fig.basemap(region="g", projection="R15c", frame=["+thlines Geographic", "af"]) # add a red horizontal line at a latitude of 70°N without specifying longitude limits -fig.hlines(y=70, xmin=0, xmax=360, pen="1.5p,red3", label="line1") +fig.hlines(y=70, xmin=0, xmax=360, pen="1.5p,red3", label="Line 1") # add a blue line at a latitude of 50°N with longitude limits at 20°E and 160°E -fig.hlines(y=50, xmin=20, xmax=160, pen="1.5p,dodgerblue3", label="line2") +fig.hlines(y=50, xmin=20, xmax=160, pen="1.5p,dodgerblue3", label="Line 2") # add a gray dashed horizontal line at a latitude of 30°S with longitude limits at 60°E # and 270°E -fig.hlines(y=-30, xmin=60, xmax=270, pen="1.5p,gray30,-", label="line3") +fig.hlines(y=-30, xmin=60, xmax=270, pen="1.5p,gray30,-", label="Line 3") fig.legend() fig.shift_origin(xshift="w+2c") fig.basemap(region="g", projection="R15c", frame=["+tvlines Geographic", "af"]) # add a red vertical line at a longitude of 70°E without specifying latitude limits -fig.vlines(x=70, ymin=-90, ymax=90, pen="1.5p,red3", label="line1") +fig.vlines(x=70, ymin=-90, ymax=90, pen="1.5p,red3", label="Line 1") # add a blue vertical line at a longitude of 120°E with latitude limits at 50°S and 70°N -fig.vlines(x=120, ymin=-50, ymax=70, pen="1.5p,dodgerblue3", label="line2") +fig.vlines(x=120, ymin=-50, ymax=70, pen="1.5p,dodgerblue3", label="Line 2") # add a gray dashed vertical line at a longitude of 230°E with latitude limits at 70°S # and 80°N -fig.vlines(x=230, ymin=-70, ymax=80, pen="1.5p,gray30,-", label="line3") +fig.vlines(x=230, ymin=-70, ymax=80, pen="1.5p,gray30,-", label="Line 3") fig.legend() fig.show() @@ -89,24 +89,24 @@ fig.basemap(region=[0, 360, 0, 1], projection="P10c", frame=["+thlines Polar", "af"]) # add a red horizontal line along a radius of 0.8 without specifying azimuth limits -fig.hlines(y=0.8, pen="1.5p,red3", label="line1") +fig.hlines(y=0.8, pen="1.5p,red3", label="Line 1") # add a blue horizontal line along a radius of 0.5 with azimuth limits at 30° and 160° -fig.hlines(y=0.5, xmin=30, xmax=160, pen="1.5p,dodgerblue3", label="line2") +fig.hlines(y=0.5, xmin=30, xmax=160, pen="1.5p,dodgerblue3", label="Line 2") # add a gray dashed horizontal line along a radius of 0.25 with azimuth limits at 60° # and 270° -fig.hlines(y=0.25, xmin=60, xmax=270, pen="1.5p,gray30,-", label="line3") +fig.hlines(y=0.25, xmin=60, xmax=270, pen="1.5p,gray30,-", label="Line 3") fig.legend() fig.shift_origin(xshift="w+2c") fig.basemap(region=[0, 360, 0, 1], projection="P10c", frame=["+tvlines Polar", "af"]) # add a red vertical line along at an azimuth of 120° without specifying radius limits -fig.vlines(x=120, pen="1.5p,red3", label="line1") +fig.vlines(x=120, pen="1.5p,red3", label="Line 1") # add a blue vertical line along at an azimuth of 190° with radius limits at 0.2 and 0.8 -fig.vlines(x=190, ymin=0.2, ymax=0.8, pen="1.5p,dodgerblue3", label="line2") +fig.vlines(x=190, ymin=0.2, ymax=0.8, pen="1.5p,dodgerblue3", label="Line 2") # add a gray dashed vertical line along at an azimuth of 320° with radius limits at 0.5 # and 0.9 -fig.vlines(x=320, ymin=0.5, ymax=0.9, pen="1.5p,gray30,-", label="line3") +fig.vlines(x=320, ymin=0.5, ymax=0.9, pen="1.5p,gray30,-", label="Line 3") fig.legend() fig.show() From b7e5d2132d6a9821595c31f15db9d45d7cbeaa49 Mon Sep 17 00:00:00 2001 From: actions-bot <58130806+actions-bot@users.noreply.github.com> Date: Wed, 8 Jan 2025 13:23:30 +0000 Subject: [PATCH 18/37] [format-command] fixes --- examples/gallery/lines/hlines_vlines.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/examples/gallery/lines/hlines_vlines.py b/examples/gallery/lines/hlines_vlines.py index ab11bcab17b..8885903d34c 100644 --- a/examples/gallery/lines/hlines_vlines.py +++ b/examples/gallery/lines/hlines_vlines.py @@ -27,7 +27,9 @@ # add two black dotted horizontal lines at y=4 and y=5 both with x limits at 4 and 9 fig.hlines(y=[4, 5], xmin=4, xmax=9, pen="1.5p,black,.", label="Lines 5 & 6") # add two blue horizontal lines at y=2 and y=3 with different x limits -fig.hlines(y=[2, 3], xmin=[0, 1], xmax=[7, 7.5], pen="1.5p,dodgerblue3", label="Lines 7 & 8") +fig.hlines( + y=[2, 3], xmin=[0, 1], xmax=[7, 7.5], pen="1.5p,dodgerblue3", label="Lines 7 & 8" +) fig.legend(position="JBR+jBR+o0.2c", box="+gwhite+p1p") fig.shift_origin(xshift="w+2c") @@ -44,7 +46,9 @@ # add two black dotted vertical lines at x=5 and x=6 both with y limits at 4 and 9 fig.vlines(x=[5, 6], ymin=4, ymax=9, pen="1.5p,black,.", label="Lines 5 & 6") # add two blue vertical lines at x=7 and x=8 with different y limits -fig.vlines(x=[7, 8], ymin=[0, 1], ymax=[7, 7.5], pen="1.5p,dodgerblue3", label="Lines 7 & 8") +fig.vlines( + x=[7, 8], ymin=[0, 1], ymax=[7, 7.5], pen="1.5p,dodgerblue3", label="Lines 7 & 8" +) fig.legend() fig.show() From 8805817e42dd709ead062e1dc1f8e036860bae98 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 8 Jan 2025 15:35:49 +0100 Subject: [PATCH 19/37] Update hlines_vlines.py --- examples/gallery/lines/hlines_vlines.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/gallery/lines/hlines_vlines.py b/examples/gallery/lines/hlines_vlines.py index 8885903d34c..3d9bc59cb50 100644 --- a/examples/gallery/lines/hlines_vlines.py +++ b/examples/gallery/lines/hlines_vlines.py @@ -54,9 +54,9 @@ fig.show() # %% -# The same can be done for Geographic projections where horizontal means -# the lines are plotted as parallels along constant latitude and vertical -# lines are plotted as parallels along constant longitude. +# The same can be done for Geographic projections where "horizontal" means lines +# are plotted along paralles (constant latitude) while "vertical" means lines are +# plotted along meridians (constant longitude). fig = pygmt.Figure() @@ -85,8 +85,8 @@ fig.show() # %% -# When using Polar projections horizontal means lines are plotted as -# arcs along a constant radius while vertical lines are plotted as +# When using Polar projections "horizontal" means lines are plotted as +# arcs along a constant radius while "vertical" means lines are plotted as # straight lines along radius at a specified azimuth. fig = pygmt.Figure() From f89cae5bf84d5e082107456caa3f3d9f6f45d8d1 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 8 Jan 2025 15:37:19 +0100 Subject: [PATCH 20/37] rm trailing ws --- examples/gallery/lines/hlines_vlines.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/gallery/lines/hlines_vlines.py b/examples/gallery/lines/hlines_vlines.py index 3d9bc59cb50..e7e3f43237a 100644 --- a/examples/gallery/lines/hlines_vlines.py +++ b/examples/gallery/lines/hlines_vlines.py @@ -54,8 +54,8 @@ fig.show() # %% -# The same can be done for Geographic projections where "horizontal" means lines -# are plotted along paralles (constant latitude) while "vertical" means lines are +# The same can be done for Geographic projections where "horizontal" means lines +# are plotted along paralles (constant latitude) while "vertical" means lines are # plotted along meridians (constant longitude). fig = pygmt.Figure() From 8ce2a18767ea97a767145fabc6e11139da759409 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 8 Jan 2025 15:38:33 +0100 Subject: [PATCH 21/37] fix typo --- examples/gallery/lines/hlines_vlines.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gallery/lines/hlines_vlines.py b/examples/gallery/lines/hlines_vlines.py index e7e3f43237a..80cc45f3894 100644 --- a/examples/gallery/lines/hlines_vlines.py +++ b/examples/gallery/lines/hlines_vlines.py @@ -55,7 +55,7 @@ # %% # The same can be done for Geographic projections where "horizontal" means lines -# are plotted along paralles (constant latitude) while "vertical" means lines are +# are plotted along parallels (constant latitude) while "vertical" means lines are # plotted along meridians (constant longitude). fig = pygmt.Figure() From d863b9cebe351b9eca066640a805cf48b2a4a5c7 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 8 Jan 2025 16:03:34 +0100 Subject: [PATCH 22/37] Update hlines.py --- pygmt/src/hlines.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygmt/src/hlines.py b/pygmt/src/hlines.py index b277358d981..3c3161cc033 100644 --- a/pygmt/src/hlines.py +++ b/pygmt/src/hlines.py @@ -40,7 +40,7 @@ def hlines( - **Cartesian** coordinate system: lines are plotted as straight lines. - **Polar** projection: lines are plotted as arcs along a constant radius. - - **Geographic** projection: lines are plotted as parallels along constant latitude. + - **Geographic** projection: lines are plotted along parallels (constant latitude). Parameters ---------- From d686ac8e88ce60673a70f582836d1be6ef55a754 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 8 Jan 2025 16:04:11 +0100 Subject: [PATCH 23/37] Update vlines.py --- pygmt/src/vlines.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pygmt/src/vlines.py b/pygmt/src/vlines.py index 2483df99f27..362e79a6fb7 100644 --- a/pygmt/src/vlines.py +++ b/pygmt/src/vlines.py @@ -40,8 +40,7 @@ def vlines( - **Cartesian** coordinate system: lines are plotted as straight lines. - **Polar** projection: lines are plotted as straight lines along radius. - - **Geographic** projection: lines are plotted as meridians along constant - longitude. + - **Geographic** projection: lines are plotted along meridians (constant longitude). Parameters ---------- From c8cfa364bba4d83e2628463361399c5a5cc140a9 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 8 Jan 2025 16:18:57 +0100 Subject: [PATCH 24/37] Apply suggestions from code review Co-authored-by: Dongdong Tian --- examples/gallery/lines/hlines_vlines.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/gallery/lines/hlines_vlines.py b/examples/gallery/lines/hlines_vlines.py index 80cc45f3894..d5f08ccab39 100644 --- a/examples/gallery/lines/hlines_vlines.py +++ b/examples/gallery/lines/hlines_vlines.py @@ -8,6 +8,8 @@ """ # %% +# Cartesian coordinate system +# --------------------------- # In Cartesian projections lines are plotted as straight lines. import pygmt From 5cee1a32033a71bb982ecc0d94f3301dcbd1a1c4 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 8 Jan 2025 16:19:46 +0100 Subject: [PATCH 25/37] Update hlines_vlines.py --- examples/gallery/lines/hlines_vlines.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/gallery/lines/hlines_vlines.py b/examples/gallery/lines/hlines_vlines.py index d5f08ccab39..e68b7cd9066 100644 --- a/examples/gallery/lines/hlines_vlines.py +++ b/examples/gallery/lines/hlines_vlines.py @@ -56,6 +56,8 @@ fig.show() # %% +# Geographic coordinate system +# ---------------------------- # The same can be done for Geographic projections where "horizontal" means lines # are plotted along parallels (constant latitude) while "vertical" means lines are # plotted along meridians (constant longitude). @@ -87,6 +89,8 @@ fig.show() # %% +# Polar coordinate system +# ----------------------- # When using Polar projections "horizontal" means lines are plotted as # arcs along a constant radius while "vertical" means lines are plotted as # straight lines along radius at a specified azimuth. From 74f3b705acf8b4dd434d2621963a59703901bfa2 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Thu, 9 Jan 2025 09:42:44 +0100 Subject: [PATCH 26/37] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com> --- examples/gallery/lines/hlines_vlines.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/examples/gallery/lines/hlines_vlines.py b/examples/gallery/lines/hlines_vlines.py index e68b7cd9066..1f0862c6e62 100644 --- a/examples/gallery/lines/hlines_vlines.py +++ b/examples/gallery/lines/hlines_vlines.py @@ -2,9 +2,8 @@ Horizontal and vertical lines ============================= -The :meth:`pygmt.Figure.hlines` and :meth:`pygmt.Figure.vlines` -methods allow to plot horizontal and vertical lines in -Cartesian, Geographic and Polar projections. +The :meth:`pygmt.Figure.hlines` and :meth:`pygmt.Figure.vlines` methods allow to plot +horizontal and vertical lines in Cartesian, geographic and polar projections. """ # %% @@ -58,15 +57,15 @@ # %% # Geographic coordinate system # ---------------------------- -# The same can be done for Geographic projections where "horizontal" means lines -# are plotted along parallels (constant latitude) while "vertical" means lines are -# plotted along meridians (constant longitude). +# The same can be done for Geographic projections where "horizontal" means lines are +# plotted along parallels (constant latitude) while "vertical" means lines are plotted +# along meridians (constant longitude). fig = pygmt.Figure() fig.basemap(region="g", projection="R15c", frame=["+thlines Geographic", "af"]) # add a red horizontal line at a latitude of 70°N without specifying longitude limits -fig.hlines(y=70, xmin=0, xmax=360, pen="1.5p,red3", label="Line 1") +fig.hlines(y=70, pen="1.5p,red3", label="Line 1") # add a blue line at a latitude of 50°N with longitude limits at 20°E and 160°E fig.hlines(y=50, xmin=20, xmax=160, pen="1.5p,dodgerblue3", label="Line 2") # add a gray dashed horizontal line at a latitude of 30°S with longitude limits at 60°E @@ -78,7 +77,7 @@ fig.basemap(region="g", projection="R15c", frame=["+tvlines Geographic", "af"]) # add a red vertical line at a longitude of 70°E without specifying latitude limits -fig.vlines(x=70, ymin=-90, ymax=90, pen="1.5p,red3", label="Line 1") +fig.vlines(x=70, pen="1.5p,red3", label="Line 1") # add a blue vertical line at a longitude of 120°E with latitude limits at 50°S and 70°N fig.vlines(x=120, ymin=-50, ymax=70, pen="1.5p,dodgerblue3", label="Line 2") # add a gray dashed vertical line at a longitude of 230°E with latitude limits at 70°S @@ -91,9 +90,9 @@ # %% # Polar coordinate system # ----------------------- -# When using Polar projections "horizontal" means lines are plotted as -# arcs along a constant radius while "vertical" means lines are plotted as -# straight lines along radius at a specified azimuth. +# When using Polar projections "horizontal" means lines are plotted as arcs along a +# constant radius while "vertical" means lines are plotted as straight lines along +# radius at a specified azimuth. fig = pygmt.Figure() From 43b3a68f23ea0a543cbb251c6ccb4de3c0898822 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Thu, 9 Jan 2025 10:18:03 +0100 Subject: [PATCH 27/37] adjust text --- examples/gallery/lines/hlines_vlines.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/gallery/lines/hlines_vlines.py b/examples/gallery/lines/hlines_vlines.py index 1f0862c6e62..7be0d9097ed 100644 --- a/examples/gallery/lines/hlines_vlines.py +++ b/examples/gallery/lines/hlines_vlines.py @@ -57,13 +57,13 @@ # %% # Geographic coordinate system # ---------------------------- -# The same can be done for Geographic projections where "horizontal" means lines are +# The same can be done for geographic projections where "horizontal" means lines are # plotted along parallels (constant latitude) while "vertical" means lines are plotted # along meridians (constant longitude). fig = pygmt.Figure() -fig.basemap(region="g", projection="R15c", frame=["+thlines Geographic", "af"]) +fig.basemap(region="g", projection="R15c", frame=["+thlines geographic", "af"]) # add a red horizontal line at a latitude of 70°N without specifying longitude limits fig.hlines(y=70, pen="1.5p,red3", label="Line 1") # add a blue line at a latitude of 50°N with longitude limits at 20°E and 160°E @@ -75,7 +75,7 @@ fig.shift_origin(xshift="w+2c") -fig.basemap(region="g", projection="R15c", frame=["+tvlines Geographic", "af"]) +fig.basemap(region="g", projection="R15c", frame=["+tvlines geographic", "af"]) # add a red vertical line at a longitude of 70°E without specifying latitude limits fig.vlines(x=70, pen="1.5p,red3", label="Line 1") # add a blue vertical line at a longitude of 120°E with latitude limits at 50°S and 70°N @@ -90,13 +90,13 @@ # %% # Polar coordinate system # ----------------------- -# When using Polar projections "horizontal" means lines are plotted as arcs along a +# When using polar projections "horizontal" means lines are plotted as arcs along a # constant radius while "vertical" means lines are plotted as straight lines along # radius at a specified azimuth. fig = pygmt.Figure() -fig.basemap(region=[0, 360, 0, 1], projection="P10c", frame=["+thlines Polar", "af"]) +fig.basemap(region=[0, 360, 0, 1], projection="P10c", frame=["+thlines polar", "af"]) # add a red horizontal line along a radius of 0.8 without specifying azimuth limits fig.hlines(y=0.8, pen="1.5p,red3", label="Line 1") # add a blue horizontal line along a radius of 0.5 with azimuth limits at 30° and 160° @@ -108,7 +108,7 @@ fig.shift_origin(xshift="w+2c") -fig.basemap(region=[0, 360, 0, 1], projection="P10c", frame=["+tvlines Polar", "af"]) +fig.basemap(region=[0, 360, 0, 1], projection="P10c", frame=["+tvlines polar", "af"]) # add a red vertical line along at an azimuth of 120° without specifying radius limits fig.vlines(x=120, pen="1.5p,red3", label="Line 1") # add a blue vertical line along at an azimuth of 190° with radius limits at 0.2 and 0.8 From 80526c512ddfd9b4aee5b1c9b8d29b7a9a88143b Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Fri, 10 Jan 2025 10:05:43 +0100 Subject: [PATCH 28/37] Update hlines_vlines.py --- examples/gallery/lines/hlines_vlines.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/gallery/lines/hlines_vlines.py b/examples/gallery/lines/hlines_vlines.py index 7be0d9097ed..6723d96da07 100644 --- a/examples/gallery/lines/hlines_vlines.py +++ b/examples/gallery/lines/hlines_vlines.py @@ -3,13 +3,13 @@ ============================= The :meth:`pygmt.Figure.hlines` and :meth:`pygmt.Figure.vlines` methods allow to plot -horizontal and vertical lines in Cartesian, geographic and polar projections. +horizontal and vertical lines in Cartesian, geographic and polar coordinate systems. """ # %% # Cartesian coordinate system # --------------------------- -# In Cartesian projections lines are plotted as straight lines. +# In Cartesian coordinate systems lines are plotted as straight lines. import pygmt @@ -57,9 +57,9 @@ # %% # Geographic coordinate system # ---------------------------- -# The same can be done for geographic projections where "horizontal" means lines are -# plotted along parallels (constant latitude) while "vertical" means lines are plotted -# along meridians (constant longitude). +# The same can be done in geographic coordinate systems where "horizontal" means lines +# are plotted along parallels (constant latitude) while "vertical" means lines are +# plotted along meridians (constant longitude). fig = pygmt.Figure() @@ -90,7 +90,7 @@ # %% # Polar coordinate system # ----------------------- -# When using polar projections "horizontal" means lines are plotted as arcs along a +# When using coordinate systems "horizontal" means lines are plotted as arcs along a # constant radius while "vertical" means lines are plotted as straight lines along # radius at a specified azimuth. From a98789b39aa45334f0dd2e29b2e976c2d111a4f8 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Fri, 10 Jan 2025 10:06:00 +0100 Subject: [PATCH 29/37] Apply suggestions from code review Co-authored-by: Dongdong Tian --- examples/gallery/lines/hlines_vlines.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/gallery/lines/hlines_vlines.py b/examples/gallery/lines/hlines_vlines.py index 6723d96da07..25b79d2f171 100644 --- a/examples/gallery/lines/hlines_vlines.py +++ b/examples/gallery/lines/hlines_vlines.py @@ -19,15 +19,15 @@ region=[0, 10, 0, 10], projection="X10c/10c", frame=["+thlines Cartesian", "af"] ) -# add a red horizontal line at y=9 without specifying x limits +# Add a horizontal line at y=9 fig.hlines(y=9, pen="1.5p,red3", label="Line 1") -# add a gray dashed horizontal line at y=8 with x limits at 2 and 8 +# Add a horizontal line at y=8 with x from 2 to 8 fig.hlines(y=8, xmin=2, xmax=8, pen="1.5p,gray30,-", label="Line 2") -# add two salmon-colored horizontal lines at y=6 and y=7 both with x limits at 3 and 7 +# Add two horizontal lines at y=6 and y=7 both with x from 3 to 7 fig.hlines(y=[6, 7], xmin=3, xmax=7, pen="1.5p,salmon", label="Lines 3 & 4") -# add two black dotted horizontal lines at y=4 and y=5 both with x limits at 4 and 9 +# Add two horizontal lines at y=4 and y=5 both with x from 4 to 9 fig.hlines(y=[4, 5], xmin=4, xmax=9, pen="1.5p,black,.", label="Lines 5 & 6") -# add two blue horizontal lines at y=2 and y=3 with different x limits +# Add two horizontal lines at y=2 and y=3 with different x limits fig.hlines( y=[2, 3], xmin=[0, 1], xmax=[7, 7.5], pen="1.5p,dodgerblue3", label="Lines 7 & 8" ) From abfa638b974bb3619640abbd31a219433c17b639 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Fri, 10 Jan 2025 10:12:08 +0100 Subject: [PATCH 30/37] shorten descriptions --- examples/gallery/lines/hlines_vlines.py | 34 ++++++++++++------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/examples/gallery/lines/hlines_vlines.py b/examples/gallery/lines/hlines_vlines.py index 25b79d2f171..016586f70d0 100644 --- a/examples/gallery/lines/hlines_vlines.py +++ b/examples/gallery/lines/hlines_vlines.py @@ -38,15 +38,15 @@ fig.basemap( region=[0, 10, 0, 10], projection="X10c/10c", frame=["+tvlines Cartesian", "af"] ) -# add a red vertical line at x=1 without specifying y limits +# Add a vertical line at x=1 fig.vlines(x=1, pen="1.5p,red3", label="Line 1") -# add a gray dashed vertical line at x=2 with y limits at 2 and 8 +# Add a vertical line at x=2 with y from 2 to 8 fig.vlines(x=2, ymin=2, ymax=8, pen="1.5p,gray30,-", label="Line 2") -# add two salmon-colored vertical lines at x=3 and x=4 both with y limits at 3 and 7 +# Add two vertical lines at x=3 and x=4 both with y from 3 to 7 fig.vlines(x=[3, 4], ymin=3, ymax=7, pen="1.5p,salmon", label="Lines 3 & 4") -# add two black dotted vertical lines at x=5 and x=6 both with y limits at 4 and 9 +# Add two vertical lines at x=5 and x=6 both with y from 4 to 9 fig.vlines(x=[5, 6], ymin=4, ymax=9, pen="1.5p,black,.", label="Lines 5 & 6") -# add two blue vertical lines at x=7 and x=8 with different y limits +# Add two vertical lines at x=7 and x=8 with different y limits fig.vlines( x=[7, 8], ymin=[0, 1], ymax=[7, 7.5], pen="1.5p,dodgerblue3", label="Lines 7 & 8" ) @@ -64,11 +64,11 @@ fig = pygmt.Figure() fig.basemap(region="g", projection="R15c", frame=["+thlines geographic", "af"]) -# add a red horizontal line at a latitude of 70°N without specifying longitude limits +# Add a horizontal line at a latitude of 70°N without specifying longitude limits fig.hlines(y=70, pen="1.5p,red3", label="Line 1") -# add a blue line at a latitude of 50°N with longitude limits at 20°E and 160°E +# Add a line at a latitude of 50°N with longitude limits at 20°E and 160°E fig.hlines(y=50, xmin=20, xmax=160, pen="1.5p,dodgerblue3", label="Line 2") -# add a gray dashed horizontal line at a latitude of 30°S with longitude limits at 60°E +# Add a horizontal line at a latitude of 30°S with longitude limits at 60°E # and 270°E fig.hlines(y=-30, xmin=60, xmax=270, pen="1.5p,gray30,-", label="Line 3") fig.legend() @@ -76,11 +76,11 @@ fig.shift_origin(xshift="w+2c") fig.basemap(region="g", projection="R15c", frame=["+tvlines geographic", "af"]) -# add a red vertical line at a longitude of 70°E without specifying latitude limits +# Add a vertical line at a longitude of 70°E without specifying latitude limits fig.vlines(x=70, pen="1.5p,red3", label="Line 1") -# add a blue vertical line at a longitude of 120°E with latitude limits at 50°S and 70°N +# Add a vertical line at a longitude of 120°E with latitude limits at 50°S and 70°N fig.vlines(x=120, ymin=-50, ymax=70, pen="1.5p,dodgerblue3", label="Line 2") -# add a gray dashed vertical line at a longitude of 230°E with latitude limits at 70°S +# Add a vertical line at a longitude of 230°E with latitude limits at 70°S # and 80°N fig.vlines(x=230, ymin=-70, ymax=80, pen="1.5p,gray30,-", label="Line 3") fig.legend() @@ -97,11 +97,11 @@ fig = pygmt.Figure() fig.basemap(region=[0, 360, 0, 1], projection="P10c", frame=["+thlines polar", "af"]) -# add a red horizontal line along a radius of 0.8 without specifying azimuth limits +# Add a horizontal line along a radius of 0.8 without specifying azimuth limits fig.hlines(y=0.8, pen="1.5p,red3", label="Line 1") -# add a blue horizontal line along a radius of 0.5 with azimuth limits at 30° and 160° +# Add a horizontal line along a radius of 0.5 with azimuth limits at 30° and 160° fig.hlines(y=0.5, xmin=30, xmax=160, pen="1.5p,dodgerblue3", label="Line 2") -# add a gray dashed horizontal line along a radius of 0.25 with azimuth limits at 60° +# Add a horizontal line along a radius of 0.25 with azimuth limits at 60° # and 270° fig.hlines(y=0.25, xmin=60, xmax=270, pen="1.5p,gray30,-", label="Line 3") fig.legend() @@ -109,11 +109,11 @@ fig.shift_origin(xshift="w+2c") fig.basemap(region=[0, 360, 0, 1], projection="P10c", frame=["+tvlines polar", "af"]) -# add a red vertical line along at an azimuth of 120° without specifying radius limits +# Add a vertical line along at an azimuth of 120° without specifying radius limits fig.vlines(x=120, pen="1.5p,red3", label="Line 1") -# add a blue vertical line along at an azimuth of 190° with radius limits at 0.2 and 0.8 +# Add a vertical line along at an azimuth of 190° with radius limits at 0.2 and 0.8 fig.vlines(x=190, ymin=0.2, ymax=0.8, pen="1.5p,dodgerblue3", label="Line 2") -# add a gray dashed vertical line along at an azimuth of 320° with radius limits at 0.5 +# Add a vertical line along at an azimuth of 320° with radius limits at 0.5 # and 0.9 fig.vlines(x=320, ymin=0.5, ymax=0.9, pen="1.5p,gray30,-", label="Line 3") fig.legend() From 82d57f3d73f549b1bca4cfb32bbed103fce64a35 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Fri, 10 Jan 2025 10:13:31 +0100 Subject: [PATCH 31/37] Update hlines_vlines.py --- examples/gallery/lines/hlines_vlines.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gallery/lines/hlines_vlines.py b/examples/gallery/lines/hlines_vlines.py index 016586f70d0..cef9df10b5d 100644 --- a/examples/gallery/lines/hlines_vlines.py +++ b/examples/gallery/lines/hlines_vlines.py @@ -38,7 +38,7 @@ fig.basemap( region=[0, 10, 0, 10], projection="X10c/10c", frame=["+tvlines Cartesian", "af"] ) -# Add a vertical line at x=1 +# Add a vertical line at x=1 fig.vlines(x=1, pen="1.5p,red3", label="Line 1") # Add a vertical line at x=2 with y from 2 to 8 fig.vlines(x=2, ymin=2, ymax=8, pen="1.5p,gray30,-", label="Line 2") From e1d7452feb99a63aaf5859ee8756dfbafb106bad Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Fri, 10 Jan 2025 12:06:18 +0100 Subject: [PATCH 32/37] Apply suggestions from code review Co-authored-by: Dongdong Tian --- examples/gallery/lines/hlines_vlines.py | 28 +++++++++++-------------- pygmt/src/hlines.py | 6 +++--- pygmt/src/vlines.py | 6 +++--- 3 files changed, 18 insertions(+), 22 deletions(-) diff --git a/examples/gallery/lines/hlines_vlines.py b/examples/gallery/lines/hlines_vlines.py index cef9df10b5d..41decee2d89 100644 --- a/examples/gallery/lines/hlines_vlines.py +++ b/examples/gallery/lines/hlines_vlines.py @@ -64,24 +64,22 @@ fig = pygmt.Figure() fig.basemap(region="g", projection="R15c", frame=["+thlines geographic", "af"]) -# Add a horizontal line at a latitude of 70°N without specifying longitude limits +# Add a horizontal line at 70°N fig.hlines(y=70, pen="1.5p,red3", label="Line 1") -# Add a line at a latitude of 50°N with longitude limits at 20°E and 160°E +# Add a horizontal line at 50°N with longitude limits at 20°E and 160°E fig.hlines(y=50, xmin=20, xmax=160, pen="1.5p,dodgerblue3", label="Line 2") -# Add a horizontal line at a latitude of 30°S with longitude limits at 60°E -# and 270°E +# Add a horizontal line at 30°S with longitude limits at 60°E and 270°E fig.hlines(y=-30, xmin=60, xmax=270, pen="1.5p,gray30,-", label="Line 3") fig.legend() fig.shift_origin(xshift="w+2c") fig.basemap(region="g", projection="R15c", frame=["+tvlines geographic", "af"]) -# Add a vertical line at a longitude of 70°E without specifying latitude limits +# Add a vertical line at 70°E fig.vlines(x=70, pen="1.5p,red3", label="Line 1") -# Add a vertical line at a longitude of 120°E with latitude limits at 50°S and 70°N +# Add a vertical line at 20°E with latitude limits at 50°S and 70°N fig.vlines(x=120, ymin=-50, ymax=70, pen="1.5p,dodgerblue3", label="Line 2") -# Add a vertical line at a longitude of 230°E with latitude limits at 70°S -# and 80°N +# Add a vertical line at 230°E with latitude limits at 70°S and 80°N fig.vlines(x=230, ymin=-70, ymax=80, pen="1.5p,gray30,-", label="Line 3") fig.legend() @@ -97,24 +95,22 @@ fig = pygmt.Figure() fig.basemap(region=[0, 360, 0, 1], projection="P10c", frame=["+thlines polar", "af"]) -# Add a horizontal line along a radius of 0.8 without specifying azimuth limits +# Add a horizontal line along radius=0.8 fig.hlines(y=0.8, pen="1.5p,red3", label="Line 1") -# Add a horizontal line along a radius of 0.5 with azimuth limits at 30° and 160° +# Add a horizontal line along radius=0.5 with azimuth limits at 30° and 160° fig.hlines(y=0.5, xmin=30, xmax=160, pen="1.5p,dodgerblue3", label="Line 2") -# Add a horizontal line along a radius of 0.25 with azimuth limits at 60° -# and 270° +# Add a horizontal line along radius=0.25 with azimuth limits at 60° and 270° fig.hlines(y=0.25, xmin=60, xmax=270, pen="1.5p,gray30,-", label="Line 3") fig.legend() fig.shift_origin(xshift="w+2c") fig.basemap(region=[0, 360, 0, 1], projection="P10c", frame=["+tvlines polar", "af"]) -# Add a vertical line along at an azimuth of 120° without specifying radius limits +# Add a vertical line along azimuth=120° fig.vlines(x=120, pen="1.5p,red3", label="Line 1") -# Add a vertical line along at an azimuth of 190° with radius limits at 0.2 and 0.8 +# Add a vertical line along azimuth=190° with radius limits at 0.2 and 0.8 fig.vlines(x=190, ymin=0.2, ymax=0.8, pen="1.5p,dodgerblue3", label="Line 2") -# Add a vertical line along at an azimuth of 320° with radius limits at 0.5 -# and 0.9 +# Add a vertical line along azimuth=320 with radius limits at 0.5 and 0.9 fig.vlines(x=320, ymin=0.5, ymax=0.9, pen="1.5p,gray30,-", label="Line 3") fig.legend() diff --git a/pygmt/src/hlines.py b/pygmt/src/hlines.py index 3c3161cc033..63516b33bc7 100644 --- a/pygmt/src/hlines.py +++ b/pygmt/src/hlines.py @@ -38,9 +38,9 @@ def hlines( The term "horizontal" lines can be interpreted differently in different coordinate systems: - - **Cartesian** coordinate system: lines are plotted as straight lines. - - **Polar** projection: lines are plotted as arcs along a constant radius. - - **Geographic** projection: lines are plotted along parallels (constant latitude). + - **Cartesian**: lines are plotted as straight lines. + - **Polar**: lines are plotted as arcs along a constant radius. + - **Geographic**: lines are plotted along parallels (constant latitude). Parameters ---------- diff --git a/pygmt/src/vlines.py b/pygmt/src/vlines.py index 362e79a6fb7..c5888601f68 100644 --- a/pygmt/src/vlines.py +++ b/pygmt/src/vlines.py @@ -38,9 +38,9 @@ def vlines( The term "vertical" lines can be interpreted differently in different coordinate systems: - - **Cartesian** coordinate system: lines are plotted as straight lines. - - **Polar** projection: lines are plotted as straight lines along radius. - - **Geographic** projection: lines are plotted along meridians (constant longitude). + - **Cartesian**: lines are plotted as straight lines. + - **Polar**: lines are plotted as straight lines along radius. + - **Geographic**: lines are plotted along meridians (constant longitude). Parameters ---------- From d1e7ff0ccfc323b160b234be2edc763c48adc3f1 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Fri, 10 Jan 2025 16:28:59 +0100 Subject: [PATCH 33/37] Update hlines_vlines.py --- examples/gallery/lines/hlines_vlines.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/gallery/lines/hlines_vlines.py b/examples/gallery/lines/hlines_vlines.py index 41decee2d89..91f70e6337a 100644 --- a/examples/gallery/lines/hlines_vlines.py +++ b/examples/gallery/lines/hlines_vlines.py @@ -16,7 +16,7 @@ fig = pygmt.Figure() fig.basemap( - region=[0, 10, 0, 10], projection="X10c/10c", frame=["+thlines Cartesian", "af"] + region=[0, 10, 0, 10], projection="X10c/10c", frame=["+tCartesian hlines", "af"] ) # Add a horizontal line at y=9 @@ -36,7 +36,7 @@ fig.shift_origin(xshift="w+2c") fig.basemap( - region=[0, 10, 0, 10], projection="X10c/10c", frame=["+tvlines Cartesian", "af"] + region=[0, 10, 0, 10], projection="X10c/10c", frame=["+tCartesian vlines", "af"] ) # Add a vertical line at x=1 fig.vlines(x=1, pen="1.5p,red3", label="Line 1") @@ -63,7 +63,7 @@ fig = pygmt.Figure() -fig.basemap(region="g", projection="R15c", frame=["+thlines geographic", "af"]) +fig.basemap(region="g", projection="R15c", frame=["+tGeographic hlines", "af"]) # Add a horizontal line at 70°N fig.hlines(y=70, pen="1.5p,red3", label="Line 1") # Add a horizontal line at 50°N with longitude limits at 20°E and 160°E @@ -74,7 +74,7 @@ fig.shift_origin(xshift="w+2c") -fig.basemap(region="g", projection="R15c", frame=["+tvlines geographic", "af"]) +fig.basemap(region="g", projection="R15c", frame=["+tGeographic vlines", "af"]) # Add a vertical line at 70°E fig.vlines(x=70, pen="1.5p,red3", label="Line 1") # Add a vertical line at 20°E with latitude limits at 50°S and 70°N @@ -94,7 +94,7 @@ fig = pygmt.Figure() -fig.basemap(region=[0, 360, 0, 1], projection="P10c", frame=["+thlines polar", "af"]) +fig.basemap(region=[0, 360, 0, 1], projection="P10c", frame=["+tPolar hlines", "af"]) # Add a horizontal line along radius=0.8 fig.hlines(y=0.8, pen="1.5p,red3", label="Line 1") # Add a horizontal line along radius=0.5 with azimuth limits at 30° and 160° @@ -105,7 +105,7 @@ fig.shift_origin(xshift="w+2c") -fig.basemap(region=[0, 360, 0, 1], projection="P10c", frame=["+tvlines polar", "af"]) +fig.basemap(region=[0, 360, 0, 1], projection="P10c", frame=["+tPolar vlines", "af"]) # Add a vertical line along azimuth=120° fig.vlines(x=120, pen="1.5p,red3", label="Line 1") # Add a vertical line along azimuth=190° with radius limits at 0.2 and 0.8 From 7f64d32ae3ea9bfe16d96d8f7de6a5ebcce54a8c Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Sun, 12 Jan 2025 15:39:59 +0100 Subject: [PATCH 34/37] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com> --- examples/gallery/lines/hlines_vlines.py | 4 ++-- pygmt/src/vlines.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/gallery/lines/hlines_vlines.py b/examples/gallery/lines/hlines_vlines.py index 91f70e6337a..ba4699cf544 100644 --- a/examples/gallery/lines/hlines_vlines.py +++ b/examples/gallery/lines/hlines_vlines.py @@ -88,14 +88,14 @@ # %% # Polar coordinate system # ----------------------- -# When using coordinate systems "horizontal" means lines are plotted as arcs along a +# When using polar coordinate systems "horizontal" means lines are plotted as arcs along a # constant radius while "vertical" means lines are plotted as straight lines along # radius at a specified azimuth. fig = pygmt.Figure() fig.basemap(region=[0, 360, 0, 1], projection="P10c", frame=["+tPolar hlines", "af"]) -# Add a horizontal line along radius=0.8 +# Add a line along radius=0.8 fig.hlines(y=0.8, pen="1.5p,red3", label="Line 1") # Add a horizontal line along radius=0.5 with azimuth limits at 30° and 160° fig.hlines(y=0.5, xmin=30, xmax=160, pen="1.5p,dodgerblue3", label="Line 2") diff --git a/pygmt/src/vlines.py b/pygmt/src/vlines.py index c5888601f68..321528a07f3 100644 --- a/pygmt/src/vlines.py +++ b/pygmt/src/vlines.py @@ -39,7 +39,7 @@ def vlines( systems: - **Cartesian**: lines are plotted as straight lines. - - **Polar**: lines are plotted as straight lines along radius. + - **Polar**: lines are plotted as straight lines along a constant azimuth. - **Geographic**: lines are plotted along meridians (constant longitude). Parameters From 8b020ce7b708978b0a13e2823a48918b01c07509 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Mon, 13 Jan 2025 07:33:32 +0100 Subject: [PATCH 35/37] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com> Co-authored-by: Dongdong Tian --- examples/gallery/lines/hlines_vlines.py | 22 +++++++++++----------- pygmt/src/hlines.py | 2 +- pygmt/src/vlines.py | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/examples/gallery/lines/hlines_vlines.py b/examples/gallery/lines/hlines_vlines.py index ba4699cf544..5aa25336508 100644 --- a/examples/gallery/lines/hlines_vlines.py +++ b/examples/gallery/lines/hlines_vlines.py @@ -64,22 +64,22 @@ fig = pygmt.Figure() fig.basemap(region="g", projection="R15c", frame=["+tGeographic hlines", "af"]) -# Add a horizontal line at 70°N +# Add a line at 70°N fig.hlines(y=70, pen="1.5p,red3", label="Line 1") -# Add a horizontal line at 50°N with longitude limits at 20°E and 160°E +# Add a line at 50°N with longitude limits at 20°E and 160°E fig.hlines(y=50, xmin=20, xmax=160, pen="1.5p,dodgerblue3", label="Line 2") -# Add a horizontal line at 30°S with longitude limits at 60°E and 270°E +# Add a line at 30°S with longitude limits at 60°E and 270°E fig.hlines(y=-30, xmin=60, xmax=270, pen="1.5p,gray30,-", label="Line 3") fig.legend() fig.shift_origin(xshift="w+2c") fig.basemap(region="g", projection="R15c", frame=["+tGeographic vlines", "af"]) -# Add a vertical line at 70°E +# Add a line at 70°E fig.vlines(x=70, pen="1.5p,red3", label="Line 1") -# Add a vertical line at 20°E with latitude limits at 50°S and 70°N +# Add a line at 20°E with latitude limits at 50°S and 70°N fig.vlines(x=120, ymin=-50, ymax=70, pen="1.5p,dodgerblue3", label="Line 2") -# Add a vertical line at 230°E with latitude limits at 70°S and 80°N +# Add a line at 230°E with latitude limits at 70°S and 80°N fig.vlines(x=230, ymin=-70, ymax=80, pen="1.5p,gray30,-", label="Line 3") fig.legend() @@ -97,20 +97,20 @@ fig.basemap(region=[0, 360, 0, 1], projection="P10c", frame=["+tPolar hlines", "af"]) # Add a line along radius=0.8 fig.hlines(y=0.8, pen="1.5p,red3", label="Line 1") -# Add a horizontal line along radius=0.5 with azimuth limits at 30° and 160° +# Add a line along radius=0.5 with azimuth limits at 30° and 160° fig.hlines(y=0.5, xmin=30, xmax=160, pen="1.5p,dodgerblue3", label="Line 2") -# Add a horizontal line along radius=0.25 with azimuth limits at 60° and 270° +# Add a line along radius=0.25 with azimuth limits at 60° and 270° fig.hlines(y=0.25, xmin=60, xmax=270, pen="1.5p,gray30,-", label="Line 3") fig.legend() fig.shift_origin(xshift="w+2c") fig.basemap(region=[0, 360, 0, 1], projection="P10c", frame=["+tPolar vlines", "af"]) -# Add a vertical line along azimuth=120° +# Add a line along azimuth=120° fig.vlines(x=120, pen="1.5p,red3", label="Line 1") -# Add a vertical line along azimuth=190° with radius limits at 0.2 and 0.8 +# Add a line along azimuth=190° with radius limits at 0.2 and 0.8 fig.vlines(x=190, ymin=0.2, ymax=0.8, pen="1.5p,dodgerblue3", label="Line 2") -# Add a vertical line along azimuth=320 with radius limits at 0.5 and 0.9 +# Add a line along azimuth=320 with radius limits at 0.5 and 0.9 fig.vlines(x=320, ymin=0.5, ymax=0.9, pen="1.5p,gray30,-", label="Line 3") fig.legend() diff --git a/pygmt/src/hlines.py b/pygmt/src/hlines.py index 63516b33bc7..af7c3d8dd35 100644 --- a/pygmt/src/hlines.py +++ b/pygmt/src/hlines.py @@ -40,7 +40,7 @@ def hlines( - **Cartesian**: lines are plotted as straight lines. - **Polar**: lines are plotted as arcs along a constant radius. - - **Geographic**: lines are plotted along parallels (constant latitude). + - **Geographic**: lines are plotted as arcs along parallels (i.e., constant latitude). Parameters ---------- diff --git a/pygmt/src/vlines.py b/pygmt/src/vlines.py index 321528a07f3..7d1f81b57bc 100644 --- a/pygmt/src/vlines.py +++ b/pygmt/src/vlines.py @@ -40,7 +40,7 @@ def vlines( - **Cartesian**: lines are plotted as straight lines. - **Polar**: lines are plotted as straight lines along a constant azimuth. - - **Geographic**: lines are plotted along meridians (constant longitude). + - **Geographic**: lines are plotted as arcs along meridians (i.e., constant longitude). Parameters ---------- From 63063a8179712e8236e167ac6458b8f4d0ed8f2c Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Mon, 13 Jan 2025 09:39:18 +0100 Subject: [PATCH 36/37] Apply suggestions from code review Co-authored-by: Dongdong Tian --- examples/gallery/lines/hlines_vlines.py | 4 ++-- pygmt/src/hlines.py | 3 ++- pygmt/src/vlines.py | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/examples/gallery/lines/hlines_vlines.py b/examples/gallery/lines/hlines_vlines.py index 5aa25336508..50491844968 100644 --- a/examples/gallery/lines/hlines_vlines.py +++ b/examples/gallery/lines/hlines_vlines.py @@ -88,8 +88,8 @@ # %% # Polar coordinate system # ----------------------- -# When using polar coordinate systems "horizontal" means lines are plotted as arcs along a -# constant radius while "vertical" means lines are plotted as straight lines along +# When using polar coordinate systems "horizontal" means lines are plotted as arcs along +# a constant radius while "vertical" means lines are plotted as straight lines along # radius at a specified azimuth. fig = pygmt.Figure() diff --git a/pygmt/src/hlines.py b/pygmt/src/hlines.py index af7c3d8dd35..e2c390b4eea 100644 --- a/pygmt/src/hlines.py +++ b/pygmt/src/hlines.py @@ -40,7 +40,8 @@ def hlines( - **Cartesian**: lines are plotted as straight lines. - **Polar**: lines are plotted as arcs along a constant radius. - - **Geographic**: lines are plotted as arcs along parallels (i.e., constant latitude). + - **Geographic**: lines are plotted as arcs along parallels (i.e., constant + latitude). Parameters ---------- diff --git a/pygmt/src/vlines.py b/pygmt/src/vlines.py index 7d1f81b57bc..7f1919baa9c 100644 --- a/pygmt/src/vlines.py +++ b/pygmt/src/vlines.py @@ -40,7 +40,8 @@ def vlines( - **Cartesian**: lines are plotted as straight lines. - **Polar**: lines are plotted as straight lines along a constant azimuth. - - **Geographic**: lines are plotted as arcs along meridians (i.e., constant longitude). + - **Geographic**: lines are plotted as arcs along meridians (i.e., constant + longitude). Parameters ---------- From 373e0a12af3d6207cbedafc69f0f4896915d6b26 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Tue, 14 Jan 2025 11:19:30 +0100 Subject: [PATCH 37/37] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com> --- examples/gallery/lines/hlines_vlines.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gallery/lines/hlines_vlines.py b/examples/gallery/lines/hlines_vlines.py index 50491844968..ec0d73dddab 100644 --- a/examples/gallery/lines/hlines_vlines.py +++ b/examples/gallery/lines/hlines_vlines.py @@ -88,7 +88,7 @@ # %% # Polar coordinate system # ----------------------- -# When using polar coordinate systems "horizontal" means lines are plotted as arcs along +# When using polar coordinate systems "horizontal" means lines are plotted as arcs along # a constant radius while "vertical" means lines are plotted as straight lines along # radius at a specified azimuth.