{"id":554,"date":"2014-07-24T11:16:17","date_gmt":"2014-07-24T11:16:17","guid":{"rendered":"https:\/\/block.arch.ethz.ch\/blog\/?p=554"},"modified":"2014-07-24T11:32:27","modified_gmt":"2014-07-24T11:32:27","slug":"plotting-network-data","status":"publish","type":"post","link":"https:\/\/block.arch.ethz.ch\/blog\/2014\/07\/plotting-network-data\/","title":{"rendered":"Plotting network data"},"content":{"rendered":"<p>In this post, we will take a look at plotting network data with <a href=\"http:\/\/matplotlib.org\" target=\"_blank\">matplotlib<\/a>.<\/p>\n<p><!--more--><\/p>\n<pre class=\"brush: py\">\r\nimport matplotlib.pyplot as plt\r\nfrom mpl_toolkits.mplot3d import Axes3D \r\n\r\nfig = plt.figure()\r\nax  = fig.gca(projection='3d')\r\n\r\nfor u, v in edges:\r\n    ax.plot([vertices[u][0], vertices[v][0]], \r\n           [vertices[u][1], vertices[v][1]], \r\n           [vertices[u][2], vertices[v][2]], color='k')\r\nfor i in points:\r\n    ax.scatter(vertices[i][0], vertices[i][1], vertices[i][2], \r\n              color='r', s=30)\r\n\r\nax.scatter([0, 10], [0, 10], [0, 10], color='w', s=1)\r\nax.set_xlim([0, 10])\r\nax.set_ylim([0, 10])\r\nax.set_zlim([0, 10])\r\nax.set_aspect('equal')\r\nplt.show()\r\n<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/block.arch.ethz.ch\/blog\/wp-content\/uploads\/2014\/07\/saddle-e1406191264737.png\" alt=\"saddle\" width=\"480\" height=\"412\" class=\"aligncenter size-full wp-image-530\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this post, we will take a look at plotting network data with matplotlib.<\/p>\n","protected":false},"author":11,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-554","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/block.arch.ethz.ch\/blog\/wp-json\/wp\/v2\/posts\/554","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/block.arch.ethz.ch\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/block.arch.ethz.ch\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/block.arch.ethz.ch\/blog\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/block.arch.ethz.ch\/blog\/wp-json\/wp\/v2\/comments?post=554"}],"version-history":[{"count":4,"href":"https:\/\/block.arch.ethz.ch\/blog\/wp-json\/wp\/v2\/posts\/554\/revisions"}],"predecessor-version":[{"id":564,"href":"https:\/\/block.arch.ethz.ch\/blog\/wp-json\/wp\/v2\/posts\/554\/revisions\/564"}],"wp:attachment":[{"href":"https:\/\/block.arch.ethz.ch\/blog\/wp-json\/wp\/v2\/media?parent=554"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/block.arch.ethz.ch\/blog\/wp-json\/wp\/v2\/categories?post=554"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/block.arch.ethz.ch\/blog\/wp-json\/wp\/v2\/tags?post=554"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}