{"id":303,"date":"2018-07-04T09:28:27","date_gmt":"2018-07-04T06:28:27","guid":{"rendered":"http:\/\/talhacelik.com.tr\/?p=303"},"modified":"2018-07-10T10:26:59","modified_gmt":"2018-07-10T07:26:59","slug":"c-plotting-library-mplotlib","status":"publish","type":"post","link":"https:\/\/talhacelik.com.tr\/index.php\/2018\/07\/04\/c-plotting-library-mplotlib\/","title":{"rendered":"C++ Plot Library (MPlotlib) with Bitmap"},"content":{"rendered":"<p style=\"text-align: justify;\">Open source <strong>MPlot<\/strong> k\u00fct\u00fcphanesi C++ programlama dilini kullanarak kolay ve h\u0131zl\u0131 bir \u015fekilde 2 boyutu\u00a0<strong>grafik\u00a0\u00e7izimi<\/strong> yapmay\u0131 sa\u011flar.<\/p>\n<p style=\"text-align: justify;\">Bu k\u00fct\u00fcphanenin di\u011fer k\u00fct\u00fcphanelerden fark\u0131 olu\u015fturdu\u011fu grafikleri <strong><a href=\"http:\/\/www.wiki-zero.net\/wiki\/en\/BMP_file_format\">bitmap<\/a>\u00a0<\/strong>\u00fczerine \u00e7izmesidir ve g\u00f6r\u00fcnt\u00fcde herhangi bir bozulma ya\u015fanmadan yeniden boyutland\u0131rma yap\u0131labilir.<\/p>\n<hr \/>\n<figure id=\"attachment_314\" aria-describedby=\"caption-attachment-314\" style=\"width: 192px\" class=\"wp-caption alignright\"><a href=\"http:\/\/mathgl.sourceforge.net\/doc_en\/Main.html\"><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-314 size-full\" src=\"http:\/\/talhacelik.com.tr\/wp-content\/uploads\/2018\/07\/fog-sm.png\" alt=\"http:\/\/mathgl.sourceforge.net\/doc_en\/Adding-fog.html\" width=\"192\" height=\"144\" \/><\/a><figcaption id=\"caption-attachment-314\" class=\"wp-caption-text\">MathGL ile 3 Boyutlu bir grafik \u00e7izimi<\/figcaption><\/figure>\n<p>Alternatif grafik k\u00fct\u00fcphaneleri de mevcuttur, bunlar :<\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li><a href=\"http:\/\/www.wiki-zero.net\/index.php?q=aHR0cHM6Ly9lbi53aWtpcGVkaWEub3JnL3dpa2kvUXd0\">Qwt<\/a><\/li>\n<li><a href=\"http:\/\/www.wiki-zero.net\/index.php?q=aHR0cHM6Ly9lbi53aWtpcGVkaWEub3JnL3dpa2kvUExwbG90\">PlPlot\u00a0<\/a><\/li>\n<li><a href=\"http:\/\/mathgl.sourceforge.net\/doc_en\/Main.html\">MathGL\u00a0<\/a><\/li>\n<li><a href=\"http:\/\/koolplot.codecutter.org\/\">koolplot<\/a><\/li>\n<li><a href=\"http:\/\/www.gnuplot.info\">GNU Plot<\/a><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<hr \/>\n<p>\u00d6rnek:<\/p>\n<pre>#<span class=\"pl-k\">include<\/span> <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>mplotlib.cpp<span class=\"pl-pds\">\"<\/span><\/span>\r\n<span class=\"pl-k\">int<\/span> <span class=\"pl-en\">main<\/span>()\r\n{ \r\n MPlotlib <span class=\"pl-smi\">mp2<\/span>(<span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>m2<span class=\"pl-pds\">\"<\/span><\/span>); <span class=\"pl-c\">\/\/ set bitmap file name\t\t<\/span>\r\n mp2.<span class=\"pl-c1\">set_max<\/span>(<span class=\"pl-c1\">200<\/span> ,<span class=\"pl-c1\">200<\/span>); <span class=\"pl-c\">\/\/ bitmap file width and height\t<\/span>\r\n mp2.<span class=\"pl-c1\">set_grid<\/span>(<span class=\"pl-c1\">true<\/span>); <span class=\"pl-c\">\/\/ open grid<\/span>\r\n\r\n<span class=\"pl-k\"> float<\/span> x2[] = {<span class=\"pl-c1\">0.80<\/span> ,<span class=\"pl-c1\">1.10<\/span> ,<span class=\"pl-c1\">2.13<\/span> ,<span class=\"pl-c1\">3.20<\/span> ,<span class=\"pl-c1\">4.25<\/span> ,<span class=\"pl-c1\">5.72<\/span> ,<span class=\"pl-c1\">6.85<\/span> ,<span class=\"pl-c1\">7.110<\/span> ,<span class=\"pl-c1\">8.120<\/span> ,<span class=\"pl-c1\">9.155<\/span>};\r\n<span class=\"pl-k\"> float<\/span> y2[] = {.<span class=\"pl-c1\">80<\/span> ,<span class=\"pl-c1\">2.10<\/span> ,<span class=\"pl-c1\">3.20<\/span> ,<span class=\"pl-c1\">4.30<\/span> ,<span class=\"pl-c1\">5.40<\/span> ,<span class=\"pl-c1\">6.99<\/span> ,<span class=\"pl-c1\">7.111<\/span> ,<span class=\"pl-c1\">8.129<\/span> ,<span class=\"pl-c1\">8.137<\/span> ,<span class=\"pl-c1\">9.210<\/span>};\r\n\t\r\n<span class=\"pl-c1\"> std::sort<\/span>(x2, x2 + <span class=\"pl-c1\">10<\/span>); <span class=\"pl-c\">\/\/ array_size + array<\/span>\r\n<span class=\"pl-c1\"> std::sort<\/span>(y2, y2 + <span class=\"pl-c1\">10<\/span>); <span class=\"pl-c\">\/\/ array_size + array<\/span>\r\n\t\r\n mp2.<span class=\"pl-c1\">draw_plot<\/span>(x2 ,y2 ,<span class=\"pl-c1\">10<\/span> ,<span class=\"pl-s\"><span class=\"pl-pds\">'<\/span>c<span class=\"pl-pds\">'<\/span><\/span>);\r\n\t\r\n<span class=\"pl-k\"> return<\/span> <span class=\"pl-c1\">0<\/span>;\r\n}<\/pre>\n<figure id=\"attachment_315\" aria-describedby=\"caption-attachment-315\" style=\"width: 197px\" class=\"wp-caption alignleft\"><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-315 \" src=\"http:\/\/talhacelik.com.tr\/wp-content\/uploads\/2018\/07\/yes_grid.png\" alt=\"https:\/\/github.com\/tlhcelik\/MPlotlib\/blob\/master\/pics\/yes_grid.png\" width=\"197\" height=\"191\" \/><figcaption id=\"caption-attachment-315\" class=\"wp-caption-text\">\u00d6rnek kodun \u00e7\u0131kt\u0131s\u0131 (grid a\u00e7\u0131k)<\/figcaption><\/figure>\n<figure id=\"attachment_316\" aria-describedby=\"caption-attachment-316\" style=\"width: 206px\" class=\"wp-caption alignright\"><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-316\" src=\"http:\/\/talhacelik.com.tr\/wp-content\/uploads\/2018\/07\/no_grid.png\" alt=\"\" width=\"206\" height=\"198\" \/><figcaption id=\"caption-attachment-316\" class=\"wp-caption-text\">\u00d6rnek kodun \u00e7\u0131kt\u0131s\u0131 (grid kapal\u0131)<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify;\">\u0130lk sat\u0131rda her zaman oldu\u011fu gibi k\u00fct\u00fcphaneyi kodumuza dahil ediyoruz. Ard\u0131ndan <em>MPlotlib mp2(&#8220;plot_name&#8221;);<\/em>\u00a0komutu ile <em>mp2\u00a0<\/em>adl\u0131 nesnemizi olu\u015fturuyoruz ve olu\u015ftururken bitmap dosyam\u0131z\u0131n ad\u0131n\u0131 belirtiyoruz.<\/p>\n<p style=\"text-align: justify;\">\u0130stenildi\u011fi takdirde bitmap dosyam\u0131z\u0131n ad\u0131n\u0131 <em>mp2.set_plot_name(&#8220;plot_name&#8221;);<\/em> komutu ile de belirtebiliyoruz.<\/p>\n<p style=\"text-align: justify;\">Bir sonraki sat\u0131rda <em>mp2.set_max(200, 200);<\/em> komutu ile olu\u015fturulacak bitmap dosyam\u0131z\u0131n maximum geni\u015flik ve y\u00fckseklik de\u011ferlerini ayarl\u0131yoruz.<\/p>\n<p style=\"text-align: justify;\">mp2.set_grid(); bu fonksiyon ile \u00e7izilen noktalar\u0131n \u00fczerinden gecen x ve y do\u011frular\u0131n\u0131 \u00e7iziyor.<\/p>\n<p style=\"text-align: justify;\">Son olarak <em>mp2.draw_plot(x_degerleri, y_degerleri, degerlerin_say\u0131s\u0131, &#8216;grafik_tipi&#8217;);\u00a0<\/em>fonksiyonu ile grafi\u011fimizi \u00e7izdirip kay\u0131t ediyoruz.<\/p>\n<p>Grafik tipleri:<\/p>\n<ul>\n<li>&#8216;c&#8217; -&gt; Circle<\/li>\n<li>&#8216;b&#8217; -&gt; Block<\/li>\n<li>&#8216;t&#8217; -&gt; Tringle<\/li>\n<li>&#8216;s&#8217; -&gt; Square<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Open source MPlot k\u00fct\u00fcphanesi C++ programlama dilini kullanarak kolay ve h\u0131zl\u0131 bir \u015fekilde 2 boyutu\u00a0grafik\u00a0\u00e7izimi yapmay\u0131 sa\u011flar. Bu k\u00fct\u00fcphanenin di\u011fer k\u00fct\u00fcphanelerden fark\u0131 olu\u015fturdu\u011fu grafikleri bitmap\u00a0\u00fczerine \u00e7izmesidir ve g\u00f6r\u00fcnt\u00fcde herhangi bir bozulma ya\u015fanmadan yeniden boyutland\u0131rma yap\u0131labilir. Alternatif grafik k\u00fct\u00fcphaneleri de mevcuttur, bunlar : &nbsp; Qwt PlPlot\u00a0 MathGL\u00a0 koolplot GNU Plot &nbsp; \u00d6rnek: #include &#8220;mplotlib.cpp&#8221; int main() &hellip;<\/p>\n","protected":false},"author":1,"featured_media":310,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[14,36,35],"_links":{"self":[{"href":"https:\/\/talhacelik.com.tr\/index.php\/wp-json\/wp\/v2\/posts\/303"}],"collection":[{"href":"https:\/\/talhacelik.com.tr\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/talhacelik.com.tr\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/talhacelik.com.tr\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/talhacelik.com.tr\/index.php\/wp-json\/wp\/v2\/comments?post=303"}],"version-history":[{"count":9,"href":"https:\/\/talhacelik.com.tr\/index.php\/wp-json\/wp\/v2\/posts\/303\/revisions"}],"predecessor-version":[{"id":321,"href":"https:\/\/talhacelik.com.tr\/index.php\/wp-json\/wp\/v2\/posts\/303\/revisions\/321"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/talhacelik.com.tr\/index.php\/wp-json\/wp\/v2\/media\/310"}],"wp:attachment":[{"href":"https:\/\/talhacelik.com.tr\/index.php\/wp-json\/wp\/v2\/media?parent=303"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/talhacelik.com.tr\/index.php\/wp-json\/wp\/v2\/categories?post=303"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/talhacelik.com.tr\/index.php\/wp-json\/wp\/v2\/tags?post=303"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}