|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "code", |
| 5 | + "execution_count": null, |
| 6 | + "id": "6e246dd9-2315-4af5-a906-643f2adbef42", |
| 7 | + "metadata": {}, |
| 8 | + "outputs": [], |
| 9 | + "source": [ |
| 10 | + "import pygmt\n", |
| 11 | + "\n", |
| 12 | + "red, blue = \"238/86/52\", \"#4B8BBE\" # GMT red and Python blue\n", |
| 13 | + "\n", |
| 14 | + "fig = pygmt.Figure()\n", |
| 15 | + "fig.basemap(region=[-1, 16, -0.5, 8], projection=\"x1c\", frame=0)\n", |
| 16 | + "\n", |
| 17 | + "# Add the GMT part.\n", |
| 18 | + "fig.plot(x=[-0.5, 2.5, 2.5, -0.5], y=[0, 0, 6, 6], pen=f\"2p,{red}\", fill=f\"{red}@70\", close=True)\n", |
| 19 | + "fig.vlines(x=1, ymin=1, ymax=3, pen=\"1.5p,gray30\")\n", |
| 20 | + "fig.vlines(x=1, ymin=3, ymax=5, pen=\"1.5p,gray30\")\n", |
| 21 | + "fig.plot(x=[1.0] * 3, y=[1, 3, 5], style=\"R2.1c/1c/3p\", fill=red, pen=\"0.5p\")\n", |
| 22 | + "fig.text(\n", |
| 23 | + " x=[1.0] * 4,\n", |
| 24 | + " y=[1.25, 0.75, 3, 5],\n", |
| 25 | + " text=[\"GMT low-level\", \"library\", \"GMT C API\", \"GMT modules\"] ,\n", |
| 26 | + " font=\"8p,1,white\",\n", |
| 27 | + ")\n", |
| 28 | + "fig.logo(position=\"g1/6.95+jMC+w2.15c\")\n", |
| 29 | + "\n", |
| 30 | + "# Add the Python part.\n", |
| 31 | + "fig.plot(x=[7.5, 15.5, 15.5, 7.5], y=[0, 0, 6, 6], pen=f\"2p,{blue}\", fill=f\"{blue}@70\", close=True)\n", |
| 32 | + "for x, y in [\n", |
| 33 | + " ([10, 14], [1, 1]),\n", |
| 34 | + " ([10, 9], [1, 3]),\n", |
| 35 | + " ([9, 8.7], [3, 5]),\n", |
| 36 | + " ([9, 10.25], [3, 5]),\n", |
| 37 | + " ([10, 12], [1, 3]),\n", |
| 38 | + " ([12, 12], [3, 5]),\n", |
| 39 | + "]:\n", |
| 40 | + " fig.plot(x=x, y=y, pen=\"1.5p,gray30\")\n", |
| 41 | + "fig.plot(x=[10, 9, 12], y=[1, 3, 3], style=\"R2.0c/1c/3p\", fill=blue, pen=\"0.5p\")\n", |
| 42 | + "fig.plot(x=14, y=1, style=\"R2.0c/1c/3p\", fill=blue, pen=\"0.5p\")\n", |
| 43 | + "fig.text(\n", |
| 44 | + " x=[10, 9, 12, 14],\n", |
| 45 | + " y=[1, 3, 3, 1],\n", |
| 46 | + " text=[\"NumPy\", \"Xarray\", \"pandas\", \"PyArrow\"],\n", |
| 47 | + " font=\"8p,1,white\",\n", |
| 48 | + ")\n", |
| 49 | + "fig.text(\n", |
| 50 | + " x=[8.7, 10.25, 12],\n", |
| 51 | + " y=[5, 5, 5],\n", |
| 52 | + " text=[\"rioxarray\", \"contextily\", \"GeoPandas\"],\n", |
| 53 | + " font=\"8p,1,white\",\n", |
| 54 | + " fill=blue,\n", |
| 55 | + " pen=\"0.5p,-\",\n", |
| 56 | + " clearance=\"0.1c/0.1c+tO\",\n", |
| 57 | + ")\n", |
| 58 | + "fig.image(\n", |
| 59 | + " \"https://www.python.org/static/community_logos/python-logo-master-v3-TM.png\",\n", |
| 60 | + " position=\"g11.5/7+jMC+w4.5c\", # 7.5 + (15.5 - 7.5)\n", |
| 61 | + " bitcolor=\"white+t\",\n", |
| 62 | + ")\n", |
| 63 | + "\n", |
| 64 | + "# # Add the PyGMT part.\n", |
| 65 | + "fig.pygmtlogo(position=\"g5/2.65+jMC+w2c\", wordmark=\"vertical\")\n", |
| 66 | + "fig.plot(\n", |
| 67 | + " data=[[2.6, 3, 3.9, 3], [6.1, 3, 7.4, 3]],\n", |
| 68 | + " style=\"v0.35c+a40+s+b+e+h0+ggray30\",\n", |
| 69 | + " pen=\"2p,gray30\",\n", |
| 70 | + ")\n", |
| 71 | + "\n", |
| 72 | + "fig.show()\n", |
| 73 | + "fig.savefig(\"Fig2_PyGMT_ecosystem.png\")" |
| 74 | + ] |
| 75 | + } |
| 76 | + ], |
| 77 | + "metadata": { |
| 78 | + "kernelspec": { |
| 79 | + "display_name": "pygmt", |
| 80 | + "language": "python", |
| 81 | + "name": "python3" |
| 82 | + }, |
| 83 | + "language_info": { |
| 84 | + "codemirror_mode": { |
| 85 | + "name": "ipython", |
| 86 | + "version": 3 |
| 87 | + }, |
| 88 | + "file_extension": ".py", |
| 89 | + "mimetype": "text/x-python", |
| 90 | + "name": "python", |
| 91 | + "nbconvert_exporter": "python", |
| 92 | + "pygments_lexer": "ipython3", |
| 93 | + "version": "3.12.7" |
| 94 | + } |
| 95 | + }, |
| 96 | + "nbformat": 4, |
| 97 | + "nbformat_minor": 5 |
| 98 | +} |
0 commit comments