Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to draw 3D surfaces by matplotlib

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you how to draw 3D surfaces in matplotlib, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's learn about it!

Train of thought introduction:

Next we will use matplotlib to draw the Sinc function:

1. First of all, determine the interval drawn, the range of independent variables x belongs to [- 8,8] and y belongs to [- 8,8]. Therefore, it is necessary to change the grid point coordinates {(xmemy)} of XBI y.

two。 Draw the 3D surface of function on the interval by matplotlib

3. Show it.

Show the 3D effect first:

Program list:

Import tensorflow as tfimport matplotlib.pyplot as pltfrom mpl_toolkits.mplot3d import Axes3Dx = tf.linspace (- 8.,8100) # set the coordinate interval of x y = tf.linspace (- 8.,8100) # set the coordinate interval of x, y = tf.meshgrid (x, y) # generate grid points And then split it and return z = tf.sqrt (x-rays 2 + y-rays 2) z = tf.sin (z) / z # sinc function to realize fig = plt.figure () ax = Axes3D (fig) # draw the sinc function 3D curve ax.contour3D (x.numpy (), y.numpy (), z.numpy (), 50) plt.show () these are all the contents of the article "how to draw 3D surfaces by matplotlib". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report