{"id":372,"date":"2013-05-30T16:16:37","date_gmt":"2013-05-30T15:16:37","guid":{"rendered":"http:\/\/numbercrunch.de\/blog\/?p=372"},"modified":"2023-01-18T23:53:19","modified_gmt":"2023-01-18T22:53:19","slug":"visualizing-vector-fields","status":"publish","type":"post","link":"https:\/\/www.numbercrunch.de\/blog\/2013\/05\/visualizing-vector-fields\/","title":{"rendered":"Visualizing vector fields"},"content":{"rendered":"<p style=\"text-align: justify;\">A <a href=\"http:\/\/en.wikipedia.org\/wiki\/Vector_field\">vector field<\/a> assigns to every point in space some vector. Vector fields are used in many branches of physics, e.g., to describe force fields, electromagnetic fields or velocity fields. Two-dimensional vector fields can be easily visualized using Python and the popular <a href=\"http:\/\/matplotlib.org\">matplotlib<\/a> package. As an example let us visualize the vector field<br \/>\n\\begin{equation}<br \/>\n\\vec E(\\vec r) =<br \/>\n\\begin{pmatrix}<br \/>\nE_x(x, y) \\\\ E_y(x, y)<br \/>\n\\end{pmatrix} =<br \/>\n\\begin{pmatrix}<br \/>\n-y\\frac{\\exp(-(x^2+y^2))}{\\sqrt{x^2+y^2}} \\\\<br \/>\nx\\frac{\\exp(-(x^2+y^2))}{\\sqrt{x^2+y^2}}<br \/>\n\\end{pmatrix}\\,.<br \/>\n\\end{equation}Using the <a href=\"http:\/\/matplotlib.org\/api\/pyplot_api.html#matplotlib.pyplot.quiver\">quiver<\/a> function this is not difficult as the following example shows.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">#!\/usr\/bin\/env python\n\n# import useful modules\nimport matplotlib \nfrom numpy import *\nfrom pylab import *\n\n# use LaTeX, choose nice some looking fonts and tweak some settings\nmatplotlib.rc('font', family='serif')\nmatplotlib.rc('font', size=16)\nmatplotlib.rc('legend', fontsize=16)\nmatplotlib.rc('legend', numpoints=1)\nmatplotlib.rc('legend', handlelength=1.5)\nmatplotlib.rc('legend', frameon=False)\nmatplotlib.rc('xtick.major', pad=7)\nmatplotlib.rc('xtick.minor', pad=7)\nmatplotlib.rc('text', usetex=True)\nmatplotlib.rc('text.latex', \n              preamble=[r'\\usepackage[T1]{fontenc}',\n                        r'\\usepackage{amsmath}',\n                        r'\\usepackage{txfonts}',\n                        r'\\usepackage{textcomp}'])\n\nclose('all')\nfigure(figsize=(6, 4.5))\n\n# generate grid\nx=linspace(-2, 2, 32)\ny=linspace(-1.5, 1.5, 24)\nx, y=meshgrid(x, y)\n# calculate vector field\nvx=-y\/sqrt(x**2+y**2)*exp(-(x**2+y**2))\nvy= x\/sqrt(x**2+y**2)*exp(-(x**2+y**2))\n# plot vecor field\nquiver(x, y, vx, vy, pivot='middle', headwidth=4, headlength=6)\nxlabel('$x$')\nylabel('$y$')\naxis('image')\nshow()\nsavefig('visualization_vector_fields_1.png')<\/pre>\n<figure id=\"attachment_405\" aria-describedby=\"caption-attachment-405\" style=\"width: 459px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/numbercrunch.de\/blog\/wp-content\/uploads\/2013\/05\/visualization_vector_fields_11.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-405\" src=\"\/\/numbercrunch.de\/blog\/wp-content\/uploads\/2013\/05\/visualization_vector_fields_11.png\" alt=\"\" width=\"459\" height=\"347\" srcset=\"https:\/\/www.numbercrunch.de\/blog\/wp-content\/uploads\/2013\/05\/visualization_vector_fields_11.png 459w, https:\/\/www.numbercrunch.de\/blog\/wp-content\/uploads\/2013\/05\/visualization_vector_fields_11-300x226.png 300w\" sizes=\"(max-width: 459px) 100vw, 459px\" \/><\/a><figcaption id=\"caption-attachment-405\" class=\"wp-caption-text\">A vector field plotted using the quiver function.<\/figcaption><\/figure>\n<p style=\"text-align: justify;\">In a second example we will try to visualize the vector field of an electric dipole consisting of a positive charge $q$ at $\\vec r_+$ and a negative charge $-q$ at $\\vec r_-$. Its electromagnetic field is given by<br \/>\n\\begin{equation}<br \/>\n\\vec E(\\vec r) = \\frac{q}{4\\pi\\varepsilon_0}\\left(<br \/>\n\\frac{\\vec r-\\vec r_+}{|\\vec r-\\vec r_+|^3} &#8211; \\frac{\\vec r-\\vec r_-}{|\\vec r-\\vec r_-|^3}<br \/>\n\\right)<br \/>\n\\end{equation}and we will plot its vector field in the $x$-$y$-plane. Similarly to our first example the Python code is given as follows.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">#!\/usr\/bin\/env python\n\n# import useful modules\nimport matplotlib \nfrom numpy import *\nfrom pylab import *\n\n# use LaTeX, choose nice some looking fonts and tweak some settings\nmatplotlib.rc('font', family='serif')\nmatplotlib.rc('font', size=16)\nmatplotlib.rc('legend', fontsize=16)\nmatplotlib.rc('legend', numpoints=1)\nmatplotlib.rc('legend', handlelength=1.5)\nmatplotlib.rc('legend', frameon=False)\nmatplotlib.rc('xtick.major', pad=7)\nmatplotlib.rc('xtick.minor', pad=7)\nmatplotlib.rc('text', usetex=True)\nmatplotlib.rc('text.latex', \n              preamble=[r'\\usepackage[T1]{fontenc}',\n                        r'\\usepackage{amsmath}',\n                        r'\\usepackage{txfonts}',\n                        r'\\usepackage{textcomp}'])\n\nclose('all')\nfigure(figsize=(6, 4.5))\n\n# generate grid\nx=linspace(-2, 2, 32)\ny=linspace(-1.5, 1.5, 24)\nx, y=meshgrid(x, y)\n\ndef E(q, a, x, y):\n    return q*(x-a[0])\/((x-a[0])**2+(y-a[1])**2)**(1.5), \\\n        q*(y-a[1])\/((x-a[0])**2+(y-a[1])**2)**(1.5)\n\n# calculate vector field\nEx1, Ey1=E(1, [-1, 0], x, y)\nEx2, Ey2=E(-1, [1, 0], x, y)\nEx=Ex1+Ex2\nEy=Ey1+Ey2\n# plot vecor field\nquiver(x, y, Ex, Ey, pivot='middle', headwidth=4, headlength=6)\nxlabel('$x$')\nylabel('$y$')\naxis('image')\nshow()\nsavefig('visualization_vector_fields_2.png')<\/pre>\n<figure id=\"attachment_406\" aria-describedby=\"caption-attachment-406\" style=\"width: 459px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/numbercrunch.de\/blog\/wp-content\/uploads\/2013\/05\/visualization_vector_fields_21.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-406\" src=\"\/\/numbercrunch.de\/blog\/wp-content\/uploads\/2013\/05\/visualization_vector_fields_21.png\" alt=\"The vector field of an electric dipole in the $x$-$y$-plane with $r_+=(-1,0,0)$ and $r_-=(1,0,0)$.\" width=\"459\" height=\"347\" srcset=\"https:\/\/www.numbercrunch.de\/blog\/wp-content\/uploads\/2013\/05\/visualization_vector_fields_21.png 459w, https:\/\/www.numbercrunch.de\/blog\/wp-content\/uploads\/2013\/05\/visualization_vector_fields_21-300x226.png 300w\" sizes=\"(max-width: 459px) 100vw, 459px\" \/><\/a><figcaption id=\"caption-attachment-406\" class=\"wp-caption-text\">The vector field of an electric dipole in the $x$-$y$-plane with $r_+=(-1,0,0)$ and $r_-=(1,0,0)$.<\/figcaption><\/figure>\n<p style=\"text-align: justify;\">The dipole&#8217;s vector field has singularities at $r_+$ and $r_-$ where the length of the vectors to plot dives. Consequently the plot above looks not very eye candy. One possible measure to avoid vectors of diverging length is to normalize the all vectors to unity as shown below.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">#!\/usr\/bin\/env python\n\n# import usefull modules\nimport matplotlib \nfrom numpy import *\nfrom pylab import *\n\n# use LaTeX, choose nice some looking fonts and tweak some settings\nmatplotlib.rc('font', family='serif')\nmatplotlib.rc('font', size=16)\nmatplotlib.rc('legend', fontsize=16)\nmatplotlib.rc('legend', numpoints=1)\nmatplotlib.rc('legend', handlelength=1.5)\nmatplotlib.rc('legend', frameon=False)\nmatplotlib.rc('xtick.major', pad=7)\nmatplotlib.rc('xtick.minor', pad=7)\nmatplotlib.rc('text', usetex=True)\nmatplotlib.rc('text.latex', \n              preamble=[r'\\usepackage[T1]{fontenc}',\n                        r'\\usepackage{amsmath}',\n                        r'\\usepackage{txfonts}',\n                        r'\\usepackage{textcomp}'])\n\nclose('all')\nfigure(figsize=(6, 4.5))\n\n# generate grid\nx=linspace(-2, 2, 32)\ny=linspace(-1.5, 1.5, 24)\nx, y=meshgrid(x, y)\n\ndef E(q, a, x, y):\n    return q*(x-a[0])\/((x-a[0])**2+(y-a[1])**2)**(1.5), \\\n        q*(y-a[1])\/((x-a[0])**2+(y-a[1])**2)**(1.5)\n\n# calculate vector field\nEx1, Ey1=E(1, [-1, 0], x, y)\nEx2, Ey2=E(-1, [1, 0], x, y)\nEx=Ex1+Ex2\nEy=Ey1+Ey2\n# plot normalized vecor field\nquiver(x, y, Ex\/sqrt(Ex**2+Ey**2), Ey\/sqrt(Ex**2+Ey**2), pivot='middle', headwidth=4, headlength=6)\nxlabel('$x$')\nylabel('$y$')\naxis('image')\nshow()\nsavefig('visualization_vector_fields_3.png')<\/pre>\n<p><a href=\"http:\/\/numbercrunch.de\/blog\/wp-content\/uploads\/2013\/05\/visualization_vector_fields_31.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-407\" src=\"\/\/numbercrunch.de\/blog\/wp-content\/uploads\/2013\/05\/visualization_vector_fields_31.png\" alt=\"The vector field of an electric dipole in the $x$-$y$-plane with $r_+=(-1,0,0)$ and $r_-=(1,0,0)$. All vectors normalized to unity. Thus, the plot visualizes the direction of the electric dipole field, but not the field strength.\" width=\"459\" height=\"347\" srcset=\"https:\/\/www.numbercrunch.de\/blog\/wp-content\/uploads\/2013\/05\/visualization_vector_fields_31.png 459w, https:\/\/www.numbercrunch.de\/blog\/wp-content\/uploads\/2013\/05\/visualization_vector_fields_31-300x226.png 300w\" sizes=\"(max-width: 459px) 100vw, 459px\" \/><\/a><\/p>\n<p>The vector field of an electric dipole in the $x$-$y$-plane with $r_+=(-1,0,0)$ and $r_-=(1,0,0)$. All vectors normalized to unity. Thus, the plot visualizes the direction of the electric dipole field, but not the field strength.<\/p>\n<p style=\"text-align: justify;\">Normalizing the vector field to unity has the drawback of loosing information about the field strength. An alternative approach to get rid of extremely long vectors is to plot only those vectors whose lengths is below some given threshold $E_{\\mathrm{max}}$. This can be archived by replacing vectors which are too long by some invalid value, that is by the value nan (not a number).<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">#!\/usr\/bin\/env python\n\n# import useful modules\nimport matplotlib \nfrom numpy import *\nfrom pylab import *\n\n# use LaTeX, choose nice some looking fonts and tweak some settings\nmatplotlib.rc('font', family='serif')\nmatplotlib.rc('font', size=16)\nmatplotlib.rc('legend', fontsize=16)\nmatplotlib.rc('legend', numpoints=1)\nmatplotlib.rc('legend', handlelength=1.5)\nmatplotlib.rc('legend', frameon=False)\nmatplotlib.rc('xtick.major', pad=7)\nmatplotlib.rc('xtick.minor', pad=7)\nmatplotlib.rc('text', usetex=True)\nmatplotlib.rc('text.latex', \n              preamble=[r'\\usepackage[T1]{fontenc}',\n                        r'\\usepackage{amsmath}',\n                        r'\\usepackage{txfonts}',\n                        r'\\usepackage{textcomp}'])\n\nclose('all')\nfigure(figsize=(6, 4.5))\n\n# generate grid\nx=linspace(-2, 2, 32)\ny=linspace(-1.5, 1.5, 24)\nx, y=meshgrid(x, y)\n\ndef E(q, a, x, y):\n    return q*(x-a[0])\/((x-a[0])**2+(y-a[1])**2)**(1.5), \\\n        q*(y-a[1])\/((x-a[0])**2+(y-a[1])**2)**(1.5)\n\n# calculate vector field\nEx1, Ey1=E(1, [-1, 0], x, y)\nEx2, Ey2=E(-1, [1, 0], x, y)\nEx=Ex1+Ex2\nEy=Ey1+Ey2\n# remove vector with length larger than E_max\nE_max=10\nE=sqrt(Ex**2+Ey**2)\nk=find(E.flat[:]&gt;E_max)\nEx.flat[k]=nan\nEy.flat[k]=nan\n# plot vecor field\nquiver(x, y, Ex, Ey, pivot='middle', headwidth=4, headlength=6)\nxlabel('$x$')\nylabel('$y$')\naxis('image')\nshow()\nsavefig('visualization_vector_fields_4.png')<\/pre>\n<p style=\"text-align: justify;\"><a href=\"https:\/\/numbercrunch.de\/blog\/wp-content\/uploads\/2013\/05\/visualization_vector_fields_41.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-408\" src=\"https:\/\/numbercrunch.de\/blog\/wp-content\/uploads\/2013\/05\/visualization_vector_fields_41.png\" alt=\"The vector field of an electric dipole in the $x$-$y$-plane with $r_+=(-1,0,0)$ and $r_-=(1,0,0)$. All vectors longer than some threshold are removed from the plot. Thus, the plot visualizes both the direction and the strength of the electric dipole field while avoiding vectors of  extreme length.\" width=\"459\" height=\"347\" srcset=\"https:\/\/www.numbercrunch.de\/blog\/wp-content\/uploads\/2013\/05\/visualization_vector_fields_41.png 459w, https:\/\/www.numbercrunch.de\/blog\/wp-content\/uploads\/2013\/05\/visualization_vector_fields_41-300x226.png 300w\" sizes=\"(max-width: 459px) 100vw, 459px\" \/><\/a><\/p>\n<p>The vector field of an electric dipole in the $x$-$y$-plane with $r_+=(-1,0,0)$ and $r_-=(1,0,0)$. All vectors longer than some threshold are removed from the plot. Thus, the plot visualizes both the direction and the strength of the electric dipole field while avoiding vectors of extreme length.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A vector field assigns to every point in space some vector. Vector fields are used in many branches of physics, e.g., to describe force fields, electromagnetic fields or velocity fields. Two-dimensional vector fields can be easily visualized using Python and the popular matplotlib package. As an example let us visualize the vector field \\begin{equation} \\vec&hellip; <a href=\"https:\/\/www.numbercrunch.de\/blog\/2013\/05\/visualizing-vector-fields\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Visualizing vector fields<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-372","post","type-post","status-publish","format-standard","hentry","category-python"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Visualizing vector fields - Number Crunch<\/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:\/\/www.numbercrunch.de\/blog\/2013\/05\/visualizing-vector-fields\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Visualizing vector fields - Number Crunch\" \/>\n<meta property=\"og:description\" content=\"A vector field assigns to every point in space some vector. Vector fields are used in many branches of physics, e.g., to describe force fields, electromagnetic fields or velocity fields. Two-dimensional vector fields can be easily visualized using Python and the popular matplotlib package. As an example let us visualize the vector field begin{equation} vec&hellip; Continue reading Visualizing vector fields\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.numbercrunch.de\/blog\/2013\/05\/visualizing-vector-fields\/\" \/>\n<meta property=\"og:site_name\" content=\"Number Crunch\" \/>\n<meta property=\"article:published_time\" content=\"2013-05-30T15:16:37+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-01-18T22:53:19+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/numbercrunch.de\/blog\/wp-content\/uploads\/2013\/05\/visualization_vector_fields_41.png\" \/>\n<meta name=\"author\" content=\"Heiko Bauke\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Heiko Bauke\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"160 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.numbercrunch.de\/blog\/2013\/05\/visualizing-vector-fields\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.numbercrunch.de\/blog\/2013\/05\/visualizing-vector-fields\/\"},\"author\":{\"name\":\"Heiko Bauke\",\"@id\":\"https:\/\/www.numbercrunch.de\/blog\/#\/schema\/person\/e73eab65b1721dd0c3d408edb887e413\"},\"headline\":\"Visualizing vector fields\",\"datePublished\":\"2013-05-30T15:16:37+00:00\",\"dateModified\":\"2023-01-18T22:53:19+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.numbercrunch.de\/blog\/2013\/05\/visualizing-vector-fields\/\"},\"wordCount\":460,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.numbercrunch.de\/blog\/#\/schema\/person\/e73eab65b1721dd0c3d408edb887e413\"},\"image\":{\"@id\":\"https:\/\/www.numbercrunch.de\/blog\/2013\/05\/visualizing-vector-fields\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/numbercrunch.de\/blog\/wp-content\/uploads\/2013\/05\/visualization_vector_fields_41.png\",\"articleSection\":[\"Python\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.numbercrunch.de\/blog\/2013\/05\/visualizing-vector-fields\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.numbercrunch.de\/blog\/2013\/05\/visualizing-vector-fields\/\",\"url\":\"https:\/\/www.numbercrunch.de\/blog\/2013\/05\/visualizing-vector-fields\/\",\"name\":\"Visualizing vector fields - Number Crunch\",\"isPartOf\":{\"@id\":\"https:\/\/www.numbercrunch.de\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.numbercrunch.de\/blog\/2013\/05\/visualizing-vector-fields\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.numbercrunch.de\/blog\/2013\/05\/visualizing-vector-fields\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/numbercrunch.de\/blog\/wp-content\/uploads\/2013\/05\/visualization_vector_fields_41.png\",\"datePublished\":\"2013-05-30T15:16:37+00:00\",\"dateModified\":\"2023-01-18T22:53:19+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.numbercrunch.de\/blog\/2013\/05\/visualizing-vector-fields\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.numbercrunch.de\/blog\/2013\/05\/visualizing-vector-fields\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.numbercrunch.de\/blog\/2013\/05\/visualizing-vector-fields\/#primaryimage\",\"url\":\"https:\/\/numbercrunch.de\/blog\/wp-content\/uploads\/2013\/05\/visualization_vector_fields_41.png\",\"contentUrl\":\"https:\/\/numbercrunch.de\/blog\/wp-content\/uploads\/2013\/05\/visualization_vector_fields_41.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.numbercrunch.de\/blog\/2013\/05\/visualizing-vector-fields\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.numbercrunch.de\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Visualizing vector fields\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.numbercrunch.de\/blog\/#website\",\"url\":\"https:\/\/www.numbercrunch.de\/blog\/\",\"name\":\"Number Crunch\",\"description\":\"A computational science blog.\",\"publisher\":{\"@id\":\"https:\/\/www.numbercrunch.de\/blog\/#\/schema\/person\/e73eab65b1721dd0c3d408edb887e413\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.numbercrunch.de\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.numbercrunch.de\/blog\/#\/schema\/person\/e73eab65b1721dd0c3d408edb887e413\",\"name\":\"Heiko Bauke\",\"logo\":{\"@id\":\"https:\/\/www.numbercrunch.de\/blog\/#\/schema\/person\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Visualizing vector fields - Number Crunch","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.numbercrunch.de\/blog\/2013\/05\/visualizing-vector-fields\/","og_locale":"en_US","og_type":"article","og_title":"Visualizing vector fields - Number Crunch","og_description":"A vector field assigns to every point in space some vector. Vector fields are used in many branches of physics, e.g., to describe force fields, electromagnetic fields or velocity fields. Two-dimensional vector fields can be easily visualized using Python and the popular matplotlib package. As an example let us visualize the vector field begin{equation} vec&hellip; Continue reading Visualizing vector fields","og_url":"https:\/\/www.numbercrunch.de\/blog\/2013\/05\/visualizing-vector-fields\/","og_site_name":"Number Crunch","article_published_time":"2013-05-30T15:16:37+00:00","article_modified_time":"2023-01-18T22:53:19+00:00","og_image":[{"url":"https:\/\/numbercrunch.de\/blog\/wp-content\/uploads\/2013\/05\/visualization_vector_fields_41.png","type":"","width":"","height":""}],"author":"Heiko Bauke","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Heiko Bauke","Est. reading time":"160 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.numbercrunch.de\/blog\/2013\/05\/visualizing-vector-fields\/#article","isPartOf":{"@id":"https:\/\/www.numbercrunch.de\/blog\/2013\/05\/visualizing-vector-fields\/"},"author":{"name":"Heiko Bauke","@id":"https:\/\/www.numbercrunch.de\/blog\/#\/schema\/person\/e73eab65b1721dd0c3d408edb887e413"},"headline":"Visualizing vector fields","datePublished":"2013-05-30T15:16:37+00:00","dateModified":"2023-01-18T22:53:19+00:00","mainEntityOfPage":{"@id":"https:\/\/www.numbercrunch.de\/blog\/2013\/05\/visualizing-vector-fields\/"},"wordCount":460,"commentCount":0,"publisher":{"@id":"https:\/\/www.numbercrunch.de\/blog\/#\/schema\/person\/e73eab65b1721dd0c3d408edb887e413"},"image":{"@id":"https:\/\/www.numbercrunch.de\/blog\/2013\/05\/visualizing-vector-fields\/#primaryimage"},"thumbnailUrl":"https:\/\/numbercrunch.de\/blog\/wp-content\/uploads\/2013\/05\/visualization_vector_fields_41.png","articleSection":["Python"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.numbercrunch.de\/blog\/2013\/05\/visualizing-vector-fields\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.numbercrunch.de\/blog\/2013\/05\/visualizing-vector-fields\/","url":"https:\/\/www.numbercrunch.de\/blog\/2013\/05\/visualizing-vector-fields\/","name":"Visualizing vector fields - Number Crunch","isPartOf":{"@id":"https:\/\/www.numbercrunch.de\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.numbercrunch.de\/blog\/2013\/05\/visualizing-vector-fields\/#primaryimage"},"image":{"@id":"https:\/\/www.numbercrunch.de\/blog\/2013\/05\/visualizing-vector-fields\/#primaryimage"},"thumbnailUrl":"https:\/\/numbercrunch.de\/blog\/wp-content\/uploads\/2013\/05\/visualization_vector_fields_41.png","datePublished":"2013-05-30T15:16:37+00:00","dateModified":"2023-01-18T22:53:19+00:00","breadcrumb":{"@id":"https:\/\/www.numbercrunch.de\/blog\/2013\/05\/visualizing-vector-fields\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.numbercrunch.de\/blog\/2013\/05\/visualizing-vector-fields\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.numbercrunch.de\/blog\/2013\/05\/visualizing-vector-fields\/#primaryimage","url":"https:\/\/numbercrunch.de\/blog\/wp-content\/uploads\/2013\/05\/visualization_vector_fields_41.png","contentUrl":"https:\/\/numbercrunch.de\/blog\/wp-content\/uploads\/2013\/05\/visualization_vector_fields_41.png"},{"@type":"BreadcrumbList","@id":"https:\/\/www.numbercrunch.de\/blog\/2013\/05\/visualizing-vector-fields\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.numbercrunch.de\/blog\/"},{"@type":"ListItem","position":2,"name":"Visualizing vector fields"}]},{"@type":"WebSite","@id":"https:\/\/www.numbercrunch.de\/blog\/#website","url":"https:\/\/www.numbercrunch.de\/blog\/","name":"Number Crunch","description":"A computational science blog.","publisher":{"@id":"https:\/\/www.numbercrunch.de\/blog\/#\/schema\/person\/e73eab65b1721dd0c3d408edb887e413"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.numbercrunch.de\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.numbercrunch.de\/blog\/#\/schema\/person\/e73eab65b1721dd0c3d408edb887e413","name":"Heiko Bauke","logo":{"@id":"https:\/\/www.numbercrunch.de\/blog\/#\/schema\/person\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/www.numbercrunch.de\/blog\/wp-json\/wp\/v2\/posts\/372"}],"collection":[{"href":"https:\/\/www.numbercrunch.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.numbercrunch.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.numbercrunch.de\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.numbercrunch.de\/blog\/wp-json\/wp\/v2\/comments?post=372"}],"version-history":[{"count":39,"href":"https:\/\/www.numbercrunch.de\/blog\/wp-json\/wp\/v2\/posts\/372\/revisions"}],"predecessor-version":[{"id":1001,"href":"https:\/\/www.numbercrunch.de\/blog\/wp-json\/wp\/v2\/posts\/372\/revisions\/1001"}],"wp:attachment":[{"href":"https:\/\/www.numbercrunch.de\/blog\/wp-json\/wp\/v2\/media?parent=372"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.numbercrunch.de\/blog\/wp-json\/wp\/v2\/categories?post=372"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.numbercrunch.de\/blog\/wp-json\/wp\/v2\/tags?post=372"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}