|
39 | 39 | # ----------------------------------------------------------------------------- |
40 | 40 | color_concept = "color" # "color" | "bw" |
41 | 41 | bg_concept = "dark" # "light" | "dark" |
42 | | -shape = "hexagon" # "circle" | "hexagon" |
| 42 | +shape = "circle" # "circle" | "hexagon" |
43 | 43 | wordmark = True # True | False |
44 | 44 | orientation = "horizontal" # "horizontal" | "vertical" |
45 | | -bg_transparent = True # True | False |
| 45 | +bg_transparent = False # True | False |
46 | 46 |
|
47 | 47 | angle_rot = 30 # degrees |
48 | 48 | dpi_png = 720 # resolution of saved PNG image |
49 | 49 |
|
50 | | - |
51 | 50 | # ----------------------------------------------------------------------------- |
52 | 51 | # Define colors (-> can be discussed) |
53 | 52 | # ----------------------------------------------------------------------------- |
|
70 | 69 | color_py = color_yellow |
71 | 70 | color_gmt = "white" |
72 | 71 |
|
73 | | - |
74 | 72 | # ----------------------------------------------------------------------------- |
75 | 73 | # Not-changebale settings (-> need to extended) |
76 | 74 | # ----------------------------------------------------------------------------- |
|
83 | 81 | pen_yellow = f"5p,{color_yellow}" |
84 | 82 | pen_red = f"10p,{color_red}" |
85 | 83 |
|
86 | | - |
87 | 84 | # %% |
88 | 85 |
|
89 | 86 | # ----------------------------------------------------------------------------- |
|
102 | 99 | # ............................................................................. |
103 | 100 | match shape: |
104 | 101 | case "circle": |
105 | | - style = "c7.5c" |
| 102 | + diameter = 7.5 |
| 103 | + diameter_add = 0.5 |
| 104 | + symbol = "c" |
106 | 105 | case "hexagon": |
107 | | - style = "h8.6c" |
108 | | -fig.plot(x=0, y=0, style=style, pen=f"15p,{color_blue}", fill=color_bg, no_clip=True) |
| 106 | + diameter = 8.6 |
| 107 | + diameter_add = 0.6 |
| 108 | + symbol = "h" |
| 109 | +fig.plot( |
| 110 | + x=0, |
| 111 | + y=0, |
| 112 | + style=f"{symbol}{diameter}c", |
| 113 | + pen=f"15p,{color_blue}", |
| 114 | + fill=color_bg, |
| 115 | + no_clip=True, |
| 116 | +) |
109 | 117 |
|
110 | 118 | # ............................................................................. |
111 | 119 | # yellow lines for compass |
|
140 | 148 | # upper vertical red line |
141 | 149 | # ............................................................................. |
142 | 150 | # space between red line and blue circle / hexagon |
143 | | -fig.plot(x=[0, 0], y=[4.01, 3.0], pen=f"18p,{color_bg}") |
| 151 | +fig.plot(x=[0, 0], y=[4, 3.0], pen=f"18p,{color_bg}") |
144 | 152 | # red line |
145 | | -fig.plot(x=[0, 0], y=[4.00, 1.9], pen=f"12p,{color_red}") |
| 153 | +fig.plot(x=[0, 0], y=[4, 1.9], pen=f"12p,{color_red}") |
146 | 154 |
|
147 | 155 | # ............................................................................. |
148 | 156 | # letter M |
|
172 | 180 | # arrow tail |
173 | 181 | fig.plot(x=[0, 0], y=[-2, -3.57], pen=f"12p,{color_red}") |
174 | 182 |
|
| 183 | +# margin around shape with slight overplotting for clean borders |
| 184 | +color_margin = color_bg |
| 185 | +if color_concept == "color" and bg_transparent and not wordmark: |
| 186 | + color_margin = "white" |
| 187 | +fig.plot( |
| 188 | + x=0, |
| 189 | + y=0, |
| 190 | + style=f"{symbol}{diameter + diameter_add}c", |
| 191 | + pen=f"1p,{color_margin}", |
| 192 | + no_clip=True, |
| 193 | +) |
| 194 | + |
175 | 195 | # ............................................................................. |
176 | 196 | # Save |
177 | 197 | # ............................................................................. |
178 | 198 | fig.show() |
179 | 199 | fig_name = f"pygmt_logo_{shape}_{color_concept}_{bg_concept}" |
180 | 200 | fig.savefig(fname=f"{fig_name}.eps") |
181 | | -# fig.savefig(fname=f"{fig_name}.png", dpi=dpi_png, transparent=True) |
182 | 201 | print(fig_name) |
183 | 202 |
|
184 | | - |
185 | 203 | # %% |
186 | 204 |
|
187 | 205 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
191 | 209 | pygmt.config(MAP_FRAME_PEN="cyan@100") |
192 | 210 |
|
193 | 211 | bg_alpha = 100 if bg_transparent is True else 0 |
194 | | -fig.basemap( |
195 | | - region=region, projection=f"X{(size + 0.1) * 2}c", frame=f"+g{color_bg}@{bg_alpha}" |
196 | | -) |
| 212 | +fig.basemap(region=region, projection=f"X{size * 2}c", frame=f"+g{color_bg}@{bg_alpha}") |
197 | 213 |
|
198 | 214 | fig.image( |
199 | 215 | imagefile=f"{fig_name}.eps", |
|
216 | 232 | fig.savefig(fname=f"{fig_name_rot}.{ext}", dpi=dpi_png, transparent=transparent) |
217 | 233 | print(fig_name_rot) |
218 | 234 |
|
219 | | - |
220 | 235 | # %% |
221 | 236 |
|
222 | 237 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
261 | 276 | print(fig_name_rot_text) |
262 | 277 | Path.unlink(f"{fig_name_rot}.eps") |
263 | 278 |
|
264 | | - |
265 | 279 | # %% |
266 | 280 | fig.show() |
267 | 281 | Path.unlink(f"{fig_name}.eps") |
0 commit comments