In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail how to draw a column chart in Python. The content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
If you do not have PyEcharts installed, install PyEcharts first:
Data = pd.read_excel ('DGyGYQ. Xlsx') # descending order data = data.sort_values (by= ['add'], ascending= [False]) by adding new fields
Once PyEcharts is installed, you can import the modules you need to use:
C = (# create histogram object and set the size, or not, use the default size directly to Bar (init_opts=opts.InitOpts (width= "800px", height= "400px")) # set the X-axis data series, take only the first 10 data, and convert to the list format .add _ xaxis (data. Province [: 10] .tolist () # sets Y-axis data series and display color. Only the first 10 data are taken and converted to list format. Add _ yaxis (", data. Add [: 10] .tolist () # set the title and location of the chart. Set _ global_opts (title_opts=opts.TitleOpts (title= "add TOP10", pos_left= "center")) # render the bar chart to html .render ("bar chart .html") through the render () method
Import data:
C = (# create histogram object and set the size, or not, use the default size directly to Bar (init_opts=opts.InitOpts (width= "800px", height= "400px")) # set the X-axis data series, take only the first 10 data, and convert to the list format .add _ xaxis (data. Province [: 10] .tolist () # sets Y-axis data series and display color. Only the first 10 data are taken and converted to list format. Add _ yaxis (", data. Add [: 10] .tolist () # set the title and location of the chart. Set _ global_opts (title_opts=opts.TitleOpts (title= "add TOP10", pos_left= "center")) # render the bar chart to html .render ("bar chart .html") through the render () method
Then you can draw a column chart:
C = (# create histogram object and set the size, or not, use the default size directly to Bar (init_opts=opts.InitOpts (width= "800px", height= "400px")) # set the X-axis data series, take only the first 10 data, and convert to the list format .add _ xaxis (data. Province [: 10] .tolist () # sets Y-axis data series and display color. Only the first 10 data are taken and converted to list format. Add _ yaxis (", data. Add [: 10] .tolist () # set the title and location of the chart. Set _ global_opts (title_opts=opts.TitleOpts (title= "add TOP10", pos_left= "center")) # render the bar chart to html .render ("bar chart .html") through the render () method
The effect is as follows:
C = (Bar (init_opts=opts.InitOpts (width= "800px", height= "400px")) .add _ xaxis (data. Province [: 10] .tolist () .add _ yaxis ("accumulate", data. Number of confirmed cases [: 10] .tolist () .add _ yaxis ("add", data. Add [: 10] .tolist () .set _ global_opts (title_opts=opts.TitleOpts (title= "TOP10")) .render ("histogram .html"))
The effect of the multi-data series column chart drawn is as follows:
C = (Bar (init_opts=opts.InitOpts (width= "800px", height= "400px")) .add _ xaxis (data. Province [: 10] .tolist () # sets Y axis data series and display color. Add _ yaxis (", data. Add [: 10] .tolist (), color='#FF1493') .set _ global_opts (title_opts=opts.TitleOpts (title= "add TOP10", pos_left= "center") .render ("column chart .html")) about how to draw a column chart in Python. I hope the above content can be of some help and learn more knowledge. If you think the article is good, you can share it for more people to see.
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.