{"id":46550,"date":"2017-01-24T10:36:03","date_gmt":"2017-01-24T01:36:03","guid":{"rendered":"http:\/\/www.softantenna.com\/wp\/?p=46550"},"modified":"2017-01-24T10:36:03","modified_gmt":"2017-01-24T01:36:03","slug":"itermplot","status":"publish","type":"post","link":"https:\/\/softantenna.com\/blog\/itermplot\/","title":{"rendered":"itermplot - Matplotlib\u3092\u5229\u7528\u3057\u3066iTerm2\u306b\u30b0\u30e9\u30d5\u3092\u76f4\u63cf\u753b\u3067\u304d\u308b\u30e9\u30a4\u30d6\u30e9\u30ea"},"content":{"rendered":"<p><img decoding=\"async\" style=\"display:block; margin-left:auto; margin-right:auto;\" src=\"https:\/\/softantenna.com\/blog\/wp-content\/uploads\/2017\/01\/Is_20170120_110141.jpg\" alt=\"S 20170120 110141\" title=\"s_20170120_110141.jpg\" border=\"0\" width=\"796\" height=\"580\" \/><\/p>\n<p>Mac\u7528\u306e\u30bf\u30fc\u30df\u30ca\u30eb\u30a8\u30df\u30e5\u30ec\u30fc\u30bf\u30fc\u300c<a href=\"https:\/\/www.iterm2.com\/\">iTerm2<\/a>\u300d\u3002\u591a\u6a5f\u80fd\u3067\u4f7f\u3044\u3084\u3059\u304f\u3001Mac\u306e\u958b\u767a\u8005\u306e\u4e2d\u306b\u306f\u3001\u6a19\u6e96\u306e\u30bf\u30fc\u30df\u30ca\u30eb\u3067\u306f\u306a\u304f\u3001\u3053\u3061\u3089\u3092\u611b\u7528\u3057\u3066\u3044\u308b\u65b9\u3082\u591a\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u672c\u65e5\u7d39\u4ecb\u3059\u308b\u300c<a href=\"https:\/\/github.com\/daleroberts\/itermplot\">itermplit<\/a>\u300d\u306f\u3001\u3053\u3044\u306eiTerm\u4e0a\u306b\u30b0\u30e9\u30d5\u3092\u76f4\u63a5\u63cf\u753b\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308bPython\u30e9\u30a4\u30d6\u30e9\u30ea\u3002Python\u7528\u306e\u30b0\u30e9\u30d5\u30d7\u30ed\u30c3\u30c8\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3042\u308bMatplotlib\u3092\u30d9\u30fc\u30b9\u3068\u3057\u3001Python\u30b3\u30fc\u30c9\u3067\u8a18\u8ff0\u3057\u305f\u30b0\u30e9\u30d5\u306e\u7d50\u679c\u3092\u3059\u3050\u306b\u30bf\u30fc\u30df\u30ca\u30eb\u3067\u78ba\u8a8d\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3068\u3044\u3046\u3082\u306e\u3067\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30b3\u30fc\u30c9\u3092\u4f7f\u7528\u3059\u308b\u3068:<\/p>\n<pre><code class=\"swift\">\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport networkx as nx\n\nplt.rcParams[\"font.size\"] = 10\n\nplt.figure(figsize=(8,3))\n\nax = plt.subplot(121)\nx = np.arange(0,10,0.001)\nax.plot(x, np.sin(np.sinc(x)), 'r', lw=2)\nax.set_title('Nice wiggle')\n\nax = plt.subplot(122)\nplt.tick_params(axis='both', left='off', top='off', right='off', bottom='off', labelleft='off', labeltop='off', labelright='off', labelbottom='off')\nG = nx.random_geometric_graph(200, 0.125)\npos=nx.spring_layout(G)\nnx.draw_networkx_edges(G, pos, alpha=0.2)\nnx.draw_networkx_nodes(G, pos, node_color='r', node_size=12)\nax.set_title('Random graph')\n\nplt.show()\n<\/code><\/pre>\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u7d50\u679c\u3092\u5f97\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" style=\"display:block; margin-left:auto; margin-right:auto;\" src=\"https:\/\/softantenna.com\/blog\/wp-content\/uploads\/2017\/01\/Ilightdark.jpg\" alt=\"Lightdark\" title=\"lightdark.jpg\" border=\"0\" width=\"1280\" height=\"648\" \/><\/p>\n<h2>itermplot\u306e\u4f7f\u7528\u65b9\u6cd5<\/h2>\n<p>itermplot\u306fPython 3\u3068Python 2\u3092\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u3044\u307e\u3059\u3002\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306fpip3\u3092\u4f7f\u7528\u3059\u308b\u5834\u5408\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre>pip3 install itermplot\n<\/pre>\n<p>itermplot\u306f\u74b0\u5883\u5909\u6570MPLBACKEND\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u3068\u304d\u3060\u3051\u6709\u52b9\u306b\u306a\u308a\u307e\u3059\u3002bash\u3084zsh\u306e\u5834\u5408\u3001\u30bf\u30fc\u30df\u30ca\u30eb\u3092\u958b\u304d\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre>export MPLBACKEND=\"module:\/\/itermplot\"\n<\/pre>\n<p>\u30c6\u30b9\u30c8\u5b9f\u884c\u3059\u308b\u5834\u5408\u3001Python\u306e\u30a4\u30f3\u30bf\u30e9\u30af\u30c6\u30a3\u30d6\u30b7\u30a7\u30eb\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre>\n$ echo $MPLBACKEND\nmodule:\/\/itermplot\n$ python3\nPython 3.5.2 (default, Oct 24 2016, 09:14:06)\n[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.38)] on darwin\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n>>> import matplotlib.pyplot as plt\n>>> plt.plot([1,2,3])\n[<matplotlib.lines.Line2D object at 0x1041f2e48>]\n>>> plt.show()\n<\/pre>\n<p>\u25bcplt.show()\u3092\u547c\u3073\u51fa\u3059\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u76f4\u7dda\u306e\u30b0\u30e9\u30d5\u304c\u63cf\u753b\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" style=\"display:block; margin-left:auto; margin-right:auto;\" src=\"https:\/\/softantenna.com\/blog\/wp-content\/uploads\/2017\/01\/Is_20170120_110141.jpg\" alt=\"S 20170120 110141\" title=\"s_20170120_110141.jpg\" border=\"0\" width=\"796\" height=\"580\" \/><\/p>\n<p>\u25bcdocs\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u4e0b\u306b\u3042\u308btest.py\u3092\u5b9f\u884c\u3059\u308b\u3068\u3088\u308a\u8907\u96d1\u306a\u30b5\u30f3\u30d7\u30eb\u304c\u63cf\u753b\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" style=\"display:block; margin-left:auto; margin-right:auto;\" src=\"https:\/\/softantenna.com\/blog\/wp-content\/uploads\/2017\/01\/Is_20170120_111334.jpg\" alt=\"S 20170120 111334\" title=\"s_20170120_111334.jpg\" border=\"0\" width=\"791\" height=\"459\" \/><\/p>\n<p>\u300cModuleNotFoundError: No module named 'networkx'\u300d\u3068\u3044\u3046\u30a8\u30e9\u30fc\u304c\u8868\u793a\u3055\u308c\u305f\u5834\u5408\u306f\u3001\u300cpip3 install networkx\u300d\u3092\u5b9f\u884c\u3057\u3066\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<h2>\u307e\u3068\u3081<\/h2>\n<p>itermplot\u3092\u5229\u7528\u3059\u308c\u3070\u30bf\u30fc\u30df\u30ca\u30eb\u4e0a\u3067\u624b\u8efd\u306b\u30b0\u30e9\u30d5\u306e\u63cf\u753b\u7d50\u679c\u3092\u78ba\u8a8d\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002Python\u3092\u5229\u7528\u3057\u3066\u5404\u7a2e\u6570\u5024\u8a08\u7b97\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u958b\u767a\u3057\u3066\u3044\u308b\u958b\u767a\u8005\u306e\u65b9\u306b\u306f\u4fbf\u5229\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Mac\u7528\u306e\u30bf\u30fc\u30df\u30ca\u30eb\u30a8\u30df\u30e5\u30ec\u30fc\u30bf\u30fc\u300ciTerm2\u300d\u3002\u591a\u6a5f\u80fd\u3067\u4f7f\u3044\u3084\u3059\u304f\u3001Mac\u306e\u958b\u767a\u8005\u306e\u4e2d\u306b\u306f\u3001\u6a19\u6e96\u306e\u30bf\u30fc\u30df\u30ca\u30eb\u3067\u306f\u306a\u304f\u3001\u3053\u3061\u3089\u3092\u611b\u7528\u3057\u3066\u3044\u308b\u65b9\u3082\u591a\u3044\u3068\u601d\u3044\u307e\u3059\u3002 \u672c\u65e5\u7d39\u4ecb\u3059\u308b\u300citermplit\u300d\u306f\u3001\u3053\u3044\u306eiTerm\u4e0a [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":46652,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","footnotes":""},"categories":[3459],"tags":[612,703],"class_list":["post-46550","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-review","tag-iterm2","tag-python"],"_links":{"self":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts\/46550","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/comments?post=46550"}],"version-history":[{"count":0,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts\/46550\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/media\/46652"}],"wp:attachment":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/media?parent=46550"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/categories?post=46550"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/tags?post=46550"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}