

{"id":117911,"date":"2023-12-23T18:00:26","date_gmt":"2023-12-23T12:30:26","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=117911"},"modified":"2023-12-23T18:24:40","modified_gmt":"2023-12-23T12:54:40","slug":"3d-plotting-in-matplotlib","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/3d-plotting-in-matplotlib\/","title":{"rendered":"3D Plotting in Matplotlib"},"content":{"rendered":"<p>When it comes to data visualisation, 3D charts are crucial since they allow for the three-dimensional depiction of data. They allow us to investigate intricate connections and patterns that would otherwise be hidden in flat, two-dimensional displays.<\/p>\n<p>3D plots in matplotlib provide an engaging and easy-to-understand method of analysing and presenting data, especially when dealing with datasets with several dimensions.<\/p>\n<p>The 3D charting tools of Matplotlib are a powerful asset for any data visualisation project. To start, it may show complex interconnections and patterns within the data. Matplotlib allows for the attractive visualisation of complicated data structures by adding a third dimension. Two, multi-dimensional datasets may be visualised using 3D charts, which aids in the comprehension of underlying patterns and connections.<\/p>\n<h2>Using Matplotlib for Three-Dimensional Plotting<\/h2>\n<h3>Importing Necessary Libraries<\/h3>\n<p>Importing the required libraries is a prerequisite for digging into 3D plotting. The mpl_toolkits.mplot3d module must be imported with the main Matplotlib library in order to get access to the library&#8217;s 3D charting features. Make sure your Python installation has the necessary libraries for 3D plotting.<\/p>\n<p><strong>This code sample demonstrates how to do a basic library import:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">import matplotlib.pyplot as plott\r\nfrom mpl_toolkits.mplot3d import Axes3D\r\n<\/pre>\n<h3>Setting Up a Three-Dimensional Axes Object<\/h3>\n<p>Initialising a 3D axis object is required prior to creating a 3D plot. Matplotlib&#8217;s Axes3D module allows for 3D plotting in a figure&#8217;s subplot. Therefore, this is possible. To facilitate charting, the Axes3D object is linked to the diagram.<\/p>\n<p><strong>Take the following example of code that sets up a 3D axis object:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">figuree = plott.figure()\r\naxess = figuree.add_subplot(111, projection='3d')\r\n<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/11\/Setting-Up-a-Three-Dimensional-Axes-Object.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-126594 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/11\/Setting-Up-a-Three-Dimensional-Axes-Object.webp\" alt=\"Three Dimensional Axes Object\" width=\"410\" height=\"401\" \/><\/a><\/p>\n<h3>Elementary Three-Dimensional Graphs in Matplotlib<\/h3>\n<h4>Making 3D Scatter Diagrams in Matplotlib<\/h4>\n<p>To see the relationships between data points, scatter plots are often employed. Scatter plots in three dimensions provide for a more accurate depiction of data. Using Matplotlib&#8217;s scatter function, you can make 3D scatter plots in which individual data points are represented by markers placed at their corresponding coordinates.<\/p>\n<p><strong>The following is a sample of the code needed to generate a 3D scatter plot:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">import numpy as numpyy\r\nimport matplotlib.pyplot as plott\r\n\r\n\r\na = numpyy.random.rand(50)\r\nb = numpyy.random.rand(50)\r\nc = numpyy.random.rand(50)\r\n\r\n\r\nfiguree = plott.figure()\r\naxess = figuree.add_subplot(111, projection='3d')\r\n\r\n\r\naxess.scatter(a, b, c)\r\naxess.scatter(a, b, c, s=200, c='blue', marker='.')\r\n\r\n\r\naxess.set_xlabel('A')\r\naxess.set_ylabel('B')\r\naxess.set_zlabel('C')\r\n\r\n\r\nplott.show()\r\n<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/11\/Making-3D-Scatter-Diagrams.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-126595 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/11\/Making-3D-Scatter-Diagrams.webp\" alt=\"Making 3D Scatter Diagrams\" width=\"410\" height=\"400\" \/><\/a><\/p>\n<h4>3D Line Plot Generation<\/h4>\n<p>Line plots are a great way to see patterns and trends in your data. Such connections may be visualised as lines or curves shown in 3D space using 3D charting. Using Matplotlib&#8217;s plot function, one may create 3D line plots, in which a route is represented by a collection of points linked by lines or curves.<\/p>\n<p><strong>This is a code sample for making a 3D line plot:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">import matplotlib.pyplot as plott\r\nimport numpy as numpyy\r\n\r\n\r\na = numpyy.linspace(3, 30, 300)\r\nb = numpyy.sin(a)\r\nc = numpyy.cos(a)\r\n\r\n\r\nfiguree = plott.figure()\r\naxess = figuree.add_subplot(111, projection='3d')\r\n\r\n\r\naxess.plot(a, b, c, color='red', linestyle='--', linewidth=2.5)\r\n\r\n\r\nplott.show()\r\n<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/11\/3D-Line-Plot-Generation.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-126596 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/11\/3D-Line-Plot-Generation.webp\" alt=\"3D-Line-Plot-Generation \" width=\"415\" height=\"398\" \/><\/a><\/p>\n<h3>Surface Plots in Matplotlib<\/h3>\n<h4>Surface Mapping<\/h4>\n<p>Surface plots may be generated with Matplotlib, allowing for three-dimensional visualisation of functions or continuous datasets. You may make plots of surfaces with the help of the plot_surface function in the Axes3D module. The surface is defined by a set of coordinates and the value of a function or dataset at those points.<\/p>\n<p><strong>This code sample demonstrates how to generate a surface plot.<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">import matplotlib.pyplot as plott\r\nimport numpy as numpyy\r\n\r\n\r\na = numpyy.linspace(-3, 3, 100)\r\nb = numpyy.linspace(-3, 3, 100)\r\nA, B = numpyy.meshgrid(a, b)\r\nC = numpyy.sin(numpyy.sqrt(A**2 + B**2))\r\n\r\n\r\nfiguree = plott.figure()\r\naxess = figuree.add_subplot(111, projection='3d')\r\n\r\n\r\naxess.plot_surface(A, B, C, cmap='plasma', shade=True, alpha=0.9)\r\n\r\n\r\naxess.set(xlabel='A', ylabel='B', zlabel='C', title='3D Surface Plot DataFlair')\r\n\r\n\r\nplott.show()\r\n<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/11\/Surface-Mapping.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-126597 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/11\/Surface-Mapping.webp\" alt=\"Surface Mapping \" width=\"415\" height=\"421\" \/><\/a><\/p>\n<h4>Surface Plot Modifications<\/h4>\n<p>Several formatting choices may be used to improve the visual appeal of surface plots. By manipulating the surface&#8217;s lighting and shading, it is possible to draw attention to certain regions or features. Furthermore, by shifting the viewpoint, one may see the surface map from a variety of angles.<\/p>\n<p><strong>Think about using this code to tweak your surface plot:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">import matplotlib.pyplot as plott\r\nimport numpy as numpyy\r\n\r\n\r\nfiguree = plott.figure()\r\naxess = figuree.add_subplot(111, projection='3d')\r\n\r\n\r\nA, B = numpyy.meshgrid(numpyy.linspace(-3, 3, 100), numpyy.linspace(-3, 3, 100))\r\nC = numpyy.sin(numpyy.sqrt(A**2 + B**2))\r\n\r\n\r\naxess.view_init(elev=30, azim=120)\r\naxess.plot_surface(A, B, C, cmap='viridis', shade=True, alpha=0.8)\r\n\r\n\r\naxess.view_init(elev=30, azim=60)\r\naxess.plot_surface(A, B, C, cmap='plasma', shade=True, alpha=0.5)\r\n\r\n\r\nplott.show()\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/11\/Surface-Plot-Modifications-1.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-126599 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/11\/Surface-Plot-Modifications-1.webp\" alt=\"Surface Plot Modifications\" width=\"405\" height=\"398\" \/><\/a><\/p>\n<h3>Contour plots in three dimensions<\/h3>\n<p>The height or value of a function is represented by contour lines in a contour plot, making it possible to visualise 3D data on a 2D surface. Taking this idea further, we may generate three-dimensional contour plots in which the value of the function is shown as both contour lines and the vertical distance between them.<\/p>\n<p><strong>Let&#8217;s make a contour diagram in three dimensions using the equation z = sin(x) + cos(y):<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">import matplotlib.pyplot as plott\r\nimport numpy as numpyy\r\n\r\n\r\n# Generate data\r\nx_axis = numpyy.linspace(-2*numpyy.pi, 2*numpyy.pi, 100)\r\ny_axis = numpyy.linspace(-2*numpyy.pi, 2*numpyy.pi, 100)\r\nX, Y = numpyy.meshgrid(x_axis, y_axis)\r\nZ = numpyy.sin(X) + numpyy.cos(Y)\r\n\r\n\r\n# Create a 3D contour plot\r\nfiguree = plott.figure(figsize=(10, 8))\r\naxess = figuree.add_subplot(111, projection='3d')\r\naxess.contour3D(X, Y, Z, 50, cmap='plasma')\r\n\r\n\r\n# Add labels and title\r\naxess.set_xlabel('X-axis')\r\naxess.set_ylabel('Y-axis')\r\naxess.set_zlabel('Z-axis')\r\naxess.set_title('3D Contour Plot DataFlair')\r\n\r\n\r\n# Display the plot\r\nplott.show()\r\n<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/11\/Contour-plots-in-three-dimensions.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-126600 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/11\/Contour-plots-in-three-dimensions.webp\" alt=\"Contour plots in three dimensions\" width=\"643\" height=\"658\" \/><\/a><\/p>\n<p>Here, an X-Y grid is generated with the help of np.meshgrid(), and Z is computed with the help of the formula z = sin(x) + cos(y). The 3D contour plot was generated using ax.contour3D(), and it has 50 contour lines coloured using the &#8216;viridis&#8217; colormap.<\/p>\n<h4>Schematics and Topographical Maps<\/h4>\n<p>Other forms of 3D plots include wireframes and surface plots, both of which aid in the visualisation of data on a three-dimensional surface.<\/p>\n<p><strong>Using the same method z = sin(x) + cos(y), let&#8217;s get a 3D wireframe and surface plot:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">import matplotlib.pyplot as plott\r\nimport numpy as numpyy\r\n\r\n\r\n# Generate data\r\nx_axis = numpyy.linspace(-2*numpyy.pi, 2*numpyy.pi, 100)\r\ny_axis = numpyy.linspace(-2*numpyy.pi, 2*numpyy.pi, 100)\r\nX, Y = numpyy.meshgrid(x_axis, y_axis)\r\nZ = numpyy.sin(X) + numpyy.cos(Y)\r\n\r\n\r\n# Create a 3D wireframe plot\r\nfiguree = plott.figure(figsize=(10, 8))\r\naxess = figuree.add_subplot(121, projection='3d')\r\naxess.plot_wireframe(X, Y, Z, cmap='plasma')\r\n\r\n\r\n# Add labels and title\r\naxess.set_xlabel('X-axis')\r\naxess.set_ylabel('Y-axis')\r\naxess.set_zlabel('Z-axis')\r\naxess.set_title('3D Wireframe Plot DataFlair')\r\n\r\n\r\n# Create a 3D surface plot\r\naxess = figuree.add_subplot(122, projection='3d')\r\naxess.plot_surface(X, Y, Z, cmap='plasma')\r\n\r\n\r\n# Add labels and title\r\naxess.set_xlabel('X-axis')\r\naxess.set_ylabel('Y-axis')\r\naxess.set_zlabel('Z-axis')\r\naxess.set_title('3D Surface Plot DataFlair')\r\n\r\n\r\n# Display the plots\r\nplott.show()\r\n<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/11\/Schematics-and-Topographical-Maps.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-126601 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/11\/Schematics-and-Topographical-Maps.webp\" alt=\"Schematics and Topographical Maps\" width=\"817\" height=\"403\" \/><\/a><\/p>\n<p>Here, the 3D wireframe plot is made using ax.plot_wireframe() and the 3D surface plot is made with ax.plot_surface(). The &#8216;plasma&#8217; colormap is utilised by both plots.<\/p>\n<h4>Triangulations of the Surface<\/h4>\n<p>For 3D visualisation of data with erratic spacing, surface triangulations are a valuable tool. Matplotlib&#8217;s triplot() function in the mpl_toolkits.mplot3d.art3d module lets us generate triangulations of surfaces.<\/p>\n<p><strong>Let&#8217;s make a 3D surface triangulation map using some unrelated data:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">import matplotlib.pyplot as plott\r\nimport numpy as numpyy\r\nfrom mpl_toolkits.mplot3d.art3d import Poly3DCollection\r\n\r\n\r\n# Generate random data\r\nnumpyy.random.seed(42)\r\nx_axis = numpyy.random.rand(50)\r\ny_axis = numpyy.random.rand(50)\r\nz_axis = numpyy.random.rand(50)\r\n\r\n\r\n# Create a surface triangulation plot\r\nfiguree = plott.figure(figsize=(8, 6))\r\naxess = figuree.add_subplot(111, projection='3d')\r\naxess.scatter(x_axis, y_axis, z_axis, color='b')\r\n\r\n\r\n# Create the triangulation\r\ntriangles = numpyy.random.choice(range(50), size=(50, 3))\r\ntriangles = numpyy.unique(triangles, axis=0)\r\n\r\n\r\n# Create the Poly3DCollection and add it to the plot\r\nverts = [(x_axis[j], y_axis[j], z_axis[j]) for j in triangles]\r\naxess.add_collection3d(Poly3DCollection(verts, facecolors='cyan', linewidths=1, edgecolors='r', alpha=.25))\r\n\r\n\r\n# Add labels and title\r\naxess.set_xlabel('X-axis')\r\naxess.set_ylabel('Y-axis')\r\naxess.set_zlabel('Z-axis')\r\naxess.set_title('3D Surface Triangulation Plot DataFlair')\r\n\r\n\r\n# Display the plot\r\nplott.show()\r\n<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/11\/Triangulations-of-the-Surface.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-126602 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/11\/Triangulations-of-the-Surface.webp\" alt=\"Triangulations of the Surface\" width=\"498\" height=\"509\" \/><\/a><\/p>\n<p>Here, x, y, and z are assigned completely arbitrary values. Then, we generate a Poly3DCollection to depict the surface by picking triangles at random from the data points.<\/p>\n<h4>The M\u00f6bius Strip in Visual Form<\/h4>\n<p>Interesting mathematical objects with only one side and one border include M\u00f6bius strips. Using parametric equations, we may generate a 3D surface map of a M\u00f6bius strip.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">import matplotlib.pyplot as plott\r\nimport numpy as numpyy\r\nfrom mpl_toolkits.mplot3d import Axes3D\r\n\r\n\r\n# Generate data for M\u00f6bius strip\r\nu_list = numpyy.linspace(0, 2 * numpyy.pi, 100)\r\nv_list = numpyy.linspace(-1, 1, 100)\r\nU, V = numpyy.meshgrid(u_list, v_list)\r\nX = (1 + V \/ 2 * numpyy.cos(U \/ 2)) * numpyy.cos(U)\r\nY = (1 + V \/ 2 * numpyy.cos(U \/ 2)) * numpyy.sin(U)\r\nZ = V \/ 2 * numpyy.sin(U \/ 2)\r\n\r\n\r\n# Create a 3D surface plot of the M\u00f6bius strip\r\nfiguree = plott.figure(figsize=(10, 8))\r\naxess = figuree.add_subplot(111, projection='3d')\r\naxess.plot_surface(X, Y, Z, cmap='viridis')\r\n\r\n\r\n# Add labels and title\r\naxess.set_xlabel('X-axis')\r\naxess.set_ylabel('Y-axis')\r\naxess.set_zlabel('Z-axis')\r\naxess.set_title('M\u00f6bius Strip Surface Plot DataFlair')\r\n\r\n\r\n# Display the plot\r\nplott.show()\r\n<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/11\/The-Mobius-Strip-in-Visual-Form.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-126604 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/11\/The-Mobius-Strip-in-Visual-Form.webp\" alt=\"The Mobius Strip in Visual Form \" width=\"643\" height=\"658\" \/><\/a><\/p>\n<p>The spots on the M\u00f6bius strip are generated using parametric equations in this case. Next, a 3D surface plot is generated with the help of ax.plot_surface().<\/p>\n<h3>3D Graphs Can Be Saved And Exported<\/h3>\n<h4>Exporting Graphs as Images<\/h4>\n<p>If you plan on showing your 3D plots to others or publishing them, you may wish to save them as images. The savefig function in Matplotlib enables you to store the existing figure as a variety of image formats. These include PNG and JPEG. The saved plots may have their picture quality and resolution modified.<\/p>\n<p><strong>Here&#8217;s some sample code to use if you want to export a 3D plot into a single image:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">import matplotlib.pyplot as plott\r\nfrom mpl_toolkits.mplot3d import Axes3D\r\n\r\n\r\nfiguree = plott.figure()\r\naxess = figuree.add_subplot(111, projection='3d')\r\n\r\n\r\naxess.scatter([2, 4, 6, 8, 10], [3, 6, 9, 12, 15], [5, 8, 12, 4, 2])\r\n\r\n\r\nplott.savefig('3d_plot.png', dpi=400)\r\nplott.savefig('3d_plot.jpg', dpi=400)\r\n<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/11\/Exporting-Graphs-as-Images-.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-126605 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/11\/Exporting-Graphs-as-Images-.webp\" alt=\"Exporting Graphs as Images \" width=\"407\" height=\"398\" \/><\/a><\/p>\n<h4>Exported Dynamic Three-Dimensional Graphs<\/h4>\n<p>Matplotlib can output both static picture files and dynamic 3D plots in the form of HTML files. To enable others to engage with the visualisations, just distribute or embed this file on a website. Web-based tools and frameworks, such as Plotly, that provide dynamic visual analytics, may help you do this.<\/p>\n<p><strong>In order to export a 3D plot into an interactive HTML file, below is a sample of the code that may be used:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">import plotly.graph_objects as go\r\nimport numpy as numpyy\r\n\r\n\r\n# Sample data for the 3D plot\r\nA = [2, 4, 6, 8, 10]\r\nB = [3, 5, 7, 9, 2]\r\nC = [5, 3, 8, 2, 1]\r\n\r\n\r\n# Convert Matplotlib 3D plot to Plotly 3D plot\r\nfiguree = go.Figure(data=[go.Mesh3d(x=A, y=B, z=C, color='red')])\r\n\r\n\r\n# Export Plotly 3D plot as an interactive HTML file\r\nfiguree.write_html('interactive_plot.html')\r\n\r\n\r\n# Show the Plotly 3D plot in the Jupyter Notebook or another interactive environment\r\nfiguree.show()\r\n<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/11\/Dynamic-Three-Dimensional-Graphs.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-126606 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/11\/Dynamic-Three-Dimensional-Graphs.webp\" alt=\" Dynamic Three Dimensional Graphs\" width=\"632\" height=\"480\" \/><\/a><\/p>\n<h3>Conclusion<\/h3>\n<p>To sum up, the 3D plotting features of Matplotlib enable the development of impressive visualisations. With the help of the third dimension, intricate connections and multi-dimensional data sets may be accurately shown. You may begin delving into Matplotlib&#8217;s 3D plots and gaining new insights into your data using the accompanying code snippets. Have fun concocting your plans!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When it comes to data visualisation, 3D charts are crucial since they allow for the three-dimensional depiction of data. They allow us to investigate intricate connections and patterns that would otherwise be hidden in&#46;&#46;&#46;<\/p>\n","protected":false},"author":86671,"featured_media":117913,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27777],"tags":[29104,29105,29107,8601,29088,29106],"class_list":["post-117911","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-matplotlib-tutorials","tag-3d-plots-in-matplotlib","tag-3d-plotting-in-matplotlib","tag-3d-plotting-in-python-matplotlib","tag-matplotlib","tag-matplotlib-tutorials","tag-three-dimensional-plotting-in-matplotlib"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>3D Plotting in Matplotlib - DataFlair<\/title>\n<meta name=\"description\" content=\"With the help of the third dimension, intricate connections and multi-dimensional data sets may be accurately shown.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/3d-plotting-in-matplotlib\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"3D Plotting in Matplotlib - DataFlair\" \/>\n<meta property=\"og:description\" content=\"With the help of the third dimension, intricate connections and multi-dimensional data sets may be accurately shown.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/3d-plotting-in-matplotlib\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-12-23T12:30:26+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-23T12:54:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/08\/3d-plots-in-matplotlib.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1141\" \/>\n\t<meta property=\"og:image:height\" content=\"593\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"TechVidvan Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"TechVidvan Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"3D Plotting in Matplotlib - DataFlair","description":"With the help of the third dimension, intricate connections and multi-dimensional data sets may be accurately shown.","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:\/\/data-flair.training\/blogs\/3d-plotting-in-matplotlib\/","og_locale":"en_US","og_type":"article","og_title":"3D Plotting in Matplotlib - DataFlair","og_description":"With the help of the third dimension, intricate connections and multi-dimensional data sets may be accurately shown.","og_url":"https:\/\/data-flair.training\/blogs\/3d-plotting-in-matplotlib\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2023-12-23T12:30:26+00:00","article_modified_time":"2023-12-23T12:54:40+00:00","og_image":[{"width":1141,"height":593,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/08\/3d-plots-in-matplotlib.webp","type":"image\/webp"}],"author":"TechVidvan Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"TechVidvan Team","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/3d-plotting-in-matplotlib\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/3d-plotting-in-matplotlib\/"},"author":{"name":"TechVidvan Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/0e594f928e31fc96628ac40f6ae74f49"},"headline":"3D Plotting in Matplotlib","datePublished":"2023-12-23T12:30:26+00:00","dateModified":"2023-12-23T12:54:40+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/3d-plotting-in-matplotlib\/"},"wordCount":1103,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/3d-plotting-in-matplotlib\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/08\/3d-plots-in-matplotlib.webp","keywords":["3D plots in matplotlib","3D plotting in matplotlib","3D plotting in python matplotlib","Matplotlib","matplotlib tutorials","three dimensional plotting in matplotlib"],"articleSection":["Matplotlib Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/3d-plotting-in-matplotlib\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/3d-plotting-in-matplotlib\/","url":"https:\/\/data-flair.training\/blogs\/3d-plotting-in-matplotlib\/","name":"3D Plotting in Matplotlib - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/3d-plotting-in-matplotlib\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/3d-plotting-in-matplotlib\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/08\/3d-plots-in-matplotlib.webp","datePublished":"2023-12-23T12:30:26+00:00","dateModified":"2023-12-23T12:54:40+00:00","description":"With the help of the third dimension, intricate connections and multi-dimensional data sets may be accurately shown.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/3d-plotting-in-matplotlib\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/3d-plotting-in-matplotlib\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/3d-plotting-in-matplotlib\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/08\/3d-plots-in-matplotlib.webp","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/08\/3d-plots-in-matplotlib.webp","width":1141,"height":593,"caption":"3d plots in matplotlib"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/3d-plotting-in-matplotlib\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Matplotlib Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/matplotlib-tutorials\/"},{"@type":"ListItem","position":3,"name":"3D Plotting in Matplotlib"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/0e594f928e31fc96628ac40f6ae74f49","name":"TechVidvan Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/c89190da3d4010c71ba476b618ab10fdc2335c82cdfa0ad5002d98d0f2473444?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/c89190da3d4010c71ba476b618ab10fdc2335c82cdfa0ad5002d98d0f2473444?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c89190da3d4010c71ba476b618ab10fdc2335c82cdfa0ad5002d98d0f2473444?s=96&d=mm&r=g","caption":"TechVidvan Team"},"description":"TechVidvan Team provides high-quality content &amp; courses on AI, ML, Data Science, Data Engineering, Data Analytics, programming, Python, DSA, Android, Flutter, full stack web dev, MERN, and many latest technology.","url":"https:\/\/data-flair.training\/blogs\/author\/test001\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/117911","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/86671"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=117911"}],"version-history":[{"count":6,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/117911\/revisions"}],"predecessor-version":[{"id":132301,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/117911\/revisions\/132301"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/117913"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=117911"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=117911"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=117911"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}