|
57 | 57 | )
|
58 | 58 | fig.plot(x=[2, 4, 10], y=[3, 8, 9], pen="2p,red")
|
59 | 59 | fig.show()
|
| 60 | + |
| 61 | +######################################################################################## |
| 62 | +# Change line attributes |
| 63 | +# ---------------------- |
| 64 | +# |
| 65 | +# The line attributes can be set using the ``pen`` parameter. ``pen`` takes a string |
| 66 | +# argument with the optional values *line width*,*line color*,*line style*. |
| 67 | +# |
| 68 | +# In the example below, the pen width is set to ``"5p"``, and with *black* as the |
| 69 | +# default color and *solid* as the default style. |
| 70 | + |
| 71 | +fig = pygmt.Figure() |
| 72 | +fig.plot( |
| 73 | + region=[0, 10, 0, 10], |
| 74 | + projection="X25c/20c", |
| 75 | + frame="a", |
| 76 | + x=[1, 8], |
| 77 | + y=[3, 9], |
| 78 | + pen="5p", |
| 79 | +) |
| 80 | +fig.show() |
| 81 | + |
| 82 | +######################################################################################## |
| 83 | +# The line color can be set and is added after the line width to the ``pen`` argument. |
| 84 | +# In the example below, the line color is set to "red". |
| 85 | + |
| 86 | +fig = pygmt.Figure() |
| 87 | +fig.plot( |
| 88 | + region=[0, 10, 0, 10], |
| 89 | + projection="X25c/20c", |
| 90 | + frame="a", |
| 91 | + x=[1, 8], |
| 92 | + y=[3, 9], |
| 93 | + pen="5p,red", |
| 94 | +) |
| 95 | +fig.show() |
| 96 | + |
| 97 | +######################################################################################## |
| 98 | +# The line style can be set and is added after the line width or color to the |
| 99 | +# ``pen`` argument. In the example below, the line color is set to *dot dot dash*, and |
| 100 | +# the default color *black* is used. |
| 101 | + |
| 102 | +fig = pygmt.Figure() |
| 103 | +fig.plot( |
| 104 | + region=[0, 10, 0, 10], |
| 105 | + projection="X25c/20c", |
| 106 | + frame="a", |
| 107 | + x=[1, 8], |
| 108 | + y=[3, 9], |
| 109 | + pen="5p,..-", |
| 110 | +) |
| 111 | +fig.show() |
| 112 | + |
| 113 | +######################################################################################## |
| 114 | +# The line width, color, and style can all be set in the same ``pen`` argument. In the |
| 115 | +# example below, the line width is set to *7p*, the color is set to *green*, and the |
| 116 | +# line style is *dash dot dash*. |
| 117 | + |
| 118 | +fig = pygmt.Figure() |
| 119 | +fig.plot( |
| 120 | + region=[0, 10, 0, 10], |
| 121 | + projection="X25c/20c", |
| 122 | + frame="a", |
| 123 | + x=[1, 8], |
| 124 | + y=[3, 9], |
| 125 | + pen="7p,green,-.-", |
| 126 | +) |
| 127 | +fig.show() |
0 commit comments