{"id":1834,"date":"2022-02-07T00:16:32","date_gmt":"2022-02-06T15:16:32","guid":{"rendered":"https:\/\/aiacademy.jp\/media\/?p=1834"},"modified":"2025-06-12T15:28:28","modified_gmt":"2025-06-12T06:28:28","slug":"%e3%80%90%e5%88%9d%e5%bf%83%e8%80%85%e5%90%91%e3%81%91%e3%80%91seaborn%e5%85%a5%e9%96%80-python%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%83%87%e3%83%bc%e3%82%bf%e3%82%92%e7%b6%ba%e9%ba%97%e3%81%ab","status":"publish","type":"post","link":"https:\/\/aiacademy.jp\/media\/?p=1834","title":{"rendered":"\u3010\u521d\u5fc3\u8005\u5411\u3051\u3011seaborn\u5165\u9580 | Python\u3092\u4f7f\u3063\u3066\u30c7\u30fc\u30bf\u3092\u7dba\u9e97\u306b\u53ef\u8996\u5316\u3057\u3066\u307f\u3088\u3046\uff01"},"content":{"rendered":"\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\">    <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>    <a href=\"#i-2\">\u6563\u5e03\u56f3\u884c\u5217<\/a>  <\/li>  <li>    <a href=\"#i-3\">jointplot\uff08\u6563\u5e03\u56f3\uff09<\/a>  <\/li>  <li>    <a href=\"#i-4\">countplot<\/a>  <\/li>  <li>    <a href=\"#i-5\">boxplot<\/a>  <\/li>  <li>    <a href=\"#i-6\">violinplot<\/a>  <\/li>  <li>    <a href=\"#i-7\">\u68d2\u30b0\u30e9\u30d5<\/a>  <\/li>  <li>    <a href=\"#i-8\">\u30d2\u30b9\u30c8\u30b0\u30e9\u30e0\u306e\u63cf\u753b<\/a>  <\/li>  <li>    <a href=\"#i-9\">catplot<\/a>  <\/li>  <li>    <a href=\"#i-10\">\u30d2\u30fc\u30c8\u30de\u30c3\u30d7\u306e\u63cf\u753b<\/a>  <\/li>  <li class=\"last\">    <a href=\"#i-11\">\u3010\u7121\u6599\u52d5\u753b\uff1a\u500d\u901f\u3067\u5b66\u3076\uff01\u751f\u6210AI\u3092\u6d3b\u7528\u3057\u305f\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u52c9\u5f37\u6cd5\uff08\u77ed\u7e2e\u7248\uff09\u3011<\/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<p><\/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<p><\/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<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-3\">jointplot\uff08\u6563\u5e03\u56f3\uff09<\/h2>\n\n\n\n<p>Seaborn\u3067\u306f\u3001jointplot\u95a2\u6570\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u30d2\u30b9\u30c8\u30b0\u30e9\u30e0\u3064\u304d\u306e\u6563\u5e03\u56f3\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u304c\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\niris = sns.load_dataset(\"iris\")\n\n#\u30d2\u30b9\u30c8\u30b0\u30e9\u30e0\u3064\u304d\u306e\u6563\u5e03\u56f3\u3092\u4f5c\u6210\nsns.jointplot(x='sepal_width', y='petal_length', data=iris)\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\/68124578-9e4a-5719-0da2-660a1587d697.png\" alt=\"\"><\/figure>\n\n\n\n<p>\u307e\u305fkind\u30aa\u30d7\u30b7\u30e7\u30f3\u306breg\u3092\u6307\u5b9a\u3059\u308b\u3068\u6563\u5e03\u56f3\u306b\u52a0\u3048\u3001\u56de\u5e30\u76f4\u7dda\u3092\u5f15\u3044\u3066\u304f\u308c\u307e\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\niris = sns.load_dataset(\"iris\")\n#\u30d2\u30b9\u30c8\u30b0\u30e9\u30e0\u3064\u304d\u306e\u6563\u5e03\u56f3\u3092\u4f5c\u6210\nsns.jointplot(x='sepal_width', y='petal_length', data=iris, kind='reg')\nplt.show()<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/aiacademy.jp\/assets\/upload\/chapter_000141_m2MRQf3PZXjb.png\" alt=\"\"><\/figure>\n\n\n\n<p>kind\u306b\u306freg\u4ee5\u5916\u306b\u3082\u3001resid(\u6b8b\u5dee\u8aa4\u5dee)\u3001kde\uff08\u30ab\u30fc\u30cd\u30eb\u5bc6\u5ea6\u63a8\u5b9a\u3092\u7528\u3044\u305f\u7b49\u9ad8\u7dda\u98a8\u306e\u63cf\u753b\uff09\u3001hex\uff08\u516d\u89d2\u5f62\u306e\u30d2\u30fc\u30c8\u30de\u30c3\u30d7\uff09\u306a\u3069\u3082\u6307\u5b9a\u3059\u308b\u4e8b\u304c\u51fa\u6765\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-4\">countplot<\/h2>\n\n\n\n<p>countplot\u306f\u3001\u30ab\u30c6\u30b4\u30ea\u30ab\u30eb\u30c7\u30fc\u30bf\u306b\u5bfe\u3059\u308b\u30d7\u30ed\u30c3\u30c8\u3067\u3001\u30c7\u30fc\u30bf\u306e\u4ef6\u6570\u3092\u96c6\u8a08\u3057\u3001\u30b0\u30e9\u30d5\u3068\u3057\u3066\u53ef\u8996\u5316\u3057\u307e\u3059\u3002coutplot\u95a2\u6570\u3092\u5229\u7528\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import seaborn as sns\nimport numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\n\n# titanic\u4ee5\u5916\u306b\u3082\u30c1\u30c3\u30d7\u306e\u95a2\u4fc2\u306b\u95a2\u3059\u308b\u30c7\u30fc\u30bf\u306a\u3069\u3082\u3042\u308a\u307e\u3059\u3002\n# tips = sns.load_dataset(\"tips\")  # \u304a\u5e97\u306e\u98df\u4e8b\u6642\u9593\u3068\u4f1a\u8a08\u7dcf\u984d\u3068\u30c1\u30c3\u30d7\u306e\u95a2\u4fc2\u306e\u30c7\u30fc\u30bf\u306e\u8aad\u307f\u8fbc\u307f\ntitanic = sns.load_dataset(\"titanic\") # \u203b\u5de6\u306etitanic\u306f\u5909\u6570\u540d\u3067\u3001\u53f3\u5074\u306etitanic\u306ftitanic\u53f7\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u3092\u8aad\u307f\u8fbc\u3080\u3068\u3044\u3046\u8a2d\u5b9a\u3067\u3059\u3002\nsns.countplot(x=\"class\", data=titanic)\nplt.show()<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/aiacademy.jp\/assets\/upload\/chapter_000141_TPJmQd6h74Ff.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<h2 class=\"wp-block-heading\" id=\"i-5\">boxplot<\/h2>\n\n\n\n<p>boxplot\u306f\u30012\u7a2e\u985e\u306e\u30ab\u30c6\u30b4\u30ea\u30c7\u30fc\u30bf\u3092\u542b\u3093\u3060\u6570\u5024\u30c7\u30fc\u30bf\u306e\u3070\u3089\u3064\u304d\u3092\u53ef\u8996\u5316\u3059\u308b\u969b\u306b\u5229\u7528\u3057\u307e\u3059\u3002boxplot\u95a2\u6570\u3092\u5229\u7528\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import seaborn as sns\nimport numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\n\ntitanic = sns.load_dataset(\"titanic\") # \u203b\u5de6\u306etitanic\u306f\u5909\u6570\u540d\u3067\u3001\u53f3\u5074\u306etitanic\u306ftitanic\u53f7\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u3092\u8aad\u307f\u8fbc\u3080\u3068\u3044\u3046\u8a2d\u5b9a\u3067\u3059\u3002\nsns.boxplot(x=\"survived\", y=\"age\", data=titanic)\nplt.show()<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/aiacademy.jp\/assets\/upload\/chapter_000141_sxP2AP3wBn9k.png\" alt=\"\"><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/aiacademy.jp\/bootcamp\/\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"419\" src=\"https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2021\/12\/1.png\" alt=\"\" class=\"wp-image-663\" srcset=\"https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2021\/12\/1.png 800w, https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2021\/12\/1-300x157.png 300w, https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2021\/12\/1-768x402.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\"><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-6\">violinplot<\/h2>\n\n\n\n<p>violinplot\u306f2\u7a2e\u985e\u306e\u30ab\u30c6\u30b4\u30ea\u30c7\u30fc\u30bf\u3092\u542b\u3093\u3060\u6570\u5024\u30c7\u30fc\u30bf\u306e\u9055\u3044\u3092\u53ef\u8996\u5316\u3059\u308b\u969b\u306b\u5229\u7528\u3057\u307e\u3059\u3002violinplot\u95a2\u6570\u3092\u5229\u7528\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import seaborn as sns\nimport numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\n\ntitanic = sns.load_dataset(\"titanic\") # \u203b\u5de6\u306etitanic\u306f\u5909\u6570\u540d\u3067\u3001\u53f3\u5074\u306etitanic\u306ftitanic\u53f7\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u3092\u8aad\u307f\u8fbc\u3080\u3068\u3044\u3046\u8a2d\u5b9a\u3067\u3059\u3002\nsns.violinplot(x=\"survived\", y=\"age\", data=titanic)\nplt.show()<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/aiacademy.jp\/assets\/upload\/chapter_000141_Ztyn6Rj84PPe.png\" alt=\"\"><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-7\">\u68d2\u30b0\u30e9\u30d5<\/h2>\n\n\n\n<p>\u68d2\u30b0\u30e9\u30d5\u3092\u4f5c\u6210\u3059\u308b\u5834\u5408\u306f\u3001barplot\u95a2\u6570\u3092\u4f7f\u3044\u307e\u3059\u3002\u5e73\u5747\u5024\u3092\u8a08\u7b97\u3057\u305f\u4e0a\u3067\u68d2\u30b0\u30e9\u30d5\u3092\u8868\u793a\u3057\u3066\u304f\u308c\u307e\u3059\u3002\u6a2a\u8ef8\u3068\u7e26\u8ef8\u306fx\u3068y\u5909\u6570\u306b\u3001\u68d2\u30b0\u30e9\u30d5\u306e\u30ab\u30c6\u30b4\u30ea\u30fc\u30c7\u30fc\u30bf\u306fhue\u306b\u3001\u305d\u3057\u3066\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u306fdata\u5909\u6570\u306b\u4ee3\u5165\u3057\u307e\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# \u203b\u5de6\u306etitanic\u306f\u5909\u6570\u540d\u3067\u3001\u53f3\u5074\u306etitanic\u306ftitanic\u53f7\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u3092\u8aad\u307f\u8fbc\u3080\u3068\u3044\u3046\u8a2d\u5b9a\u3067\u3059\u3002\ntitanic = sns.load_dataset(\"titanic\")\nsns.barplot(x=\"sex\", y=\"survived\", hue=\"class\", data=titanic);\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\/244c10dc-c122-6e6e-c557-28163856f061.png\" alt=\"\"><\/figure>\n\n\n\n<p>\u307e\u305f\u3001\u9ed2\u3044\u7e26\u68d2\u306e\u4e8b\u3092\u30a8\u30e9\u30fc\u30d0\u30fc\u3068\u547c\u3070\u308c\u307e\u3059\u3002\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u300195%\u306e\u4fe1\u983c\u533a\u9593\uff08Confidence interval,CI\uff09\u3068\u3044\u3046\u306e\u3092\u4f7f\u3063\u3066\u3044\u307e\u3059\u3002\u203b\u4fe1\u983c\u533a\u9593\u3068\u306f\u3001\u6bcd\u96c6\u56e3\u306e\u771f\u306e\u5024\u304c\u542b\u307e\u308c\u308b\u3053\u3068\u304c\u3001\u304b\u306a\u308a\u78ba\u4fe1(confident)\u3067\u304d\u308b\u6570\u5024\u7bc4\u56f2\u306e\u4e8b\u3067\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-8\">\u30d2\u30b9\u30c8\u30b0\u30e9\u30e0\u306e\u63cf\u753b<\/h2>\n\n\n\n<p>distplot\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3046\u3053\u3068\u3067\u30d2\u30b9\u30c8\u30b0\u30e9\u30e0\u3092\u63cf\u753b\u3059\u308b\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002seaborn\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u304c0.11.0\u4ee5\u4e0a\u306e\u5834\u5408\u306f<code>distplot()<\/code>\u304c\u5c06\u6765\u5ec3\u6b62\u3055\u308c\u308b\u53ef\u80fd\u6027\u304c\u3042\u308b\u305f\u3081\u3001<code>displot()<\/code>\u3092\u4f7f\u3046\u3088\u3046\u306b\u3057\u307e\u3057\u3087\u3046\u3002\u5f15\u6570\u306b\u3044\u304f\u3064\u304b\u30aa\u30d7\u30b7\u30e7\u30f3\u3068\u3057\u3066\u6e21\u3059\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002<code>kde<\/code>\u3084<code>rug<\/code>\u306e\u5024\u3092True\u306b\u5909\u3048\u3066\u8a66\u3057\u3066\u898b\u3066\u304f\u3060\u3055\u3044\u3002kde\u306f\u30ab\u30fc\u30cd\u30eb\u5bc6\u5ea6\u63a8\u5b9a\uff08\u306a\u3081\u3089\u304b\u306a\u30d2\u30b9\u30c8\u30b0\u30e9\u30e0\uff09\u306e\u63cf\u753b\u306b\u95a2\u3059\u308b\u30aa\u30d7\u30b7\u30e7\u30f3\u3067\u3001bins\u306fx\u8ef8\u306e\u523b\u307f\u76ee\u306e\u6307\u5b9a\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u306b\u306a\u308a\u307e\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\na = np.random.normal(size=30)\n\"\"\"\n\u5f15\u6570\u306e\u8aac\u660e\nbins \u30d2\u30b9\u30c8\u30b0\u30e9\u30e0\u306e\u67f1\u306e\u5e45\u30fb\u6570\u3092\u8a2d\u5b9a\nkde \u30ab\u30fc\u30cd\u30eb\u5bc6\u5ea6\u63a8\u5b9a\u306e\u30b0\u30e9\u30d5\u3092\u91cd\u306d\u3066\u63cf\u304f\u304b\u3069\u3046\u304b\uff08True\/False\uff09\nrug \u5404\u30c7\u30fc\u30bf\u306e\u8a73\u7d30\u306a\u4f4d\u7f6e\u3092\u30b0\u30e9\u30d5\u306e\u4e0b\u90e8\u5206\u306b\u77ed\u3044\u7dda\u3067\u793a\u3059\u304b\u3069\u3046\u304b\naxlabel x\u8ef8\u306e\u30e9\u30d9\u30eb\n\"\"\"\n# \u30d2\u30b9\u30c8\u30b0\u30e9\u30e0\u3092\u63cf\u753b\nsns.distplot(a, kde=False, rug=False, bins=10) \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\/584c4a63-7e02-71fe-9574-b05baeb4e3e9.png\" alt=\"\"><\/figure>\n\n\n\n<p>displot()\u3092\u7528\u3044\u3066\u30d2\u30b9\u30c8\u30b0\u30e9\u30e0\u3092\u63cf\u753b\u3057\u305f\u5834\u5408<\/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\nprint(sns.__version__) # Seaborn\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u306e\u78ba\u8a8d\na = np.random.normal(size=30)\n\n# \u30d2\u30b9\u30c8\u30b0\u30e9\u30e0\u3092\u63cf\u753b\nsns.displot(a) \nplt.show()<\/code><\/pre>\n\n\n\n<p>\u203b\u5909\u6570<code>a<\/code>\u306e\u5024\u304c\u5b9f\u884c\u6bce\u306b\u30e9\u30f3\u30c0\u30e0\u3067\u5909\u308f\u308b\u305f\u3081\u3001\u4ee5\u4e0b\u3068\u306f\u9055\u3063\u305f\u63cf\u753b\u306b\u306a\u308b\u70b9\u6ce8\u610f\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/aiacademy.jp\/assets\/upload\/chapter_000141_4Uux7yfUv83h.png\" alt=\"\"><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-9\">catplot<\/h2>\n\n\n\n<p><code>catplot<\/code>\u3092\u7528\u3044\u308b\u3068\u3001\u6563\u5e03\u56f3\u3084\u7bb1\u3072\u3052\u56f3\u3001\u68d2\u30b0\u30e9\u30d5\u306a\u3069\u63cf\u753b\u3059\u308b\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002<code>catplot<\/code>\u306e\u5f15\u6570\u306e<code>kind<\/code>\u306b\u30b0\u30e9\u30d5\u306e\u7a2e\u985e\u3092\u6307\u5b9a\u3059\u308b\u4e8b\u3067\u69d8\u3005\u306a\u7a2e\u985e\u306e\u30b0\u30e9\u30d5\u3092\u53ef\u8996\u5316\u3067\u304d\u307e\u3059\u3002\u4eca\u56de\u306f\u3001<code>countplot<\/code>\u3092\u7528\u3044\u305a\u306b<code>catplot<\/code>\u306e<code>kind<\/code>\u306b<code>count<\/code>\u3092\u6307\u5b9a\u3057\u3066\u3001\u5404\u30ab\u30c6\u30b4\u30ea\u306e\u6570\u306b\u5bfe\u3057\u3066\u30d7\u30ed\u30c3\u30c8\u3057\u3066\u3044\u307e\u3059\u3002\uff08\u30ab\u30c6\u30b4\u30ea\u6bce\u306e\u5206\u5e03\u3092\u53ef\u8996\u5316\u3059\u308b\u7528\u9014\u3067\u5229\u7528\u3057\u3066\u307f\u307e\u3059\u3002\uff09<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import seaborn as sns\n\ndf = sns.load_dataset(\"tips\")\n# x\u306b\u306f\u30ab\u30c6\u30b4\u30ea\u5909\u6570\u3092\u6e21\u3059\nsns.catplot(x = 'smoker', data=df, kind='count')<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/aiacademy.jp\/assets\/upload\/chapter_000141_YZt2jTc2UbCm.png\" alt=\"\"><\/figure>\n\n\n\n<p><code>kind<\/code>\u306b\u6e21\u305b\u308b\u30d1\u30e9\u30e1\u30fc\u30bf\u3068\u3057\u3066\u3001<code>count<\/code>\u4ee5\u5916\u306b\u3082\u3001<code>strip<\/code>\u3084<code>swarm<\/code>\u3001<code>box<\/code>\u3001<code>violin<\/code>\u3001<code>barpoint<\/code>\u306a\u3069\u304c\u3042\u308a\u307e\u3059\u3002\u6c17\u306b\u306a\u3063\u305f\u65b9\u306f\u3001\u516c\u5f0f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3082\u5408\u308f\u305b\u3066\u78ba\u8a8d\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<a rel=\"noreferrer noopener nofollow\" href=\"https:\/\/seaborn.pydata.org\/generated\/seaborn.catplot.html\" target=\"_blank\">seaborn.catplot<\/a><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-10\">\u30d2\u30fc\u30c8\u30de\u30c3\u30d7\u306e\u63cf\u753b<\/h2>\n\n\n\n<p>heatmap\u95a2\u6570\u3092\u4f7f\u3046\u3053\u3068\u3067\u3001\u7c21\u5358\u306b\u30d2\u30fc\u30c8\u30de\u30c3\u30d7\u3084\u30b0\u30ec\u30fc\u30b9\u30b1\u30fc\u30eb\u753b\u50cf\u30c7\u30fc\u30bf\u3092\u30b0\u30e9\u30d5\u5316\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u30c7\u30fc\u30bf\u30b5\u30a4\u30a8\u30f3\u30b9\u3067\u306f\u76f8\u95a2\u306e\u5f37\u3055\u3092\u6570\u5024\u5316\u3057\u305f\u76f8\u95a2\u4fc2\u6570\u3092\u8868\u306b\u3057\u305f\u76f8\u95a2\u8868\u3084\u3001\u6a5f\u68b0\u5b66\u6570\u306e\u5206\u985e\u554f\u984c\u306b\u95a2\u3057\u3066\u5206\u985e\u7d50\u679c\u3092\u53ef\u8996\u5316\u3057\u305f\u6df7\u540c\u884c\u5217\u3068\u547c\u3070\u308c\u308b\u3082\u306e\u3092\u53ef\u8996\u5316\u3059\u308b\u3068\u304d\u306b\u3088\u304f\u7528\u3044\u3089\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import matplotlib.pyplot as plt\nimport numpy as np\nimport seaborn as sns\n# \u30b7\u30fc\u30c9\u5024\u30920\u306b\u56fa\u5b9a\nnp.random.seed(0)\nsns.set()\n\nuniform_data = np.random.rand(100, 100)\n# \u30d2\u30fc\u30c8\u30de\u30c3\u30d7\u306e\u30b0\u30e9\u30d5\u304b\nax = sns.heatmap(uniform_data)\nplt.axis(\"off\")\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\/5bca9c2d-718b-8c53-9e05-58540e6bfbee.png\" alt=\"\"><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-11\">\u3010\u7121\u6599\u52d5\u753b\uff1a<strong>\u500d\u901f\u3067\u5b66\u3076\uff01\u751f\u6210AI\u3092\u6d3b\u7528\u3057\u305f\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u52c9\u5f37\u6cd5\uff08\u77ed\u7e2e\u7248\uff09\u3011<\/strong><\/h2>\n\n\n\n<p>\u751f\u6210AI\u3092\u6d3b\u7528\u3057\u3066\u52b9\u7387\u7684\u306b\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3092\u5b66\u3076\u65b9\u6cd5\u3092\u89e3\u8aac\u3057\u3066\u3044\u307e\u3059\u3002\u751f\u6210AI\u306e\u57fa\u672c\u7684\u306a\u4ed5\u7d44\u307f\u3084\u52b9\u679c\u7684\u306a\u6d3b\u7528\u6cd5\u3001\u6ce8\u610f\u70b9\u306b\u3064\u3044\u3066\u3082\u8a73\u3057\u304f\u8aac\u660e\u3002\u52c9\u5f37\u6cd5\u3068\u3068\u3082\u306b\u751f\u6210AI\u305d\u306e\u3082\u306e\u306b\u3064\u3044\u3066\u3082\u5b66\u3079\u308b\u5185\u5bb9\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u3002\u305c\u3072\u3054\u89a7\u304f\u3060\u3055\u3044\uff01\u3000<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-vimeo wp-block-embed-vimeo wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" src=\"https:\/\/player.vimeo.com\/video\/1069835048?h=e43b17d6de&amp;dnt=1&amp;app_id=122963\" width=\"880\" height=\"495\" frameborder=\"0\" allow=\"autoplay; fullscreen; picture-in-picture; clipboard-write; encrypted-media; web-share\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p><strong>\u5168\u7de8\u306f\u3001AI Academy\u516c\u5f0fLINE\u3067\u914d\u4fe1\u4e2d\u3067\u3059\u3002<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><a href=\"https:\/\/lin.ee\/3E4GzWk\" target=\"_blank\" rel=\" noreferrer noopener nofollow\"><img loading=\"lazy\" decoding=\"async\" width=\"910\" height=\"517\" src=\"https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2019\/11\/LINE_Buttom.png\" alt=\"\" class=\"wp-image-6799\" style=\"width:158px;height:auto\" srcset=\"https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2019\/11\/LINE_Buttom.png 910w, https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2019\/11\/LINE_Buttom-300x170.png 300w, https:\/\/aiacademy.jp\/media\/wp-content\/uploads\/2019\/11\/LINE_Buttom-768x436.png 768w\" sizes=\"auto, (max-width: 910px) 100vw, 910px\"><\/a><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u76ee\u6b21 Seaborn\u3068\u306f Seaborn\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb \u6563\u5e03\u56f3\u884c\u5217 jointplot\uff08\u6563\u5e03\u56f3\uff09 countplot boxplot violinplot \u68d2\u30b0\u30e9\u30d5 \u30d2\u30b9\u30c8\u30b0\u30e9\u30e0\u306e\u63cf\u753b catplot \u30d2\u30fc\u30c8\u30de\u30c3\u30d7\u306e\u63cf\u753b &#8230; <\/p>\n","protected":false},"author":1,"featured_media":1838,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[85,110],"tags":[],"class_list":{"0":"post-1834","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\/1834","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=1834"}],"version-history":[{"count":13,"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=\/wp\/v2\/posts\/1834\/revisions"}],"predecessor-version":[{"id":7570,"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=\/wp\/v2\/posts\/1834\/revisions\/7570"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=\/wp\/v2\/media\/1838"}],"wp:attachment":[{"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1834"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1834"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aiacademy.jp\/media\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1834"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}