Files
jupyter-collection/scientific-computing-2/auto_examples_jupyter_2/plot_subplot-grid.ipynb
2025-10-21 11:20:44 +08:00

43 lines
1.5 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n# Subplot grid\n\nAn example showing the subplot grid in matplotlib.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n\nplt.figure(figsize=(6, 4))\nplt.subplot(2, 2, 1)\nplt.xticks([])\nplt.yticks([])\nplt.text(0.5, 0.5, \"subplot(2,2,1)\", ha=\"center\", va=\"center\", size=20, alpha=0.5)\n\nplt.subplot(2, 2, 2)\nplt.xticks([])\nplt.yticks([])\nplt.text(0.5, 0.5, \"subplot(2,2,2)\", ha=\"center\", va=\"center\", size=20, alpha=0.5)\n\nplt.subplot(2, 2, 3)\nplt.xticks([])\nplt.yticks([])\n\nplt.text(0.5, 0.5, \"subplot(2,2,3)\", ha=\"center\", va=\"center\", size=20, alpha=0.5)\n\nplt.subplot(2, 2, 4)\nplt.xticks([])\nplt.yticks([])\nplt.text(0.5, 0.5, \"subplot(2,2,4)\", ha=\"center\", va=\"center\", size=20, alpha=0.5)\n\nplt.tight_layout()\nplt.show()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.11"
}
},
"nbformat": 4,
"nbformat_minor": 0
}