{"id":4274,"date":"2025-01-02T06:32:00","date_gmt":"2025-01-01T21:32:00","guid":{"rendered":"https:\/\/secondlife.lol\/?p=4274"},"modified":"2025-01-01T18:43:22","modified_gmt":"2025-01-01T09:43:22","slug":"death-toll-pyramid-python-visualization","status":"publish","type":"post","link":"https:\/\/secondlife.lol\/en\/death-toll-pyramid-python-visualization\/","title":{"rendered":"Population Pyramid Graphs in Python: Analyzing Deaths by Age in 2023 Data"},"content":{"rendered":"<style>.kb-image4274_d6314e-27 .kb-image-has-overlay:after{opacity:0.3;border-top-left-radius:5px;border-top-right-radius:5px;border-bottom-right-radius:5px;border-bottom-left-radius:5px;}.kb-image4274_d6314e-27 img.kb-img, .kb-image4274_d6314e-27 .kb-img img{border-top-left-radius:5px;border-top-right-radius:5px;border-bottom-right-radius:5px;border-bottom-left-radius:5px;box-shadow:0px 0px 14px 0px rgba(0, 0, 0, 0.2);}<\/style>\n<div class=\"wp-block-kadence-image kb-image4274_d6314e-27\"><figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"1200\" height=\"640\" src=\"https:\/\/secondlife.lol\/wp-content\/uploads\/2025\/01\/\uc778\uad6c-\ud53c\ub77c\ubbf8\ub4dc-\uadf8\ub798\ud504-\uc774\ubbf8\uc9c0.jpg\" alt=\"\uc778\uad6c \ud53c\ub77c\ubbf8\ub4dc \uadf8\ub798\ud504 \ud615\uc2dd\uc758 \ub0a8\ub140 \uc5f0\ub839\ubcc4 \uc0ac\ub9dd\uc8fc \uc218 \uc774\ubbf8\uc9c0\" class=\"kb-img wp-image-4277\" srcset=\"https:\/\/secondlife.lol\/wp-content\/uploads\/2025\/01\/\uc778\uad6c-\ud53c\ub77c\ubbf8\ub4dc-\uadf8\ub798\ud504-\uc774\ubbf8\uc9c0.jpg 1200w, https:\/\/secondlife.lol\/wp-content\/uploads\/2025\/01\/\uc778\uad6c-\ud53c\ub77c\ubbf8\ub4dc-\uadf8\ub798\ud504-\uc774\ubbf8\uc9c0-300x160.jpg 300w, https:\/\/secondlife.lol\/wp-content\/uploads\/2025\/01\/\uc778\uad6c-\ud53c\ub77c\ubbf8\ub4dc-\uadf8\ub798\ud504-\uc774\ubbf8\uc9c0-600x320.jpg 600w, https:\/\/secondlife.lol\/wp-content\/uploads\/2025\/01\/\uc778\uad6c-\ud53c\ub77c\ubbf8\ub4dc-\uadf8\ub798\ud504-\uc774\ubbf8\uc9c0-768x410.jpg 768w, https:\/\/secondlife.lol\/wp-content\/uploads\/2025\/01\/\uc778\uad6c-\ud53c\ub77c\ubbf8\ub4dc-\uadf8\ub798\ud504-\uc774\ubbf8\uc9c0-18x10.jpg 18w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><figcaption>( \uc778\uad6c \ud53c\ub77c\ubbf8\ub4dc \uadf8\ub798\ud504 \ud615\uc2dd\uc758 \ub0a8\ub140 \uc5f0\ub839\ubcc4 \uc0ac\ub9dd\uc790 \uc218 \uc774\ubbf8\uc9c0)<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">\uc778\uad6c \ud1b5\uacc4 \ub370\uc774\ud130\ub97c \uc2dc\uac01\ud654\ud560 \ub54c \ub370\uc774\ud130 \ub808\uc774\ube14\uc744 \ucd94\uac00\ud558\uba74 \uc815\ubcf4\uc758 \uc815\ud655\uc131\uacfc \uac00\ub3c5\uc131\uc774 \ud06c\uac8c \ud5a5\uc0c1\ub429\ub2c8\ub2e4. \uc624\ub298\uc740 \uc778\uad6c \ud53c\ub77c\ubbf8\ub4dc \uadf8\ub798\ud504\uc5d0 \ub370\uc774\ud130 \ub808\uc774\ube14\uc744 \ud3ec\ud568\ud558\uc5ec 2023\ub144 \uc5f0\ub839\ubcc4 \uc0ac\ub9dd\uc790 \uc218\ub97c \uc2dc\uac01\ud654\ud558\ub294 \ubc29\ubc95\uc744 \uc54c\uc544\ubcf4\uaca0\uc2b5\ub2c8\ub2e4.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\ub370\uc774\ud130 \uac1c\uc694<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\uc704 \ud30c\uc774\uc36c \uc2dc\uac01\ud654 \uadf8\ub798\ud504\uc758 \uae30\ucd08 \ub370\uc774\ud130\ub294 &#8217;24\ub144 2\uc6d4\uc5d0 \ud1b5\uacc4\uccad\uc5d0\uc11c \ubc1c\ud45c\ud55c <a href=\"https:\/\/www.kostat.go.kr\/board.es?mid=a10301010000&amp;bid=204&amp;act=view&amp;list_no=429586\" target=\"_blank\" rel=\"noopener\">2023\ub144 \ucd9c\uc0dd\u00b7\uc0ac\ub9dd\ud1b5\uacc4(\uc7a0\uc815)<\/a>\uc5d0 \uadfc\uac70\ud558\uace0 \uc788\uc2b5\ub2c8\ub2e4. \ud574\ub2f9 \ub370\uc774\ud130\ub97c \ud45c\ud615\ud0dc\ub85c \uc815\ub9ac\ud574\ubcf4\uba74 \uc544\ub798\uc640 \uac19\uc2b5\ub2c8\ub2e4. \uc0ac\ub9dd\uc790 \uc218 \ub2e8\uc704\ub294 \ucc9c\uba85\uc785\ub2c8\ub2e4.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th class=\"has-text-align-center\" data-align=\"center\">\uc5f0\ub839 \uadf8\ub8f9<\/th><th class=\"has-text-align-center\" data-align=\"center\">\ub0a8\uc131 \uc0ac\ub9dd\uc790 \uc218<\/th><th class=\"has-text-align-center\" data-align=\"center\">\uc5ec\uc131 \uc0ac\ub9dd\uc790 \uc218<\/th><\/tr><\/thead><tbody><tr><td class=\"has-text-align-center\" data-align=\"center\">90+<\/td><td class=\"has-text-align-center\" data-align=\"center\">15.3<\/td><td class=\"has-text-align-center\" data-align=\"center\">42.1<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">80-89<\/td><td class=\"has-text-align-center\" data-align=\"center\">63.5<\/td><td class=\"has-text-align-center\" data-align=\"center\">69.6<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">70-79<\/td><td class=\"has-text-align-center\" data-align=\"center\">45.5<\/td><td class=\"has-text-align-center\" data-align=\"center\">24.6<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">60-69<\/td><td class=\"has-text-align-center\" data-align=\"center\">34.3<\/td><td class=\"has-text-align-center\" data-align=\"center\">13.2<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">50-59<\/td><td class=\"has-text-align-center\" data-align=\"center\">18.0<\/td><td class=\"has-text-align-center\" data-align=\"center\">7.2<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">40-49<\/td><td class=\"has-text-align-center\" data-align=\"center\">7.0<\/td><td class=\"has-text-align-center\" data-align=\"center\">3.8<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">30-39<\/td><td class=\"has-text-align-center\" data-align=\"center\">2.8<\/td><td class=\"has-text-align-center\" data-align=\"center\">1.5<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">20-29<\/td><td class=\"has-text-align-center\" data-align=\"center\">1.7<\/td><td class=\"has-text-align-center\" data-align=\"center\">0.9<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">10-19<\/td><td class=\"has-text-align-center\" data-align=\"center\">0.4<\/td><td class=\"has-text-align-center\" data-align=\"center\">0.4<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">1-9<\/td><td class=\"has-text-align-center\" data-align=\"center\">0.2<\/td><td class=\"has-text-align-center\" data-align=\"center\">0.1<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">0-<\/td><td class=\"has-text-align-center\" data-align=\"center\">0.3<\/td><td class=\"has-text-align-center\" data-align=\"center\">0.3<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n<style>.kb-image4274_f1d854-27 .kb-image-has-overlay:after{opacity:0.3;border-top-left-radius:5px;border-top-right-radius:5px;border-bottom-right-radius:5px;border-bottom-left-radius:5px;}.kb-image4274_f1d854-27 img.kb-img, .kb-image4274_f1d854-27 .kb-img img{border-top-left-radius:5px;border-top-right-radius:5px;border-bottom-right-radius:5px;border-bottom-left-radius:5px;box-shadow:0px 0px 14px 0px rgba(0, 0, 0, 0.2);}<\/style>\n<div class=\"wp-block-kadence-image kb-image4274_f1d854-27\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"600\" height=\"551\" src=\"https:\/\/secondlife.lol\/wp-content\/uploads\/2025\/01\/image-600x551.jpg\" alt=\"\ub0a8\ub140 \uc5f0\ub839\ubcc4 \uc0ac\ub9dd\uc790 \uc218 \uae30\ubc18 \uc778\uad6c \ud53c\ub77c\ubbf8\ub4dc \uadf8\ub798\ud504 \uc774\ubbf8\uc9c0\" class=\"kb-img wp-image-4278\" srcset=\"https:\/\/secondlife.lol\/wp-content\/uploads\/2025\/01\/image-600x551.jpg 600w, https:\/\/secondlife.lol\/wp-content\/uploads\/2025\/01\/image-300x276.jpg 300w, https:\/\/secondlife.lol\/wp-content\/uploads\/2025\/01\/image-768x706.jpg 768w, https:\/\/secondlife.lol\/wp-content\/uploads\/2025\/01\/image-13x12.jpg 13w, https:\/\/secondlife.lol\/wp-content\/uploads\/2025\/01\/image.jpg 1125w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/><figcaption>(\ud1b5\uacc4\uce35 \uc790\ub8cc\uc5d0\uc11c \ubc1c\ucdcc\ud55c \uc778\uad6c \ud53c\ub77c\ubbf8\ub4dc \uadf8\ub798\ud504 \uc774\ubbf8\uc9c0 )<\/figcaption><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">\uc704 \ud14c\uc774\ube14\uc5d0\uc11c \ub098\ud0c0\ub09c 2023\ub144 \uc5f0\ub839\ubcc4 \uc0ac\ub9dd\uc790 \uc218 \ub370\uc774\ud130\ub97c \uc778\uad6c \ud53c\ub77c\ubbf8\ub4dc \uadf8\ub798\ud504\ub85c \ud45c\ud604\ud558\uba74\uc11c, \uac01 \uc5f0\ub839\ub300\ubcc4 \uc815\ud655\ud55c \uc218\uce58\ub97c \ub370\uc774\ud130 \ub808\uc774\ube14\ub85c \ud45c\uc2dc\ud558\uc5ec \ub354\uc6b1 \uc0c1\uc138\ud55c \uc815\ubcf4\ub97c \uc81c\uacf5\ud558\uaca0\uc2b5\ub2c8\ub2e4.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\ud30c\uc774\uc36c \uc2dc\uac01\ud654 \ucf54\ub4dc \uad6c\ud604<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>import numpy as np\nimport matplotlib.pyplot as plt\n\n# \ub370\uc774\ud130 \uc900\ube44\nage_groups = &#91;'90+', '80-89', '70-79', '60-69', '50-59', '40-49', \n              '30-39', '20-29', '10-19', '1-9', '0-']\nmale_deaths = &#91;15.3, 63.5, 45.5, 34.3, 18.0, 7.0, 2.8, 1.7, 0.4, 0.2, 0.3]\nfemale_deaths = &#91;42.1, 69.6, 24.6, 13.2, 7.2, 3.8, 1.5, 0.9, 0.4, 0.1, 0.3]\n\n# GridSpec\uc744 \uc0ac\uc6a9\ud558\uc5ec \uadf8\ub9bc \uc0dd\uc131\nfig = plt.figure(figsize=(15, 8))\ngs = fig.add_gridspec(1, 3, width_ratios=&#91;4, 0.01, 4])  # \uc911\uc559 \uc5f4\uc758 \ube44\uc728\uc744 0.01\ub85c \uc124\uc815\n\n# \uc138 \uac1c\uc758 \uc11c\ube0c\ud50c\ub86f \uc0dd\uc131\nax_left = fig.add_subplot(gs&#91;0])\nax_center = fig.add_subplot(gs&#91;1])\nax_right = fig.add_subplot(gs&#91;2])\n\ny_pos = np.arange(len(age_groups))\n\n# \uc67c\ucabd \ud50c\ub86f (\ub0a8\uc131)\nmale_bars = ax_left.barh(y_pos, -np.array(male_deaths), align='center', \n                        color='#5AB1EF', height=0.7)\n\n# \uc624\ub978\ucabd \ud50c\ub86f (\uc5ec\uc131)\nfemale_bars = ax_right.barh(y_pos, female_deaths, align='center',\n                           color='#FFB848', height=0.7)\n\n# \ub370\uc774\ud130 \ub808\uc774\ube14 \ucd94\uac00\ndef add_labels(ax, bars):\n    for bar in bars:\n        width = bar.get_width()\n        x = width\n        value = abs(width)\n        ax.text(x, bar.get_y() + bar.get_height()\/2, f'{value}',\n                ha='right' if width &lt; 0 else 'left',\n                va='center',\n                fontsize=9,\n                fontweight='bold',\n                color='black',\n                bbox=dict(pad=0.4, facecolor='none', edgecolor='none'))\n\nadd_labels(ax_left, male_bars)\nadd_labels(ax_right, female_bars)\n\n# \uc911\uc559 \ud50c\ub86f (\uc5f0\ub839 \uadf8\ub8f9)\nax_center.set_yticks(y_pos)\nax_center.tick_params(axis='y', length=0)\n# \uc5f0\ub839 \ub808\uc774\ube14 \uac00\uc6b4\ub370 \uc815\ub82c\nax_center.set_yticklabels(age_groups, ha='center')\n\n# \uc911\uc559 \uc5f4\uc758 \uc2a4\ud0c0\uc77c \uc124\uc815\nax_center.set_xlim(-0.5, 0.5)  # x\ucd95 \ubc94\uc704\ub97c \uc904\uc5ec\uc11c \ub808\uc774\ube14\uc774 \ub354 \uac00\uc6b4\ub370\uc5d0 \uc624\ub3c4\ub85d \uc870\uc815\nax_center.set_xticks(&#91;])\nfor spine in ax_center.spines.values():\n    spine.set_visible(False)\n\n# \uc67c\ucabd\uacfc \uc624\ub978\ucabd \ud50c\ub86f\uc758 \uc2a4\ud0c0\uc77c \uc124\uc815\nfor ax in &#91;ax_left, ax_right]:\n    ax.grid(axis='x', linestyle='-', alpha=0.1)\n    ax.set_yticks(&#91;])\n    ax.spines&#91;'top'].set_visible(False)\n    ax.spines&#91;'right'].set_visible(False)\n    \n# x\ucd95 \ubc94\uc704 \uc124\uc815\nmax_value = max(max(male_deaths), max(female_deaths))\nax_left.set_xlim(-max_value*1.1, 0)\nax_right.set_xlim(0, max_value*1.1)\n\n# \ucd95 \ub808\uc774\ube14 \ucd94\uac00\nax_left.set_xlabel('Number of Deaths (thousands)', ha='right')\nax_right.set_xlabel('Number of Deaths (thousands)', ha='left')\n\n# \ub0a8\uc131\/\uc5ec\uc131 \ub808\uc774\ube14 \ucd94\uac00\nax_left.text(-max_value\/2, len(age_groups), 'Male', ha='center', va='bottom', fontsize=12)\nax_right.text(max_value\/2, len(age_groups), 'Female', ha='center', va='bottom', fontsize=12)\n\n# x\ucd95 \ub208\uae08 \ud3ec\ub9f7 \uc124\uc815\ndef format_ticks(x, p):\n    return f'{abs(x)}'\nax_left.xaxis.set_major_formatter(plt.FuncFormatter(format_ticks))\nax_right.xaxis.set_major_formatter(plt.FuncFormatter(format_ticks))\n\n# \uadf8\ub798\ud504 \uc81c\ubaa9 \ucd94\uac00\nfig.suptitle('Age-Specific Mortality by Gender', y=0.95, fontsize=14)\n\nplt.tight_layout()\nplt.subplots_adjust(top=0.9)  # \uc81c\ubaa9\uc744 \uc704\ud55c \uc5ec\ubc31 \uc870\uc815\nplt.show()<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\uc2ec\uce35 \ub370\uc774\ud130 \ubd84\uc11d \uc778\uc0ac\uc774\ud2b8<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">1. <strong>\uc5f0\ub839\ub300\ubcc4 \uc0ac\ub9dd\ub960 \uaca9\ucc28<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>80-89\uc138 \uad6c\uac04: \ub0a8\uc131(63.5\ucc9c \uba85), \uc5ec\uc131(69.6\ucc9c \uba85)\uc73c\ub85c \ucd5c\uace0\uc810<\/li>\n\n\n\n<li>70\ub300 \uc774\ud558\uc5d0\uc11c\ub294 \uc804\ubc18\uc801\uc73c\ub85c \ub0a8\uc131 \uc0ac\ub9dd\ub960\uc774 \ub192\uc74c<\/li>\n\n\n\n<li>\uc5f0\ub839 \uc99d\uac00\uc5d0 \ub530\ub978 \uc131\ubcc4 \uaca9\ucc28 \ud328\ud134 \ubcc0\ud654 \uad00\ucc30<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">2. <strong>\uc0dd\uc560\uc8fc\uae30\ubcc4 \ud2b9\uc9d5<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\uc601\uc720\uc544\uae30(0\uc138): \ub0a8\ub140 \ub3d9\uc77c\ud55c \uc0ac\ub9dd\ub960(0.3\ucc9c \uba85)<\/li>\n\n\n\n<li>\uccad\uc7a5\ub144\uce35(20-49\uc138): \ub0a8\uc131 \uc0ac\ub9dd\ub960\uc774 \uc5ec\uc131\uc758 \uc57d 2\ubc30<\/li>\n\n\n\n<li>\ub178\ub144\uce35(80\uc138 \uc774\uc0c1): \uc5ec\uc131 \uc0ac\ub9dd\ub960 \uae09\uc99d<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">3. <strong>\uc815\ucc45\uc801 \uc2dc\uc0ac\uc810<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\uc131\ubcc4\u00b7\uc5f0\ub839\ubcc4 \ub9de\ucda4\ud615 \ubcf4\uac74\uc758\ub8cc \uc815\ucc45 \ud544\uc694\uc131<\/li>\n\n\n\n<li>\uace0\ub839\uce35 \uc5ec\uc131 \ub300\uc0c1 \uc758\ub8cc\uc11c\ube44\uc2a4 \ud655\ucda9 \uc694\uad6c<\/li>\n\n\n\n<li>\uc911\ub144 \ub0a8\uc131 \uc0ac\ub9dd\ub960 \uac10\uc18c\ub97c \uc704\ud55c \uc608\ubc29\uc758\ub8cc \uac15\ud654<\/li>\n<\/ul>\n\n\n<style>.kb-image4274_3457ec-f3 .kb-image-has-overlay:after{opacity:0.3;border-top-left-radius:5px;border-top-right-radius:5px;border-bottom-right-radius:5px;border-bottom-left-radius:5px;}.kb-image4274_3457ec-f3 img.kb-img, .kb-image4274_3457ec-f3 .kb-img img{border-top-left-radius:5px;border-top-right-radius:5px;border-bottom-right-radius:5px;border-bottom-left-radius:5px;box-shadow:0px 0px 14px 0px rgba(0, 0, 0, 0.2);}<\/style>\n<div class=\"wp-block-kadence-image kb-image4274_3457ec-f3\"><figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"626\" height=\"362\" src=\"https:\/\/secondlife.lol\/wp-content\/uploads\/2025\/01\/image-1.png\" alt=\"\" class=\"kb-img wp-image-4283\" srcset=\"https:\/\/secondlife.lol\/wp-content\/uploads\/2025\/01\/image-1.png 626w, https:\/\/secondlife.lol\/wp-content\/uploads\/2025\/01\/image-1-300x173.png 300w, https:\/\/secondlife.lol\/wp-content\/uploads\/2025\/01\/image-1-600x347.png 600w, https:\/\/secondlife.lol\/wp-content\/uploads\/2025\/01\/image-1-18x10.png 18w\" sizes=\"(max-width: 626px) 100vw, 626px\" \/><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">\ub9c8\ubb34\ub9ac<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\ub370\uc774\ud130 \ub808\uc774\ube14\uc774 \ud3ec\ud568\ub41c \uc778\uad6c \ud53c\ub77c\ubbf8\ub4dc \uadf8\ub798\ud504\ub294 \uc5f0\ub839\ubcc4 \uc0ac\ub9dd\uc790 \uc218\uc758 \uc815\ud655\ud55c \uc218\uce58\ub97c \uc9c1\uad00\uc801\uc73c\ub85c \ud30c\uc545\ud560 \uc218 \uc788\uac8c \ud574\uc90d\ub2c8\ub2e4. \uc774\ub7ec\ud55c \uc2dc\uac01\ud654\ub294 \uc778\uad6c\ud1b5\uacc4 \ubd84\uc11d\uacfc \ubcf4\uac74\uc758\ub8cc \uc815\ucc45 \uc218\ub9bd\uc5d0 \uc911\uc694\ud55c \uae30\ucd08\uc790\ub8cc\ub85c \ud65c\uc6a9\ub420 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \ucf54\ub4dc \uc0c1\uc138 \ud574\uc124\uc740 \uc544\ub798\uc758 \ub0b4\uc6a9\uc744 \ucc38\uace0\ud574\uc8fc\uc138\uc694.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\ud639\uc2dc, \uc0ac\ub9dd\uc790 \uc218\uc640 \ub300\ucc99\uc810\uc5d0 \uc788\ub294 \uac1c\ub150\uc778 \ud569\uacc4\ucd9c\uc0b0\uc728\uc5d0 \ub300\ud55c \uc815\ubcf4\ub97c \uc54c\uace0 \uc2f6\uc73c\uc2e0 \ubd84\uc740 <a href=\"https:\/\/secondlife.lol\/total-fertility-rate-r-trendy-visualization\/\" data-type=\"post\" data-id=\"4187\">\ud569\uacc4\ucd9c\uc0b0\uc728 \ub73b\uacfc \uacc4\uc0b0\ubc95: R\ub85c \ud2b8\ub80c\ub514\ud55c \uc2dc\uac01\ud654\uae4c\uc9c0<\/a> \ud3ec\uc2a4\ud2b8\ub97c \ucc38\uace0\ud574 \ubcf4\uc2dc\uae30 \ubc14\ub78d\ub2c8\ub2e4.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"># \ucf54\ub4dc \uc0c1\uc138\ud574\uc124<\/h3>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<h5 class=\"wp-block-heading\">1. \ud544\uc694\ud55c \ub77c\uc774\ube0c\ub7ec\ub9ac \uc784\ud3ec\ud2b8<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>import numpy as np\nimport matplotlib.pyplot as plt<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>numpy<\/code>: \uc218\uce58 \uacc4\uc0b0\uc744 \uc704\ud55c \ub77c\uc774\ube0c\ub7ec\ub9ac<\/li>\n\n\n\n<li><code>matplotlib.pyplot<\/code>: \uadf8\ub798\ud504 \uc0dd\uc131\uc744 \uc704\ud55c \ub77c\uc774\ube0c\ub7ec\ub9ac<\/li>\n<\/ul>\n\n\n\n<h5 class=\"wp-block-heading\">2. \ub370\uc774\ud130 \uc900\ube44<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>age_groups = &#91;'90+', '80-89', '70-79', '60-69', '50-59', '40-49', \n              '30-39', '20-29', '10-19', '1-9', '0-']\nmale_deaths = &#91;15.3, 63.5, 45.5, 34.3, 18.0, 7.0, 2.8, 1.7, 0.4, 0.2, 0.3]\nfemale_deaths = &#91;42.1, 69.6, 24.6, 13.2, 7.2, 3.8, 1.5, 0.9, 0.4, 0.1, 0.3]<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\uc5f0\ub839 \uadf8\ub8f9\uacfc \uac01 \uc131\ubcc4\uc758 \uc0ac\ub9dd\uc790 \uc218 \ub370\uc774\ud130\ub97c \ub9ac\uc2a4\ud2b8\ub85c \uc815\uc758\ud569\ub2c8\ub2e4.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">3. \uadf8\ub798\ud504 \uad6c\uc870 \uc124\uc815<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>fig = plt.figure(figsize=(15, 8))\ngs = fig.add_gridspec(1, 3, width_ratios=&#91;4, 0.01, 4])<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>figsize=(15, 8)<\/code>: \uadf8\ub798\ud504\uc758 \uc804\uccb4 \ud06c\uae30\ub97c \uc124\uc815 (\uac00\ub85c 15, \uc138\ub85c 8)<\/li>\n\n\n\n<li><code>add_gridspec<\/code>: \uadf8\ub798\ud504\ub97c 3\uac1c\uc758 \uc5f4\ub85c \ub098\ub214. \ube44\uc728\uc740 [4, 0.01, 4]\ub85c \uc124\uc815\ud558\uc5ec \uc911\uc559 \uc5f4\uc744 \ub9e4\uc6b0 \uc881\uac8c \ub9cc\ub4e6<\/li>\n<\/ul>\n\n\n\n<h5 class=\"wp-block-heading\">4. \uc11c\ube0c\ud50c\ub86f \uc0dd\uc131<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>ax_left = fig.add_subplot(gs&#91;0])\nax_center = fig.add_subplot(gs&#91;1])\nax_right = fig.add_subplot(gs&#91;2])<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">3\uac1c\uc758 \uc11c\ube0c\ud50c\ub86f(\uc67c\ucabd, \uc911\uc559, \uc624\ub978\ucabd)\uc744 \uc0dd\uc131\ud569\ub2c8\ub2e4.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">5. \ub9c9\ub300 \uadf8\ub798\ud504 \uadf8\ub9ac\uae30<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>y_pos = np.arange(len(age_groups))\n\nmale_bars = ax_left.barh(y_pos, -np.array(male_deaths), align='center', \n                        color='#5AB1EF', height=0.7)\nfemale_bars = ax_right.barh(y_pos, female_deaths, align='center',\n                           color='#FFB848', height=0.7)<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>barh<\/code>: \uc218\ud3c9 \ub9c9\ub300 \uadf8\ub798\ud504\ub97c \uadf8\ub9ac\ub294 \ud568\uc218<\/li>\n\n\n\n<li>\ub0a8\uc131 \ub370\uc774\ud130\ub294 \uc74c\uc218\ub85c \ubcc0\ud658\ud558\uc5ec \uc67c\ucabd\uc5d0 \ud45c\uc2dc<\/li>\n\n\n\n<li>\uc5ec\uc131 \ub370\uc774\ud130\ub294 \uc624\ub978\ucabd\uc5d0 \ud45c\uc2dc<\/li>\n<\/ul>\n\n\n\n<h5 class=\"wp-block-heading\">6. \ub370\uc774\ud130 \ub808\uc774\ube14 \ucd94\uac00<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>def add_labels(ax, bars):\n    for bar in bars:\n        width = bar.get_width()\n        x = width\n        value = abs(width)\n        ax.text(x, bar.get_y() + bar.get_height()\/2, f'{value}',\n                ha='right' if width &lt; 0 else 'left',\n                va='center',\n                fontsize=9,\n                fontweight='bold',\n                color='black',\n                bbox=dict(pad=0.4, facecolor='none', edgecolor='none'))\n\nadd_labels(ax_left, male_bars)\nadd_labels(ax_right, female_bars)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\uac01 \ub9c9\ub300\uc5d0 \ud574\ub2f9\ud558\ub294 \uc218\uce58\ub97c \ub808\uc774\ube14\ub85c \ucd94\uac00\ud569\ub2c8\ub2e4.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">7. \uc911\uc559 \uc5f4 \uc2a4\ud0c0\uc77c \uc124\uc815<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>ax_center.set_yticks(y_pos)\nax_center.tick_params(axis='y', length=0)\nax_center.set_yticklabels(age_groups, ha='center')\nax_center.set_xlim(-0.5, 0.5)\nax_center.set_xticks(&#91;])\nfor spine in ax_center.spines.values():\n    spine.set_visible(False)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\uc911\uc559 \uc5f4\uc5d0 \uc5f0\ub839 \uadf8\ub8f9 \ub808\uc774\ube14\uc744 \ud45c\uc2dc\ud558\uace0, \ubd88\ud544\uc694\ud55c \ucd95\uacfc \ud14c\ub450\ub9ac\ub97c \uc81c\uac70\ud569\ub2c8\ub2e4.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">8. \uc67c\ucabd\uacfc \uc624\ub978\ucabd \ud50c\ub86f\uc758 \uc2a4\ud0c0\uc77c \uc124\uc815<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>for ax in &#91;ax_left, ax_right]:\n    ax.grid(axis='x', linestyle='-', alpha=0.1)\n    ax.set_yticks(&#91;])\n    ax.spines&#91;'top'].set_visible(False)\n    ax.spines&#91;'right'].set_visible(False)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\uc67c\ucabd\uacfc \uc624\ub978\ucabd \ud50c\ub86f\uc5d0 \uaca9\uc790\ub97c \ucd94\uac00\ud558\uace0, \ubd88\ud544\uc694\ud55c \ucd95\uc744 \uc81c\uac70\ud569\ub2c8\ub2e4.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">9. x\ucd95 \ubc94\uc704 \uc124\uc815 \ubc0f \ub808\uc774\ube14 \ucd94\uac00<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>max_value = max(max(male_deaths), max(female_deaths))\nax_left.set_xlim(-max_value*1.1, 0)\nax_right.set_xlim(0, max_value*1.1)\n\nax_left.set_xlabel('Number of Deaths (thousands)', ha='right')\nax_right.set_xlabel('Number of Deaths (thousands)', ha='left')\n\nax_left.text(-max_value\/2, len(age_groups), 'Male', ha='center', va='bottom', fontsize=12)\nax_right.text(max_value\/2, len(age_groups), 'Female', ha='center', va='bottom', fontsize=12)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">x\ucd95\uc758 \ubc94\uc704\ub97c \uc124\uc815\ud558\uace0, \ucd95 \ub808\uc774\ube14\uacfc \uc131\ubcc4 \ub808\uc774\ube14\uc744 \ucd94\uac00\ud569\ub2c8\ub2e4.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">10. x\ucd95 \ub208\uae08 \ud3ec\ub9f7 \uc124\uc815<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>def format_ticks(x, p):\n    return f'{abs(x)}'\nax_left.xaxis.set_major_formatter(plt.FuncFormatter(format_ticks))\nax_right.xaxis.set_major_formatter(plt.FuncFormatter(format_ticks))<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">x\ucd95 \ub208\uae08\uc758 \uac12\uc744 \uc808\ub300\uac12\uc73c\ub85c \ud45c\uc2dc\ud569\ub2c8\ub2e4.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">11. \uadf8\ub798\ud504 \ub9c8\ubb34\ub9ac<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>fig.suptitle('Age-Specific Mortality by Gender', y=0.95, fontsize=14)\nplt.tight_layout()\nplt.subplots_adjust(top=0.9)\nplt.show()<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\uadf8\ub798\ud504\uc5d0 \uc81c\ubaa9\uc744 \ucd94\uac00\ud558\uace0, \ub808\uc774\uc544\uc6c3\uc744 \uc870\uc815\ud55c \ud6c4 \uadf8\ub798\ud504\ub97c \ud45c\uc2dc\ud569\ub2c8\ub2e4.<\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>When visualizing demographic data, adding data labels can help you improve the accuracy of the information and...<\/p>","protected":false},"author":3,"featured_media":4279,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","footnotes":""},"categories":[3],"tags":[177,699,697],"class_list":["post-4274","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python-coding","tag-177","tag-699","tag-697"],"taxonomy_info":{"category":[{"value":3,"label":"\ud30c\uc774\uc36c(Python)"}],"post_tag":[{"value":177,"label":"\ub370\uc774\ud130 \ubd84\uc11d"},{"value":699,"label":"\uc0ac\ub9dd\uc790 \ud1b5\uacc4"},{"value":697,"label":"\uc778\uad6c \ud53c\ub77c\ubbf8\ub4dc"}]},"featured_image_src_large":["https:\/\/secondlife.lol\/wp-content\/uploads\/2025\/01\/\uc778\uad6c-\ud53c\ub77c\ubbf8\ub4dc-\uadf8\ub798\ud504-\ud3ec\uc2a4\ud2b8-\uc378\ub124\uc77c-600x600.jpg",600,600,true],"author_info":{"display_name":"TERE","author_link":"https:\/\/secondlife.lol\/en\/author\/tere\/"},"comment_info":0,"category_info":[{"term_id":3,"name":"\ud30c\uc774\uc36c(Python)","slug":"python-coding","term_group":0,"term_taxonomy_id":3,"taxonomy":"category","description":"","parent":20,"count":119,"filter":"raw","cat_ID":3,"category_count":119,"category_description":"","cat_name":"\ud30c\uc774\uc36c(Python)","category_nicename":"python-coding","category_parent":20}],"tag_info":[{"term_id":177,"name":"\ub370\uc774\ud130 \ubd84\uc11d","slug":"%eb%8d%b0%ec%9d%b4%ed%84%b0-%eb%b6%84%ec%84%9d","term_group":0,"term_taxonomy_id":177,"taxonomy":"post_tag","description":"","parent":0,"count":36,"filter":"raw"},{"term_id":699,"name":"\uc0ac\ub9dd\uc790 \ud1b5\uacc4","slug":"%ec%82%ac%eb%a7%9d%ec%9e%90-%ed%86%b5%ea%b3%84","term_group":0,"term_taxonomy_id":699,"taxonomy":"post_tag","description":"","parent":0,"count":1,"filter":"raw"},{"term_id":697,"name":"\uc778\uad6c \ud53c\ub77c\ubbf8\ub4dc","slug":"%ec%9d%b8%ea%b5%ac-%ed%94%bc%eb%9d%bc%eb%af%b8%eb%93%9c","term_group":0,"term_taxonomy_id":697,"taxonomy":"post_tag","description":"","parent":0,"count":1,"filter":"raw"}],"_links":{"self":[{"href":"https:\/\/secondlife.lol\/en\/wp-json\/wp\/v2\/posts\/4274","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/secondlife.lol\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/secondlife.lol\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/secondlife.lol\/en\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/secondlife.lol\/en\/wp-json\/wp\/v2\/comments?post=4274"}],"version-history":[{"count":5,"href":"https:\/\/secondlife.lol\/en\/wp-json\/wp\/v2\/posts\/4274\/revisions"}],"predecessor-version":[{"id":4286,"href":"https:\/\/secondlife.lol\/en\/wp-json\/wp\/v2\/posts\/4274\/revisions\/4286"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/secondlife.lol\/en\/wp-json\/wp\/v2\/media\/4279"}],"wp:attachment":[{"href":"https:\/\/secondlife.lol\/en\/wp-json\/wp\/v2\/media?parent=4274"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/secondlife.lol\/en\/wp-json\/wp\/v2\/categories?post=4274"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/secondlife.lol\/en\/wp-json\/wp\/v2\/tags?post=4274"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}