In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail what the method of drawing python changes with time series is, the content of the article is of high quality, so the editor will share it with you for reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
There are two things to consider in drawing this kind of picture:
1. How to generate a continuous timeline
two。 How to display the style and number of axis labels appropriately in the diagram.
Import matplotlib.pyplot as pltimport matplotlib as mplimport numpy as np% matplotlib inlineimport datetime# this package is very critical # set the start and end time start=datetime.datetime (2013 stop=datetime.datetime 12 delta=datetime.timedelta 31) delta=datetime.timedelta (1) # set the interval between dates dates=mpl.dates.drange (start,stop,delta) # returns a floating-point date series, this is a generated time series, similarly, what if the sequence is converted into a date? Values=np.random.rand (len (dates)) # has two problems. One is that the axes are not marked in the form of a date. The other is that the number and position of ticks are not suitable for fig=plt.figure (figsize= (24jol 12)) # resize the drawing space plt.plot (dates,values,linestyle='-',marker='*',c='r') Alpha=0.5) # drawing ax=plt.gca () date_format=mpl.dates.DateFormatter ('% YMY% MMI% d') # set the format of the display ax.xaxis.set_major_formatter (date_format) # set the main format of the x-axis ax.xaxis.set_major_locator (mpl.ticker.MultipleLocator (30)) # set the scale interval of the display of the axis fig.autofmt_xdate () # prevent data overlap on the x-axis Automatic adjustment.
What is the method of drawing python with time series is shared here, I hope that the above content can be of some help to you, can 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.