{"id":101595,"date":"2019-09-12T01:46:22","date_gmt":"2019-09-12T01:46:22","guid":{"rendered":"http:\/\/ahay.org\/blog\/?p=101595"},"modified":"2019-09-12T01:49:16","modified_gmt":"2019-09-12T01:49:16","slug":"plotting-with-matplotlib","status":"publish","type":"post","link":"https:\/\/ahay.org\/blog\/2019\/09\/12\/plotting-with-matplotlib\/","title":{"rendered":"Plotting with matplotlib"},"content":{"rendered":"<p><a href=\"https:\/\/matplotlib.org\/\">Matplotlib<\/a> is a popular Python library for 2D plotting, which emulates (and exceeds) the plotting functionality of MATLAB.<\/p>\n<p>At the <a href=\"\/blog\/2018\/11\/28\/working-workshop-2018\/\">Madagascar Working Workshop<\/a> in 2018, a couple of new scripts were added to simplify plotting with Matplotlib in Madagascar.<\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/ahay\/src\/blob\/master\/user\/fomels\/Mmatplotlib.py\">sfmatplotlib<\/a> can be used to plot RSF files.You can use it as follows:\n<div class=\"code-box\"><div class=\"code-title\"><i class=\"fa fa-code\"><\/i> <div class=\"pull-right\"><a href=\"#\" class=\"btn btn-default btn-xs toggle-code\" data-toggle=\"tooltip\" title=\"Toggle code\"><i class=\"fa fa-toggle-up\"><\/i><\/a><\/div><\/div><pre ><code class=\"bash\">sfmatplotlib &lt;matplotlib function&gt; &lt;plot options&gt; [format=eps] &lt; inp.rsf [ &gt; out.eps] \n<\/code><\/pre><\/div>\n<p>Without the standard output, the figure is displayed on the screen.<\/p>\n<p><img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2019\/09\/matplotlib.png\" alt=\"\" title=\"\"><\/p>\n<p>The figure above was generated with<\/p>\n<div class=\"code-box\"><div class=\"code-title\"><i class=\"fa fa-code\"><\/i> <div class=\"pull-right\"><a href=\"#\" class=\"btn btn-default btn-xs toggle-code\" data-toggle=\"tooltip\" title=\"Toggle code\"><i class=\"fa fa-toggle-up\"><\/i><\/a><\/div><\/div><pre ><code class=\"bash\">sfspike n1=1000 k1=300 | sfbandpass fhi=2 phase=y| sfmatplotlib plot title=\"Welcome to Maagascar\" grid=y linewidth=3 format=png &gt; figure.png\n<\/code><\/pre><\/div>\n<p>Futher enhancements are possible.<\/li>\n<li><a href=\"https:\/\/github.com\/ahay\/src\/blob\/master\/user\/cdacosta\/Mpgreywfl.py\">sfpgreywfl<\/a> is a script contributed by Carlos da Costa that uses <strong>matplotlib<\/strong> for plotting a seismic  wavefiels overlaid on the velocity model.<br \/>\n<img decoding=\"async\" src=\"https:\/\/ahay.org\/blog\/wp-content\/uploads\/2019\/09\/pgreywfl.gif\" alt=\"\" title=\"\"><\/p>\n<p>The figure above was generated with<\/p>\n<div class=\"code-box\"><div class=\"code-title\"><i class=\"fa fa-code\"><\/i> <div class=\"pull-right\"><a href=\"#\" class=\"btn btn-default btn-xs toggle-code\" data-toggle=\"tooltip\" title=\"Toggle code\"><i class=\"fa fa-toggle-up\"><\/i><\/a><\/div><\/div><pre ><code class=\"bash\">sfpgreywfl &lt; wavefield.rsf bg=velocity.rsf wflcmap=seismic title=\"Wavefield\" barlabel=\"Velocity (m\/s)\" tmin=0.08 savefile=figure.gif\n<\/code><\/pre><\/div>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Matplotlib is a popular Python library for 2D plotting, which emulates (and exceeds) the plotting functionality of MATLAB. At the Madagascar Working Workshop in 2018, a couple of new scripts were added to simplify plotting with Matplotlib in Madagascar. sfmatplotlib can be used to plot RSF files.You can use it as follows: sfmatplotlib &lt;matplotlib function&gt; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":""},"categories":[3],"tags":[],"class_list":["post-101595","post","type-post","status-publish","format-standard","hentry","category-programs"],"_links":{"self":[{"href":"https:\/\/ahay.org\/blog\/wp-json\/wp\/v2\/posts\/101595","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ahay.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ahay.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ahay.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ahay.org\/blog\/wp-json\/wp\/v2\/comments?post=101595"}],"version-history":[{"count":6,"href":"https:\/\/ahay.org\/blog\/wp-json\/wp\/v2\/posts\/101595\/revisions"}],"predecessor-version":[{"id":102413,"href":"https:\/\/ahay.org\/blog\/wp-json\/wp\/v2\/posts\/101595\/revisions\/102413"}],"wp:attachment":[{"href":"https:\/\/ahay.org\/blog\/wp-json\/wp\/v2\/media?parent=101595"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ahay.org\/blog\/wp-json\/wp\/v2\/categories?post=101595"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ahay.org\/blog\/wp-json\/wp\/v2\/tags?post=101595"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}