{"id":1907,"date":"2022-02-10T23:03:32","date_gmt":"2022-02-10T14:03:32","guid":{"rendered":"https:\/\/aiacademy.jp\/media\/?p=1907"},"modified":"2024-08-08T14:34:52","modified_gmt":"2024-08-08T05:34:52","slug":"%e3%80%90seaborn%e3%80%91seaborn%e3%81%a7%e6%95%a3%e5%b8%83%e5%9b%b3%e8%a1%8c%e5%88%97%e3%82%92%e6%8f%8f%e7%94%bb%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/aiacademy.jp\/media\/?p=1907","title":{"rendered":"\u3010seaborn\u3011seaborn\u3067\u6563\u5e03\u56f3\u884c\u5217\u3092\u63cf\u753b\u3059\u308b"},"content":{"rendered":"<div id=\"sgb-css-id-1\">\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button has-custom-font-size is-style-fill has-medium-font-size\"><a class=\"wp-block-button__link has-vivid-green-cyan-background-color has-background wp-element-button\" href=\"https:\/\/lin.ee\/3E4GzWk\" rel=\"nofollow noopener\" target=\"_blank\">LINE\u53cb\u3060\u3061\u767b\u9332 \u25b6 Python\u30b3\u30fc\u30b9 \u25b6 \u53d7\u8b1b\u5272\u5f15\u30af\u30fc\u30dd\u30f3 \u7121\u6599\u52d5\u753b<\/a><\/div>\n<\/div>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<div class=\"toc\">    <div id=\"toc_container\" class=\"sgb-toc--no-bullets js-smooth-scroll\" data-dialog-title=\"Table of Contents\">\n      <p class=\"toc_title\">\u76ee\u6b21 <\/p>\n      <ul class=\"toc_list\">  <li class=\"first\">    <span><\/span>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-0\">Seaborn\u3068\u306f<\/a>      <\/li>      <li>        <a href=\"#i-1\">Seaborn\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-2\">\u6563\u5e03\u56f3\u884c\u5217<\/a>      <\/li>    <\/ul>  <\/li>  <li class=\"last\">    <a href=\"#i-3\">Python\u3092\u52b9\u7387\u3088\u304f\u5b66\u3076\u306b\u306f\uff1f<\/a>  <\/li><\/ul>\n      \n    <\/div><\/div><div class=\"toc\"><p><\/p>\n<\/div><h2 class=\"wp-block-heading\" id=\"i-0\">Seaborn\u3068\u306f<\/h2>\n\n\n\n<p><strong>Seaborn (\u30b7\u30fc\u30dc\u30fc\u30f3) \u3068\u306f\u3001Python\u306e\u53ef\u8996\u5316\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u4e00\u3064\u3067\u3059\u3002<\/strong><\/p>\n\n\n\n<p>Seaborn\u306fMatplotlib\u306e\u6a5f\u80fd\u3092\u3088\u308a\u7f8e\u3057\u304f\u3001\u3088\u308a\u7c21\u5358\u306b\u5b9f\u73fe\u3059\u308b\u305f\u3081\u306e\u53ef\u8996\u5316\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3059\u3002<\/p>\n\n\n\n<p>Seaborn\u306e\u7279\u5fb4\u3068\u3057\u3066\u3001Matplotlib\u30d9\u30fc\u30b9\u3067\u4f5c\u3089\u308c\u3066\u3044\u308b\u305f\u3081\u3001\u6298\u308c\u7dda\u30b0\u30e9\u30d5\u3084\u68d2\u30b0\u30e9\u30d5\u3001\u6563\u5e03\u56f3\u306a\u3069\u306e\u57fa\u672c\u7684\u306a\u30b0\u30e9\u30d5\u63cf\u753b\u306fMatplotlib\u306e\u6a5f\u80fd\u3092\u5229\u7528\u3057\u3066\u3044\u308b\u3053\u3068\u304c\u6319\u3052\u3089\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p><a rel=\"noreferrer noopener nofollow\" href=\"https:\/\/seaborn.pydata.org\/\" target=\"_blank\">\u516c\u5f0f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/aiacademy.jp\/assets\/upload\/chapter_000141_btbIcxTpIYFq.png\" alt=\"\"><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-1\">Seaborn\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h2>\n\n\n\n<p>pip\u30b3\u30de\u30f3\u30c9\u3092\u7528\u3044\u305fSeaborn\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306f\u4e0b\u8a18\u306e\u30b3\u30de\u30f3\u30c9\u3092Mac\u306e\u65b9\u306f\u30bf\u30fc\u30df\u30ca\u30eb\u3001Windows\u306e\u65b9\u306f\u30b3\u30de\u30f3\u30c9\u30d7\u30ed\u30f3\u30d7\u30c8\u5834\u3067\u5b9f\u884c\u3059\u308b\u3053\u3068\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u304c\u51fa\u6765\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">pip install seaborn<\/pre>\n\n\n\n<p>\u554f\u984c\u3092\u5831\u544a\u3059\u308bJupyter Notebook\u3092\u304a\u4f7f\u3044\u306e\u65b9\u306f\u3001\u8d77\u52d5\u3057\u305fNotebook\u306e\u30bb\u30eb\u306b\u3001\u5148\u982d\u306b!\u30de\u30fc\u30af\u3092\u3064\u3051\u3066\u5b9f\u884c\u3059\u308b\u3053\u3068\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">!pip install seaborn<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-2\">\u6563\u5e03\u56f3\u884c\u5217<\/h2>\n\n\n\n<p>\u307e\u305a\u59cb\u3081\u306b\u3001Seaborn\u3067\u63cf\u753b\u3059\u308b\u305f\u3081\u306b\u3001Seaborn\u306e\u8aad\u307f\u8fbc\u307f\u3092\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">import seaborn as sns<\/pre>\n\n\n\n<p>\u554f\u984c\u3092\u5831\u544a\u3059\u308b\u4e0a\u8a18\u3067\u8aad\u307f\u8fbc\u3080\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002Seaborn\u3067\u306f\u3088\u304fsns\u3068\u3044\u3046\u540d\u524d\u3067\u8aad\u307f\u8fbc\u3080\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u306e\u3067\u3001sns\u3068\u3044\u3046\u5225\u540d\u3092\u3064\u3051\u3066\u304a\u308a\u307e\u3059\u3002\u307e\u305a\u306f\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3068\u3057\u3066\u3001Seaborn\u304c\u3042\u3089\u304b\u3058\u3081\u7528\u610f\u3057\u3066\u3042\u308b\u30c7\u30fc\u30bf\u3092\u4f7f\u3063\u3066\u53ef\u8996\u5316\u3092\u3057\u3066\u3044\u304d\u307e\u3059\u3002\u4eca\u56de\u306f\u30a2\u30a4\u30ea\u30b9\u30c7\u30fc\u30bf\u306b\u5bfe\u3057\u3066\u3001\u6563\u5e03\u56f3\u884c\u5217\u3067\u53ef\u8996\u5316\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u6563\u5e03\u56f3\u884c\u5217\u3068\u306f\u8907\u6570\u306e\u5909\u6570\u304c\u3042\u308b\u5834\u5408\u306b\u3001\u5168\u3066\u306e2\u5909\u6570\u540c\u58eb\u306e\u7d44\u307f\u5408\u308f\u305b\u306b\u5bfe\u3057\u3066\u6563\u5e03\u56f3\u3092\u4f5c\u6210\u3057\u3001\u884c\u5217\u306e\u5f62\u5f0f\u306b\u4e26\u3079\u305f\u3082\u306e\u3067\u3059\u3002\u6563\u5e03\u56f3\u884c\u5217\u306f\u3001\u8907\u6570\u306e\u5909\u6570\u306e\u76f8\u95a2\u95a2\u4fc2\u3092\u8996\u899a\u7684\u306b\u6349\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p>Seaborn\u3067\u6563\u5e03\u56f3\u884c\u5217\u3092\u53ef\u8996\u5316\u3059\u308b\u5834\u5408\u3001pairplot()\u3092\u7528\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import seaborn as sns # \u3053\u3061\u3089\u306b\u3082\u518d\u5ea6\u8a18\u8ff0\nimport numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\n\n# \u30a2\u30e4\u30e1\u306e\u30c7\u30fc\u30bf\u306e\u8aad\u307f\u8fbc\u307f \u203b\u5de6\u306eiris\u306f\u5909\u6570\u540d\u3067\u3001\u53f3\u5074\u306eiris\u306firis\u3068\u3044\u3046\u82b1\u306e\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u3092\u8aad\u307f\u8fbc\u3080\u8a2d\u5b9a\u3067\u3059\u3002\niris = sns.load_dataset(\"iris\")\n# \u30c7\u30fc\u30bf\u306b\u542b\u307e\u308c\u308b\u5168\u3066\u306e\u6570\u5024\u5909\u6570\u540c\u58eb\u3067\u306e\u6563\u5e03\u56f3\u3092\u63cf\u753b\n\n# \u4eca\u56de\u306firis\u3068\u3044\u3046\u5909\u6570\u3092\u6e21\u3057\u3066\u3044\u307e\u3059\u304c\u3001Pandas\u306e\u30c7\u30fc\u30bf\u30d5\u30ec\u30fc\u30e0(DataFrame)\u578b\u3092\u6e21\u3059\u3053\u3068\u3067\u3001\u6563\u5e03\u56f3\u884c\u5217\u3092\u63cf\u753b\u51fa\u6765\u307e\u3059\u3002\nsns.pairplot(iris) # \u6563\u5e03\u56f3\u884c\u5217\nplt.show()<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/qiita-image-store.s3.amazonaws.com\/0\/171715\/1a7fd2ea-1ef2-6055-62ea-cdb2660f03c2.png\" alt=\"\"><\/figure>\n\n\n\n<p>\u3061\u306a\u307f\u306b\u3001Pandas\u306e\u30c7\u30fc\u30bf\u30d5\u30ec\u30fc\u30e0\u3092\u7528\u3044\u3066\u3001pairplot\u3092\u3059\u308b\u5834\u5408\u3001\u305d\u306e\u30c7\u30fc\u30bf\u30d5\u30ec\u30fc\u30e0\u306bNaN\u5024\u304c\u3042\u308b\u5834\u5408pairplot\u3067\u304d\u307e\u305b\u3093\u3002\u3067\u3059\u306e\u3067pairplot\u3059\u308b\u306b\u306f\u3001NaN\u306e\u884c\u3092\u524a\u9664\u3059\u308b\u304b\u3001NaN\u30920\u306b\u7f6e\u304d\u63db\u3048\u305f\u4e0a\u3067\u5b9f\u884c\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002pairplot\u306f\u30c7\u30fc\u30bf\u30d5\u30ec\u30fc\u30e0\u5185\u306b\u3042\u308b\u5168\u3066\u306e\u6570\u5024\u9805\u76ee\u306e\u5404\u30da\u30a2\u306e\u6563\u5e03\u56f3\u3092\u63cf\u753b\u3057\u307e\u3059\u304c\u3001hue\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u4f7f\u3046\u3068\u3053\u3068\u3067\u8272\u5206\u3051\u3082\u53ef\u80fd\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import numpy as np\nimport pandas as pd\nimport seaborn as sns\nimport matplotlib.pyplot as plt\n\n# \u5f15\u6570hue\u306bcolumn\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u3067\u3001\u30c7\u30fc\u30bf\u3092\u8272\u5206\u3051\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002\n# \u4eca\u56de\u5f15\u6570\u306b\u6e21\u3059column\u306firis\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u306especies column\u3067\u3059\u3002\n# hue\u306f\u8272\u5408\u3044\u3001\u8272\u8abf\u306a\u3069\u3092\u610f\u5473\u3059\u308b\u5358\u8a9e\u3067\u3059\u3002\nsns.pairplot(iris, hue=\"species\")\nplt.show()<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/qiita-image-store.s3.amazonaws.com\/0\/171715\/e10b4190-5daa-bbad-b988-f9dfde2fd8ae.png\" alt=\"\"><\/figure>\n\n\n\n<p>\u203b\u4e0a\u8a18\u306e\u753b\u50cf\u306f\u304a\u4f7f\u3044\u306e\u5b9f\u884c\u74b0\u5883\u306b\u3088\u3063\u3066\u8272\u306a\u3069\u304c\u7570\u306a\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"i-3\">Python\u3092\u52b9\u7387\u3088\u304f\u5b66\u3076\u306b\u306f\uff1f<\/h1>\n\n\n\n<p>Python\u3092\u52b9\u7387\u3088\u304f\u5b66\u3076\u306b\u306f\u3001\u666e\u6bb5\u304b\u3089Python\u3092\u5229\u7528\u3057\u3066\u3044\u308b\u73fe\u5f79\u306e\u30c7\u30fc\u30bf\u30b5\u30a4\u30a8\u30f3\u30c6\u30a3\u30b9\u30c8\u3084\u6a5f\u68b0\u5b66\u7fd2\u30a8\u30f3\u30b8\u30cb\u30a2\u306b\u8cea\u554f\u3067\u304d\u308b\u74b0\u5883\u3067\u5b66\u3076\u3053\u3068\u3067\u3059\u3002<br>\u8cea\u554f\u3057\u653e\u984c\u304b\u3064\u3001\u4f53\u7cfb\u7684\u306b\u5b66\u3079\u308b\u52d5\u753b\u30b3\u30f3\u30c6\u30f3\u30c4\u3067\u30c7\u30fc\u30bf\u5206\u6790\u6280\u8853\u3092\u5b66\u3073\u305f\u3044\u65b9\u306f\u3001\u30aa\u30f3\u30e9\u30a4\u30f3\u3067\u597d\u304d\u306a\u6642\u9593\u306b\u52c9\u5f37\u3067\u304d\u308b<a href=\"https:\/\/aiacademy.jp\/bootcamp\">AI Academy Bootcamp<\/a>\u304c\u30aa\u30b9\u30b9\u30e1\u3067\u3059\u3002\u53d7\u8b1b\u6599\u3082\u696d\u754c\u6700\u5b89\u5024\u306e35,000\u5186\uff08\uff16\u30f6\u6708\u9593\u8cea\u554f\u3057\u653e\u984c\uff0b\u30aa\u30ea\u30b8\u30ca\u30eb\u306e\u52d5\u753b\u30b3\u30f3\u30c6\u30f3\u30c4\u3001\u30c6\u30ad\u30b9\u30c8\u30b3\u30f3\u30c6\u30f3\u30c4\u306e\u5229\u7528\u53ef\u80fd\uff09\u306a\u306e\u3067\u3001\u662f\u975e\u3054\u6d3b\u7528\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/aiacademy.jp\/bootcamp\/\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"341\" src=\"https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2021\/12\/bootcamp_ad_72ppi-1024x341.png\" alt=\"\" class=\"wp-image-691\" srcset=\"https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2021\/12\/bootcamp_ad_72ppi-1024x341.png 1024w, https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2021\/12\/bootcamp_ad_72ppi-300x100.png 300w, https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2021\/12\/bootcamp_ad_72ppi-768x256.png 768w, https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2021\/12\/bootcamp_ad_72ppi-940x313.png 940w, https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2021\/12\/bootcamp_ad_72ppi.png 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\"><\/a><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u76ee\u6b21 Seaborn\u3068\u306f Seaborn\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb \u6563\u5e03\u56f3\u884c\u5217 Python\u3092\u52b9\u7387\u3088\u304f\u5b66\u3076\u306b\u306f\uff1f Seaborn\u3068\u306f Seaborn (\u30b7\u30fc\u30dc\u30fc\u30f3) \u3068\u306f\u3001Python\u306e\u53ef\u8996\u5316\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u4e00\u3064\u3067\u3059\u3002 Seaborn\u306f &#8230; <\/p>\n","protected":false},"author":1,"featured_media":1909,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[85,110],"tags":[],"class_list":{"0":"post-1907","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-python","8":"category-110"},"_links":{"self":[{"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=\/wp\/v2\/posts\/1907","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1907"}],"version-history":[{"count":2,"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=\/wp\/v2\/posts\/1907\/revisions"}],"predecessor-version":[{"id":4827,"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=\/wp\/v2\/posts\/1907\/revisions\/4827"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=\/wp\/v2\/media\/1909"}],"wp:attachment":[{"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1907"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1907"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1907"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}