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 use Python to realize Radar Graph

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

Share

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

This article mainly explains "how to use Python to achieve radar map", the content of the article is simple and clear, easy to learn and understand, now please follow the editor's ideas slowly in depth, together to study and learn "how to use Python to achieve radar map"!

Line chart

Python source code:

Import matplotlib.pyplot as pltimport matplotlib.font_manager as fmyy= [1 yy,color='r',linewidth=2,linestyle='-',label='Data 2) plt.plot (xx,color='b',linewidth=2,linestyle='--',label='Data 2') plt.legend (loc=3) # loc is to adjust the position of the legend plt.xlabel. Fontsize=14) # fontsize word size fontproperties is the font plt.ylabel ('y-axis name', fontproperties='simhei') plt.title ('line chart', fontproperties='simhei') plt.ylim (0Magne10) plt.show () radar map

Python source code:

Import matplotlib.pyplot as pltimport numpy as nptheta=np.array ([0.25, theta*np.pi,r,'ro-',lw=2) # theta is a corner, np.pi=3.1415926....r is a path. Ro'r is red, o is the shape, lw is the width of the line plt.fill (theta*np.pi,r,facecolor='r',alpha=0.2) # facecolor is the color of the fill, alpha is the transparency plt.ylim (0100) # defines the radar value per lap plt.show ()

Q3

Column chart

Python source code:

Import numpy as npimport matplotlib.pyplot as pltN=5men= (20Jing 35je 30jue 35jue 27) wmen= (25pint 32jort 34je 20je 25) menstd= (2pint 3jorn 4pint 1le 2) womstd= (3pens 5pens 2pens 3pens 3) ind=np.arange (N) width=0.25p1=plt.bar (ind,men,width,yerr=menstd) # yerr is the error p2=plt.bar (ind,wmen,width,bottom=men,yerr=womstd) # bottom, so? Start drawing the column plt.ylabel ('scores') plt.title (' scores by group and gender') plt.xticks (ind, ('1) legend 2 () 3) plt.yticks (np.arange (0)) plt.legend ((p1 [0], p2 [0]), ('nan','nv')) # legend is the legend plt.show ()

Q4

Three-dimensional graph

Python source code:

From matplotlib import pyplot as pltfrom mpl_toolkits.mplot3d import Axes3Dimport numpy as np# defines the axis fig4 = plt.figure () ax4 = plt.axes (projection='3d') # to generate 3D data xx = np.arange (- 5meme 50.1) yy = np.arange (- 5pje 50.1) XMagi Y = np.meshgrid (xx, yy) Z = np.sin (np.sqrt (X**2+Y**2)) # drawing ax4.plot_surface Cmap='winter') # generate Surfac Alpha is used to control the transparency of ax4.contour (XMagi ZMagnezdirdust projection, offset=-3,cmap= "rainbow") # to generate z-direction projection, and to cast it on the x-direction projection of ax4.contour (Xmaiy plane, offset=-6,cmap= "rainbow") #, to generate x-direction projection, and to generate y-direction projection on the y-direction plane of ax4.contour (Xmai YMagneZMZ dircircle projection, offset=6,cmap= "rainbow") # Throw it to the xmerz plane # ax4.contourf (Xmairez Zrecoverzschilzschaft, offset=6,cmap= "rainbow") # to generate a y-direction projection fill, and cast it into the xmerz plane. Contourf () function # set display range ax4.set_xlabel ('X') ax4.set_xlim (- 6,4) # Open axis range display projection ax4.set_ylabel ('Y') ax4.set_ylim (- 4,6) ax4.set_zlabel ('Z') ax4.set_zlim (- 3,3) plt.show ()

Thank you for your reading, the above is the content of "how to use Python to achieve radar map". After the study of this article, I believe you have a deeper understanding of how to use Python to achieve radar map, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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