久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    1. <tfoot id='aSGR5'></tfoot>

    2. <legend id='aSGR5'><style id='aSGR5'><dir id='aSGR5'><q id='aSGR5'></q></dir></style></legend>

      <small id='aSGR5'></small><noframes id='aSGR5'>

        <i id='aSGR5'><tr id='aSGR5'><dt id='aSGR5'><q id='aSGR5'><span id='aSGR5'><b id='aSGR5'><form id='aSGR5'><ins id='aSGR5'></ins><ul id='aSGR5'></ul><sub id='aSGR5'></sub></form><legend id='aSGR5'></legend><bdo id='aSGR5'><pre id='aSGR5'><center id='aSGR5'></center></pre></bdo></b><th id='aSGR5'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='aSGR5'><tfoot id='aSGR5'></tfoot><dl id='aSGR5'><fieldset id='aSGR5'></fieldset></dl></div>

        • <bdo id='aSGR5'></bdo><ul id='aSGR5'></ul>

        在 matplotlib 中繪制一天中的時(shí)間與日期

        plot time of day vs date in matplotlib(在 matplotlib 中繪制一天中的時(shí)間與日期)
          <tbody id='u5Kj2'></tbody>
          <bdo id='u5Kj2'></bdo><ul id='u5Kj2'></ul>
          <tfoot id='u5Kj2'></tfoot>

          <small id='u5Kj2'></small><noframes id='u5Kj2'>

              • <i id='u5Kj2'><tr id='u5Kj2'><dt id='u5Kj2'><q id='u5Kj2'><span id='u5Kj2'><b id='u5Kj2'><form id='u5Kj2'><ins id='u5Kj2'></ins><ul id='u5Kj2'></ul><sub id='u5Kj2'></sub></form><legend id='u5Kj2'></legend><bdo id='u5Kj2'><pre id='u5Kj2'><center id='u5Kj2'></center></pre></bdo></b><th id='u5Kj2'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='u5Kj2'><tfoot id='u5Kj2'></tfoot><dl id='u5Kj2'><fieldset id='u5Kj2'></fieldset></dl></div>
                1. <legend id='u5Kj2'><style id='u5Kj2'><dir id='u5Kj2'><q id='u5Kj2'></q></dir></style></legend>
                  本文介紹了在 matplotlib 中繪制一天中的時(shí)間與日期的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我想以特定的幾種方式在 x 軸上繪制日期,在 y 軸上繪制一天中的時(shí)間,然后繪制線圖或間隔(浮動(dòng)條)圖.

                  I want to plot, in a specific few ways, dates on the x axis and time of day on the y axis, and then have either line plots or interval (floating bar) plots.

                  這個(gè)答案有幫助

                  但我與那個(gè)情節(jié)有一些不同,我無法讓它發(fā)揮作用.實(shí)際上,我正在獲取 y 軸來繪制日期和時(shí)間,因此當(dāng)我只需要大約一天的時(shí)間時(shí),它正在處理 y 軸上幾個(gè)月的時(shí)間戳.該示例在評(píng)論中聲稱,yaxis 的基準(zhǔn)日期可以是任何東西,因?yàn)樾畔⑹羌皶r(shí)的",但我不明白他是如何丟棄"基準(zhǔn)日期信息的.

                  But I have a few differences from that plot and I can't get it to work. I'm actually getting the y axis to plot both the DATES as well as the time, so it is scrunching months' worth of timestamps on the y axis, when I just need about one day's worth. That example claims in the comments, "base date for yaxis can be anything, since information is in the time", but I don't understand how he is "throwing away" the base date information.

                  無論如何,我的需求是:

                  In any case, my needs are:

                  1. 我希望 y 軸選擇 24 小時(shí)制(00:00 到 24:00)或上午/下午樣式時(shí)間,軸刻度看起來像下午 3:00,上午 11:00等.我猜這將使用 FuncFormatter 完成.

                  1. I'd like the option for either 24 hour time (00:00 to 24:00) or am/pm style time for the y axis, with the axis ticks looking like 3:00pm, 11:00am, etc. This will be done with a FuncFormatter, I guess.

                  對(duì)于間隔(時(shí)間范圍),我不想使用誤差線——線條太細(xì)了.我想使用(浮動(dòng))條形圖/柱形圖.

                  For the intervals (time ranges) I don't want to use the error bars--the lines are way too thin. I'd like to use a (floating) bar/column plot.

                  我的數(shù)據(jù)是格式為2010-12-20 05:00:00"的日期時(shí)間字符串

                  My data are datetime strings of the format '2010-12-20 05:00:00'

                  感謝您的幫助.

                  推薦答案

                  我認(rèn)為您對(duì) matplotlib 如何在幕后處理時(shí)間和日期感到有些困惑.

                  I think you're slightly confused as to exactly how matplotlib handles times and dates behind the scenes.

                  matplotlib 中的所有日期時(shí)間都表示為簡(jiǎn)單的浮點(diǎn)數(shù).1 天對(duì)應(yīng)于 1.0 的差異,日期是自 1900 年以來的天數(shù)(如果我沒記錯(cuò)的話,無論如何).

                  All datetimes in matplotlib are represented as simple floats. 1 day corresponds to a difference of 1.0, and the dates are in days since 1900 (if I remember correctly, anyway).

                  因此,為了僅繪制給定日期的時(shí)間,您需要使用 %1.

                  So, in order to plot just the time of a given date, you need to use a % 1.

                  我將使用積分,但您可以輕松使用條形.如果您確實(shí)使用 plt.bar,請(qǐng)考慮使用 bottom 關(guān)鍵字參數(shù),這樣條形的底部將從間隔的開始時(shí)間開始(并記住第二個(gè)參數(shù)是條形的 高度,而不是它的頂部 y 值).

                  I'm going to use points, but you can easily use bars. Look into using the bottom keyword argument if you do use plt.bar, so that the bottom of the bars will start at the start time of your intervals (and remember that the second argument is the height of the bar, not its top y-value).

                  例如:

                  import matplotlib.pyplot as plt
                  import matplotlib as mpl
                  import numpy as np
                  import datetime as dt
                  
                  # Make a series of events 1 day apart
                  x = mpl.dates.drange(dt.datetime(2009,10,1), 
                                       dt.datetime(2010,1,15), 
                                       dt.timedelta(days=1))
                  # Vary the datetimes so that they occur at random times
                  # Remember, 1.0 is equivalent to 1 day in this case...
                  x += np.random.random(x.size)
                  
                  # We can extract the time by using a modulo 1, and adding an arbitrary base date
                  times = x % 1 + int(x[0]) # (The int is so the y-axis starts at midnight...)
                  
                  # I'm just plotting points here, but you could just as easily use a bar.
                  fig = plt.figure()
                  ax = fig.add_subplot(111)
                  ax.plot_date(x, times, 'ro')
                  ax.yaxis_date()
                  fig.autofmt_xdate()
                  
                  plt.show()
                  

                  希望能有所幫助!

                  這篇關(guān)于在 matplotlib 中繪制一天中的時(shí)間與日期的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  python: Two modules and classes with the same name under different packages(python:不同包下同名的兩個(gè)模塊和類)
                  Configuring Python to use additional locations for site-packages(配置 Python 以使用站點(diǎn)包的其他位置)
                  How to structure python packages without repeating top level name for import(如何在不重復(fù)導(dǎo)入頂級(jí)名稱的情況下構(gòu)造python包)
                  Install python packages on OpenShift(在 OpenShift 上安裝 python 包)
                  How to refresh sys.path?(如何刷新 sys.path?)
                  Distribute a Python package with a compiled dynamic shared library(分發(fā)帶有已編譯動(dòng)態(tài)共享庫(kù)的 Python 包)

                  • <legend id='811B0'><style id='811B0'><dir id='811B0'><q id='811B0'></q></dir></style></legend>
                    • <tfoot id='811B0'></tfoot>
                        <tbody id='811B0'></tbody>

                        <small id='811B0'></small><noframes id='811B0'>

                          <bdo id='811B0'></bdo><ul id='811B0'></ul>
                        • <i id='811B0'><tr id='811B0'><dt id='811B0'><q id='811B0'><span id='811B0'><b id='811B0'><form id='811B0'><ins id='811B0'></ins><ul id='811B0'></ul><sub id='811B0'></sub></form><legend id='811B0'></legend><bdo id='811B0'><pre id='811B0'><center id='811B0'></center></pre></bdo></b><th id='811B0'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='811B0'><tfoot id='811B0'></tfoot><dl id='811B0'><fieldset id='811B0'></fieldset></dl></div>

                            主站蜘蛛池模板: 盗摄精品av一区二区三区 | 久草在线青青草 | 欧美精品久久久久久久久久 | 一区二区三区亚洲精品国 | 国产女人第一次做爰毛片 | 精品一区二区视频 | 91性高湖久久久久久久久_久久99 | 日本a∨精品中文字幕在线 亚洲91视频 | 亚洲乱码国产乱码精品精的特点 | 久久精品中文 | 操操日 | 亚洲天堂一区 | 日韩一区中文字幕 | 夜久久 | 黄色大片免费看 | 亚洲精品自拍 | 五月婷婷激情 | 欧美一级观看 | 玖玖免费 | 日一区二区 | 日日碰碰| 欧美精品一区二区三区在线 | 亚洲第一色站 | 九九精品视频在线 | 凹凸日日摸日日碰夜夜 | www.久久 | 国产午夜精品视频 | 免费黄色的视频 | 97伦理影院 | 一级片子 | 在线中文字幕国产 | 日本三级网 | 欧美激情精品久久久久久 | 北条麻妃一区二区三区在线观看 | 九九综合九九 | 亚洲国产一区二区三区, | 婷婷在线视频 | 中文字幕第一页在线 | 亚洲欧美一区二区三区1000 | 精一区二区 | 有码在线|