{"id":5391,"date":"2023-09-16T15:04:19","date_gmt":"2023-09-16T13:04:19","guid":{"rendered":"https:\/\/linux-bibel.at\/?p=5391"},"modified":"2023-09-16T15:04:22","modified_gmt":"2023-09-16T13:04:22","slug":"gnuplot-funktionsplotter-unter-linux","status":"publish","type":"post","link":"https:\/\/linux-bibel.at\/index.php\/2023\/09\/16\/gnuplot-funktionsplotter-unter-linux\/","title":{"rendered":"Gnuplot &#8211; Funktionsplotter unter Linux"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Mit der Software Gnuplot lassen sich unter Linux Daten wie etwa Messwerte und vieles mehr visualisieren &#8211; plotten. In diesem Beitrag sehen wir uns diese Software nun etwas n\u00e4her an.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Gnuplot installieren<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Unter auf Debian basierenden Linux-Distributionen installieren Sie diese Software ganz einfach \u00fcber die <a rel=\"noreferrer noopener\" href=\"https:\/\/www.linux-bibel-oesterreich.at\/viewtopic.php?f=10&amp;t=10\" target=\"_blank\">Paket-Verwaltung<\/a> durch das Paket &#8222;<strong>gnuplot<\/strong>&#8222;.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Gnuplot nutzen<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Gnuplot wird am <a rel=\"noreferrer noopener\" href=\"https:\/\/www.linux-bibel-oesterreich.at\/viewtopic.php?f=9&amp;t=3\" target=\"_blank\">Terminal<\/a> genutzt, Sie starten die Software am Terminal einfach durch den Befehl:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gnuplot<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Sie erhalten nun den Terminal-Prompt der Software:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnuplot.jpg\" rel=\"lightbox-0\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnuplot-1024x576.jpg\" alt=\"\" class=\"wp-image-5394\" title=\"gnuplot.jpg (198.69 KiB) 1370 mal betrachtet\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnuplot-1024x576.jpg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnuplot-300x169.jpg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnuplot-150x84.jpg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnuplot-768x432.jpg 768w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnuplot-1536x864.jpg 1536w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnuplot.jpg 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">Grunds\u00e4tzlich ist das Arbeiten mit Gnuplot sehr einfach, Sie geben zu Beginn alle Daten und Funktionen ein, starten zuletzt den Plot-Befehl. Beginnen wir ganz einfach einmal mit einer Sinuskurve:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>a=4\nf(x)=a*sin(x)\nplot f(x)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Mit &#8222;<strong>a=4<\/strong>&#8220; und &#8222;<strong>f(x)=a*sin(x)<\/strong>&#8220; definieren wir die Vorgaben, mit &#8222;<strong>plot f(x)<\/strong>&#8220; zeigen wir Gnuplot das er uns eine grafische Ausgabe f\u00fcr &#8222;<strong>f(x)<\/strong>&#8220; geben soll:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnuplot-1.jpg\" rel=\"lightbox-1\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnuplot-1-1024x576.jpg\" alt=\"\" class=\"wp-image-5395\" title=\"gnuplot-1.jpg (183.39 KiB) 1370 mal betrachtet\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnuplot-1-1024x576.jpg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnuplot-1-300x169.jpg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnuplot-1-150x84.jpg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnuplot-1-768x432.jpg 768w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnuplot-1-1536x864.jpg 1536w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnuplot-1.jpg 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">\u00dcber das Export-Icon in der Werkzeugleiste l\u00e4sst sich der Plot nun in PDF, SVG, PNG-Bild exportieren oder ausdrucken.<br><br>Mit einigen Beispielen sehen wir uns nun n\u00e4her an, was man mit der Software nun zus\u00e4tzlich anstellen kann. Mittels:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>set<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">k\u00f6nnen wir weitere Vorgaben definieren &#8211; etwa mit &#8222;<strong>title<\/strong>&#8220; einen Titel einf\u00fcgen:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>set title \"Einfache Plots\"\nplot &#91;-10:10] sin(x),atan(x),cos(atan(x))<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Der Titel selbst wird unter Anf\u00fchrungszeichen gesetzt, das Ergebnis:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnu-plot-beispiel.png\" rel=\"lightbox-2\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"480\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnu-plot-beispiel.png\" alt=\"\" class=\"wp-image-5396\" title=\"beispiel.png (32.14 KiB) 1370 mal betrachtet\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnu-plot-beispiel.png 640w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnu-plot-beispiel-300x225.png 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnu-plot-beispiel-150x113.png 150w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">Wir k\u00f6nnen auch die Gr\u00f6\u00dfe des Titels anpassen, etwa 20 Pixel H\u00f6he:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>set title \"Einfache Plots\" font \",20\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Mit &#8222;<strong>set key left box<\/strong>&#8220; k\u00f6nnen wir die Legende nach links verlegen:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>set title \"Einfache Plots\" font \",20\"\nset key left box\nplot &#91;-10:10] sin(x),atan(x),cos(atan(x))<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnu-plot-beispiel-1.png\" rel=\"lightbox-3\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"480\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnu-plot-beispiel-1.png\" alt=\"\" class=\"wp-image-5397\" title=\"beispiel-1.png (33.35 KiB) 1370 mal betrachtet\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnu-plot-beispiel-1.png 640w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnu-plot-beispiel-1-300x225.png 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnu-plot-beispiel-1-150x113.png 150w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">Mit &#8222;<strong>impulses<\/strong>&#8220; lassen sich Pulse ausgeben und mit &#8222;<strong>points<\/strong>&#8220; Punkte statt Linien:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>plot &#91;-30:20] besj0(x)*0.12e1 with impulses, (x**besj0(x))-2.5 with points<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnu-plot-beispiel-2.png\" rel=\"lightbox-4\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"480\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnu-plot-beispiel-2.png\" alt=\"\" class=\"wp-image-5398\" title=\"beispiel-2.png (16.67 KiB) 1370 mal betrachtet\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnu-plot-beispiel-2.png 640w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnu-plot-beispiel-2-300x225.png 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnu-plot-beispiel-2-150x113.png 150w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">Indem wir mittels &#8222;<strong>samples<\/strong>&#8220; mehr Datenpunkte angeben, lassen sich Kurven genauer darstellen:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>set samples 400\nplot &#91;-10:10] real(sin(x)**besj0(x))<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnu-plot-beispiel-3.png\" rel=\"lightbox-5\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"480\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnu-plot-beispiel-3.png\" alt=\"\" class=\"wp-image-5399\" title=\"beispiel-3.png (24.8 KiB) 1370 mal betrachtet\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnu-plot-beispiel-3.png 640w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnu-plot-beispiel-3-300x225.png 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnu-plot-beispiel-3-150x113.png 150w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">Nun k\u00f6nnen wir f\u00fcr bessere \u00dcbersicht Kurven nat\u00fcrlich auch f\u00fcllen, Gnuplot w\u00e4hlt die Farben hierf\u00fcr selbst &#8211; hierzu nutzen wir die Option &#8222;<strong>with filledcurves<\/strong>&#8222;:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>a=4\nf(x)=a*sin(x)\nplot f(x) with filledcurves<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnu-plot-beispiel-4.png\" rel=\"lightbox-6\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"480\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnu-plot-beispiel-4.png\" alt=\"\" class=\"wp-image-5400\" title=\"beispiel-4.png (29.54 KiB) 1370 mal betrachtet\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnu-plot-beispiel-4.png 640w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnu-plot-beispiel-4-300x225.png 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnu-plot-beispiel-4-150x113.png 150w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">Hier ein etwas extremes Beispiel (<em>da die Zeilen etwas lang werden k\u00f6nnen, werden diese durch einen Backslash in mehrere Zeilen unterteilt<\/em>):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>set title\nset key outside\nset title \"Plot mit Farben &#91;Optionen]\"\nset key outside right top vertical Right noreverse enhanced autotitle nobox\nset xrange &#91; * : * ] noreverse writeback\nset x2range &#91; * : * ] noreverse writeback\nset yrange &#91; * : * ] noreverse writeback\nset y2range &#91; * : * ] noreverse writeback\nset zrange &#91; * : * ] noreverse writeback\nset cbrange &#91; * : * ] noreverse writeback\nset rrange &#91; * : * ] noreverse writeback\nNO_ANIMATION = 1\nplot &#91;-10:10] &#91;-5:3] \\\n1.5+sin(x)\/x with filledcurve x2, \\\nsin(x)\/x with filledcurve, \\\n1+sin(x)\/x with lines, \\\n-1+sin(x)\/x with filledcurve y1=-2, \\\n-2.5+sin(x)\/x with filledcurve xy=-5,-4., \\\n-4.3+sin(x)\/x with filledcurve x1, \\\n(x&gt;3.5 ? x\/3-3 : 1\/0) with filledcurve y2<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"480\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnu-plot-beispiel-5.png\" alt=\"\" class=\"wp-image-5401\" title=\"beispiel-5.png (28.27 KiB) 1370 mal betrachtet\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnu-plot-beispiel-5.png 640w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnu-plot-beispiel-5-300x225.png 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnu-plot-beispiel-5-150x113.png 150w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Auch Fl\u00e4chen lassen sich nat\u00fcrlich problemlos darstellen &#8211; hierzu nutzen Sie den Befehl &#8222;<strong>splot<\/strong>&#8222;:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>splot x**2+y**2, x**2-y**2, x*y, (x**3+y**3)\/10<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnu-plot-beispiel-6.png\" rel=\"lightbox-7\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"480\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnu-plot-beispiel-6.png\" alt=\"\" class=\"wp-image-5402\" title=\"beispiel-6.png (114.52 KiB) 1370 mal betrachtet\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnu-plot-beispiel-6.png 640w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnu-plot-beispiel-6-300x225.png 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/09\/gnu-plot-beispiel-6-150x113.png 150w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">Die M\u00f6glichkeiten von Gnuplot sind schier unendlich, PDF-Dateien zur Dokumentation <a href=\"https:\/\/www.linux-bibel-oesterreich.at\/Downloads\/Gnuplot_5_4.pdf\">Downloads\/Gnuplot_5_4.pdf<\/a>, <a href=\"http:\/\/gnuplot.sourceforge.net\/demo_5.4\/\" target=\"_blank\" rel=\"noreferrer noopener\">Dokumentation mit vielen Beispielen<\/a>.<\/p>\n<div class=\"pld-like-dislike-wrap pld-custom\">\r\n    <div class=\"pld-like-wrap  pld-common-wrap\">\r\n    <a href=\"javascript:void(0)\" class=\"pld-like-trigger pld-like-dislike-trigger  \" title=\"Gef\u00e4llt mir\" data-post-id=\"5391\" data-trigger-type=\"like\" data-restriction=\"cookie\" data-already-liked=\"0\">\r\n                            <img src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/Daumen-Hoch.png\" alt=\"Gef\u00e4llt mir\" \/>\r\n            <\/a>\r\n    <span class=\"pld-like-count-wrap pld-count-wrap\">    <\/span>\r\n<\/div><div class=\"pld-dislike-wrap  pld-common-wrap\">\r\n    <a href=\"javascript:void(0)\" class=\"pld-dislike-trigger pld-like-dislike-trigger  \" title=\"Gef\u00e4llt mir nicht\" data-post-id=\"5391\" data-trigger-type=\"dislike\" data-restriction=\"cookie\" data-already-liked=\"0\">\r\n                            <img src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/Daumen-Runter.png\" alt=\"Gef\u00e4llt mir nicht\" \/>\r\n            <\/a>\r\n    <span class=\"pld-dislike-count-wrap pld-count-wrap\"><\/span>\r\n<\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>Mit der Software Gnuplot lassen sich unter Linux Daten wie etwa Messwerte und vieles mehr visualisieren &#8211; plotten. In diesem Beitrag sehen wir uns diese Software nun etwas n\u00e4her an. Gnuplot installieren Unter auf Debian basierenden Linux-Distributionen installieren Sie diese Software ganz einfach \u00fcber die Paket-Verwaltung durch das Paket &#8222;gnuplot&#8222;. Gnuplot nutzen Gnuplot wird am [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":5404,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[575],"tags":[],"class_list":["post-5391","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-praesentation"],"_links":{"self":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts\/5391","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/comments?post=5391"}],"version-history":[{"count":3,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts\/5391\/revisions"}],"predecessor-version":[{"id":5403,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts\/5391\/revisions\/5403"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/media\/5404"}],"wp:attachment":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/media?parent=5391"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/categories?post=5391"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/tags?post=5391"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}