In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 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 draw the radar map of Arena of Valor's heroic ability. The content of the explanation in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to use Python to draw the radar map of Arena of Valor's heroic ability.
Now that I have the following table, I need to draw the radar map in the second picture (similar to the player ability diagram in fifa Football and Arena of Valor).
The radar graph function uses the following packages:
Import math
Import numpy as np
Import matplotlib.pyplot as plt
Import matplotlib.colors as mcolors
Import Chinese related fonts
# Import Chinese
Import matplotlib.font_manager as font_manager
Font_dirs = ['. / font']
Font_files = font_manager.findSystemFonts (fontpaths=font_dirs)
Font_list = font_manager.createFontList (font_files)
Font_manager.fontManager.ttflist.extend (font_list)
Plt.rcParams ['font.family'] =' SimHei'
# enable theme
Plt.style.use ('ggplot')
Get the range of polar diameter
# get the range of polar diameter
Def get_range (data_list):
Max = min = 0
For _, data in data_list.items ():
For v in data:
If v
< min: min = v if v >Max:
Max = v
Return [min, max]
Generate capability distribution map
# generate capability distribution map
Def generate_ability_map (abilities, data_list, rows=3):
Min, max = get_range (data_list)
# divide the circle equally according to the ability item
Angles = np.linspace (0,2 * np.pi, len (abilities), endpoint=False)
Angles = np.append (angles, angles [0])
# generate n subgraphs
Fg, axes = plt.subplots (math.ceil (len (data_list) / rows), rows, subplot_kw=dict (polar=True), figsize= (9mem9))
# adjust the spacing of subimages
Plt.subplots_adjust (wspace = 0.6, hspace = 0.6)
# break up into an one-dimensional array
Axes = axes.ravel ()
# get all supported colors
Colors = list (mcolors.TABLEAU_COLORS)
# Loop drawing
I = 0
For name, data in data_list.items ():
Data = np.append (np.array (data), data [0])
Ax = axes [I]
# draw lines
Ax.plot (angles, data, color=colors [I])
# fill Color
Ax.fill (angles, data, alpha=0.7, color=colors [I])
# set Angle
Ax.set_xticks (angles)
# set axis name
Ax.set_xticklabels (abilities)
# setting name
Ax.set_title (name, size=10, color='black', position= (0.5,0.4))
# set the minimum extreme diameter
Ax.set_rmin (min)
# set the maximum value of the extreme diameter (the maximum value plus 0.1, or the outermost circle of the line is not fully displayed)
Ax.set_rmax (max + 0.1)
I = I + 1
Plt.show ()
Call:
# data
Abilities = ['flexibility', 'functionality', 'stationarity', 'security', 'durability', 'economy']
Super_heros = {
'landing at a fixed point': [2, 1, 5, 5, 4, 3]
'Landing at any point': [5, 5, 5, 2, 3, 3, 4]
'Local best fall': [4, 5, 4, 4, 4, 3, 4]
}
# drawing
Generate_ability_map (abilities, super_heros)
After the program runs, you get the picture at the beginning of the article:
Thank you for your reading, the above is the content of "how to use Python to draw the radar map of Arena of Valor's heroic ability". After the study of this article, I believe you have a deeper understanding of how to use Python to draw Arena of Valor's heroic ability 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.