{"id":1478,"date":"2019-12-20T18:11:28","date_gmt":"2019-12-20T09:11:28","guid":{"rendered":"http:\/\/int-info.com\/?page_id=1478"},"modified":"2020-03-29T01:14:41","modified_gmt":"2020-03-28T16:14:41","slug":"matplotjp","status":"publish","type":"page","link":"http:\/\/int-info.com\/index.php\/matplotjp\/","title":{"rendered":"matplotlib\u74b0\u5883\u306e\u56f3\u306b\u65e5\u672c\u8a9e\u3092\u5165\u308c\u305f\u3044"},"content":{"rendered":"<p><b>\u30d5\u30a9\u30f3\u30c8\u306e\u5165\u624b\uff1a<\/b><br \/>\n<a href=\"https:\/\/ipafont.ipa.go.jp\/node193#jp\">\u3053\u3061\u3089<\/a>\u306b\u3066\u3001\u30d5\u30a9\u30f3\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u307e\u3059\uff08\u30b4\u30b7\u30c3\u30af\u63a8\u5968\uff09\u3002\u3053\u308c\u3092\u89e3\u51cd\u3059\u308b\u3068<b>ttf\u62e1\u5f35\u5b50\u306e\u30c7\u30fc\u30bf<\/b>\u304c\u73fe\u308c\u308b\u306e\u3067\u3001\u305d\u308c\u3092\u4f5c\u696d\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u79fb\u52d5\u3057\u307e\u3059\u3002<\/p>\n<p><b>\u65e5\u672c\u8a9e\u30d5\u30a9\u30f3\u30c8\u306e\u4f7f\u7528\u65b9\u6cd5\uff1a<\/b><br \/>\n\u30dd\u30a4\u30f3\u30c8\u306f3\u884c\u76ee\u306e\u30a4\u30f3\u30dd\u30fc\u30c8\u3068\u30016\u301c10\u884c\u76ee\u306e\u65e5\u672c\u8a9e\u30d5\u30a9\u30f3\u30c8\u306e\u8a2d\u5b9a\u3068\u306a\u308a\u307e\u3059\u3002\u3042\u3068\u306f\u3001\u3068\u306b\u304b\u304f\u65e5\u672c\u8a9e\u3092\u5165\u308c\u305f\u3044\u3068\u3053\u308d\u306e\u5f15\u6570\u306b\u300cfontproperties=font_prop\u300d\u3092\u4e0e\u3048\u308c\u3070ok\u3067\u3059\u3002\u4e0b\u306e\u4f8b\u3067\u8a00\u3048\u3070\u300121\u884c\u76ee\u304c\u305d\u308c\u306b\u8a72\u5f53\u3057\u307e\u3059\u3002<\/p>\n<pre>\r\nimport numpy as np\r\nimport matplotlib.pyplot as plt\r\nfrom matplotlib import font_manager\r\n\r\n# ********** \u65e5\u672c\u8a9e\u30d5\u30a9\u30f3\u30c8\u306e\u8a2d\u5b9a ************\r\nfont_path = \"ipaexg.ttf\" # <- \u3069\u3053\u304b\u3089\u304b\u5165\u624b\u3057\u3066\u3001\u4f5c\u696d\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u7f6e\u304f\u3002\r\nfont_prop = font_manager.FontProperties(fname=font_path)\r\nfont_prop.set_style('normal')\r\nfont_prop.set_weight('light') \r\nfont_prop.set_size('12') # \u6587\u5b57\u30b5\u30a4\u30ba\r\n\r\n\r\n# ********** \u56f3\u306e\u4f5c\u6210\uff08sin\u6ce2\u5f62\uff09 ************\r\nx = np.arange(100 * 3.1415 * 2) * 0.01\r\na = (np.sin(x)+1) \/2\r\n\r\nplt.figure(figsize=(10, 2))\r\nplt.subplots_adjust(wspace=0.4, hspace=0.6)\r\n\r\nplt.plot(a)\r\nplt.title(\"\u30b5\u30a4\u30f3\u6ce2\u5f62: \u305d\u306e1\", fontproperties=font_prop)\r\nplt.xlabel(\"\u6642\u9593\uff08\u79d2\uff09\", fontproperties=font_prop)\r\nplt.ylabel(\"\u5024\", fontproperties=font_prop)\r\n# fontproperties\u5f15\u6570\u306b\u5bfe\u3057\u3001\u4e0a\u3067\u8a2d\u5b9a\u3057\u305ffont_prop\u3092\u4e0e\u3048\u308c\u3070ok\r\n\r\nplt.show()\r\n<\/pre>\n<p>\u8ffd\u8a18:<\/p>\n<p>\u3082\u3057legend\u74b0\u5883\uff08\u51e1\u4f8b\uff09\u3067\u65e5\u672c\u8a9e\u3092\u4f7f\u3044\u305f\u3044\u5834\u5408\u306f\u3001fontproperties\u3067\u306f\u306a\u304f\u3001prop\u5f15\u6570\u306b\u5165\u308c\u308b\u5fc5\u8981\u304c\u3042\u308b\u3002<\/p>\n<pre>\r\nplt.legend(prop=font_prop)\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u30d5\u30a9\u30f3\u30c8\u306e\u5165\u624b\uff1a \u3053\u3061\u3089\u306b\u3066\u3001\u30d5\u30a9\u30f3\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u307e\u3059\uff08\u30b4\u30b7\u30c3\u30af\u63a8\u5968\uff09\u3002\u3053\u308c\u3092\u89e3\u51cd\u3059\u308b\u3068ttf\u62e1\u5f35\u5b50\u306e\u30c7\u30fc\u30bf\u304c\u73fe\u308c\u308b\u306e\u3067\u3001\u305d\u308c\u3092\u4f5c\u696d\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u79fb\u52d5\u3057\u307e\u3059\u3002 \u65e5\u672c\u8a9e\u30d5\u30a9\u30f3\u30c8\u306e\u4f7f\u7528\u65b9\u6cd5\uff1a \u30dd\u30a4\u30f3\u30c8\u306f3\u884c\u76ee\u306e\u30a4<\/p><\/div>\n<div class=\"blog-btn\"><a href=\"http:\/\/int-info.com\/index.php\/matplotjp\/\" class=\"home-blog-btn\">\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1478","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"http:\/\/int-info.com\/index.php\/wp-json\/wp\/v2\/pages\/1478","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/int-info.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/int-info.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/int-info.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/int-info.com\/index.php\/wp-json\/wp\/v2\/comments?post=1478"}],"version-history":[{"count":9,"href":"http:\/\/int-info.com\/index.php\/wp-json\/wp\/v2\/pages\/1478\/revisions"}],"predecessor-version":[{"id":1613,"href":"http:\/\/int-info.com\/index.php\/wp-json\/wp\/v2\/pages\/1478\/revisions\/1613"}],"wp:attachment":[{"href":"http:\/\/int-info.com\/index.php\/wp-json\/wp\/v2\/media?parent=1478"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}