{"id":1692,"date":"2014-10-31T22:13:17","date_gmt":"2014-10-31T21:13:17","guid":{"rendered":"http:\/\/denbeke.be\/blog\/?p=1692"},"modified":"2014-10-31T22:17:56","modified_gmt":"2014-10-31T21:17:56","slug":"latex-graphs-with-coordinates-input","status":"publish","type":"post","link":"https:\/\/denbeke.be\/blog\/software\/latex-graphs-with-coordinates-input\/","title":{"rendered":"LaTeX: graphs with coordinates input"},"content":{"rendered":"<p>In one of my\u00a0previous posts I wrote about plotting LaTeX function graphs using <code>pgfplots<\/code>. But sometimes you don&#8217;t have a function rule, but just a set of data points.<\/p>\n<p>Using pgfplots you can easily plot a function using those\u00a0coordinates. The following Tex code will draw a line through each of the data points.<\/p>\n<pre><code class=\"tex\">\\begin{tikzpicture}[&gt;=stealth]\r\n    \r\n    \\begin{axis}[\r\n        height=\\textwidth\/1.5,\r\n        width=\\textwidth\/1.5,\r\n        xmin=0,xmax=4,\r\n        ymin=0,ymax=9,\r\n        axis x line=middle,\r\n        axis y line=middle,\r\n        axis line style=-&gt;,\r\n        xlabel={$x$},\r\n        ylabel={$y$},\r\n    ]\r\n        \r\n  \r\n    % plot some coordinates    \r\n    \\addplot[mark=*, blue, line width=1pt] coordinates {\r\n        (0,   4)\r\n        (0.5, 6)\r\n        (1,   2)\r\n        (1.5, 3.5)\r\n        (2,   4)\r\n        (2.5, 6)\r\n        (3,   5)\r\n        (3.5, 3)\r\n        (4,   5.5)\r\n       };\r\n       \r\n   \\end{axis}\r\n        \r\n\\end{tikzpicture}<\/code><\/pre>\n<p>Which will yield the following result:<\/p>\n<figure id=\"attachment_1693\" aria-describedby=\"caption-attachment-1693\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/denbeke.be\/blog\/software\/latex-graphs-with-coordinates-input\/attachment\/latex-pgfplots-coordinates-with-marker\/\" rel=\"attachment wp-att-1693\"><img loading=\"lazy\" class=\"wp-image-1693 size-medium\" src=\"http:\/\/denbeke.be\/blog\/wp-content\/uploads\/2014\/10\/LaTeX-pgfplots-coordinates-with-marker-300x291.png\" alt=\"Coordinates plotted using LaTeX pgfplots (with marker)\" width=\"300\" height=\"291\" srcset=\"https:\/\/denbeke.be\/blog\/wp-content\/uploads\/2014\/10\/LaTeX-pgfplots-coordinates-with-marker-300x291.png 300w, https:\/\/denbeke.be\/blog\/wp-content\/uploads\/2014\/10\/LaTeX-pgfplots-coordinates-with-marker.png 408w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-1693\" class=\"wp-caption-text\">Coordinates plotted using LaTeX pgfplots (with marker)<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p>Naturally you can draw a line without printing dots in the points, you just set <code>mark=none<\/code>.<\/p>\n<figure id=\"attachment_1694\" aria-describedby=\"caption-attachment-1694\" style=\"width: 300px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/denbeke.be\/blog\/software\/latex-graphs-with-coordinates-input\/attachment\/latex-pgfplots-coordinates-without-marker\/\" rel=\"attachment wp-att-1694\"><img loading=\"lazy\" class=\"wp-image-1694 size-medium\" src=\"http:\/\/denbeke.be\/blog\/wp-content\/uploads\/2014\/10\/LaTeX-pgfplots-coordinates-without-marker-300x293.png\" alt=\"Coordinates plotted using LaTeX pgfplots (without marker)\" width=\"300\" height=\"293\" srcset=\"https:\/\/denbeke.be\/blog\/wp-content\/uploads\/2014\/10\/LaTeX-pgfplots-coordinates-without-marker-300x293.png 300w, https:\/\/denbeke.be\/blog\/wp-content\/uploads\/2014\/10\/LaTeX-pgfplots-coordinates-without-marker.png 400w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-1694\" class=\"wp-caption-text\">Coordinates plotted using LaTeX pgfplots (without marker)<\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>In one of my\u00a0previous posts I wrote about plotting LaTeX function graphs using pgfplots. But sometimes you don&#8217;t have a function rule, but just a set of data points. Using pgfplots you can easily plot a function using those\u00a0coordinates. The following Tex code will draw a line through each of the data points. \\begin{tikzpicture}[&gt;=stealth] \\begin{axis}[ [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[161],"tags":[233,229,234,230],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v15.6.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>LaTeX: graphs with coordinates input &ndash; DenBeke<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/denbeke.be\/blog\/software\/latex-graphs-with-coordinates-input\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"LaTeX: graphs with coordinates input &ndash; DenBeke\" \/>\n<meta property=\"og:description\" content=\"In one of my\u00a0previous posts I wrote about plotting LaTeX function graphs using pgfplots. But sometimes you don&#8217;t have a function rule, but just a set of data points. Using pgfplots you can easily plot a function using those\u00a0coordinates. The following Tex code will draw a line through each of the data points. \\begin{tikzpicture}[&gt;=stealth] \\begin{axis}[ [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/denbeke.be\/blog\/software\/latex-graphs-with-coordinates-input\/\" \/>\n<meta property=\"og:site_name\" content=\"DenBeke\" \/>\n<meta property=\"article:published_time\" content=\"2014-10-31T21:13:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2014-10-31T21:17:56+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/denbeke.be\/blog\/wp-content\/uploads\/2014\/10\/LaTeX-pgfplots-coordinates-with-marker-300x291.png\" \/>\n<meta name=\"twitter:card\" content=\"summary\" \/>\n<meta name=\"twitter:creator\" content=\"@MthsBk\" \/>\n<meta name=\"twitter:site\" content=\"@MthsBk\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\">\n\t<meta name=\"twitter:data1\" content=\"1 minute\">\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/denbeke.be\/blog\/#website\",\"url\":\"https:\/\/denbeke.be\/blog\/\",\"name\":\"DenBeke\",\"description\":\"Mathias Beke\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/denbeke.be\/blog\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/denbeke.be\/blog\/software\/latex-graphs-with-coordinates-input\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"http:\/\/denbeke.be\/blog\/wp-content\/uploads\/2014\/10\/LaTeX-pgfplots-coordinates-with-marker-300x291.png\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/denbeke.be\/blog\/software\/latex-graphs-with-coordinates-input\/#webpage\",\"url\":\"https:\/\/denbeke.be\/blog\/software\/latex-graphs-with-coordinates-input\/\",\"name\":\"LaTeX: graphs with coordinates input &ndash; DenBeke\",\"isPartOf\":{\"@id\":\"https:\/\/denbeke.be\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/denbeke.be\/blog\/software\/latex-graphs-with-coordinates-input\/#primaryimage\"},\"datePublished\":\"2014-10-31T21:13:17+00:00\",\"dateModified\":\"2014-10-31T21:17:56+00:00\",\"author\":{\"@id\":\"https:\/\/denbeke.be\/blog\/#\/schema\/person\/386878f712fe3fe22227216f087772dc\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/denbeke.be\/blog\/software\/latex-graphs-with-coordinates-input\/\"]}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/denbeke.be\/blog\/#\/schema\/person\/386878f712fe3fe22227216f087772dc\",\"name\":\"Mathias Beke\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/denbeke.be\/blog\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/015ba35e6ce4f5859e3888ca99807575?s=96&d=mm&r=g\",\"caption\":\"Mathias Beke\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/denbeke.be\/blog\/wp-json\/wp\/v2\/posts\/1692"}],"collection":[{"href":"https:\/\/denbeke.be\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/denbeke.be\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/denbeke.be\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/denbeke.be\/blog\/wp-json\/wp\/v2\/comments?post=1692"}],"version-history":[{"count":3,"href":"https:\/\/denbeke.be\/blog\/wp-json\/wp\/v2\/posts\/1692\/revisions"}],"predecessor-version":[{"id":1697,"href":"https:\/\/denbeke.be\/blog\/wp-json\/wp\/v2\/posts\/1692\/revisions\/1697"}],"wp:attachment":[{"href":"https:\/\/denbeke.be\/blog\/wp-json\/wp\/v2\/media?parent=1692"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/denbeke.be\/blog\/wp-json\/wp\/v2\/categories?post=1692"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/denbeke.be\/blog\/wp-json\/wp\/v2\/tags?post=1692"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}