pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

    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="qmu20ko" id='aSGR5'><tfoot id='aSGR5'></tfoot><dl id='aSGR5'><fieldset id='aSGR5'></fieldset></dl></div>

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

        在 matplotlib 中繪制一天中的時間與日期

        plot time of day vs date in matplotlib(在 matplotlib 中繪制一天中的時間與日期)
          <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="gi20iqa" 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 中繪制一天中的時間與日期的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

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

                  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.

                  這個答案有幫助

                  但我與那個情節有一些不同,我無法讓它發揮作用.實際上,我正在獲取 y 軸來繪制日期和時間,因此當我只需要大約一天的時間時,它正在處理 y 軸上幾個月的時間戳.該示例在評論中聲稱,yaxis 的基準日期可以是任何東西,因為信息是及時的",但我不明白他是如何丟棄"基準日期信息的.

                  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 小時制(00:00 到 24:00)或上午/下午樣式時間,軸刻度看起來像下午 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.

                  對于間隔(時間范圍),我不想使用誤差線——線條太細了.我想使用(浮動)條形圖/柱形圖.

                  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.

                  我的數據是格式為2010-12-20 05:00:00"的日期時間字符串

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

                  感謝您的幫助.

                  推薦答案

                  我認為您對 matplotlib 如何在幕后處理時間和日期感到有些困惑.

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

                  matplotlib 中的所有日期時間都表示為簡單的浮點數.1 天對應于 1.0 的差異,日期是自 1900 年以來的天數(如果我沒記錯的話,無論如何).

                  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).

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

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

                  我將使用積分,但您可以輕松使用條形.如果您確實使用 plt.bar,請考慮使用 bottom 關鍵字參數,這樣條形的底部將從間隔的開始時間開始(并記住第二個參數是條形的 高度,而不是它的頂部 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()
                  

                  希望能有所幫助!

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

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

                  相關文檔推薦

                  python: Two modules and classes with the same name under different packages(python:不同包下同名的兩個模塊和類)
                  Configuring Python to use additional locations for site-packages(配置 Python 以使用站點包的其他位置)
                  How to structure python packages without repeating top level name for import(如何在不重復導入頂級名稱的情況下構造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(分發帶有已編譯動態共享庫的 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="gycisc2" id='811B0'><tfoot id='811B0'></tfoot><dl id='811B0'><fieldset id='811B0'></fieldset></dl></div>

                            主站蜘蛛池模板: 体视显微镜_荧光生物显微镜_显微镜报价-微仪光电生命科学显微镜有限公司 | 户外健身路径_小区健身器材_室外健身器材厂家_价格-浩然体育 | 废旧物资回收公司_广州废旧设备回收_报废设备物资回收-益美工厂设备回收公司 | 动库网动库商城-体育用品专卖店:羽毛球,乒乓球拍,网球,户外装备,运动鞋,运动包,运动服饰专卖店-正品运动品网上商城动库商城网 - 动库商城 | 水平垂直燃烧试验仪-灼热丝试验仪-漏电起痕试验仪-针焰试验仪-塑料材料燃烧检测设备-IP防水试验机 | 接地电阻测试仪[厂家直销]_电缆故障测试仪[精准定位]_耐压测试仪-武汉南电至诚电力设备 | 今日热点_实时热点_奇闻异事_趣闻趣事_灵异事件 - 奇闻事件 | 紫外荧光硫分析仪-硫含量分析仪-红外光度测定仪-泰州美旭仪器 | 道达尔润滑油-食品级润滑油-道达尔导热油-合成导热油,深圳道达尔代理商合-深圳浩方正大官网 | SPC工作站-连杆综合检具-表盘气动量仪-内孔缺陷检测仪-杭州朗多检测仪器有限公司 | 东莞市超赞电子科技有限公司 全系列直插/贴片铝电解电容,电解电容,电容器 | 北京律师咨询_知名专业北京律师事务所_免费法律咨询 | 精密模具-双色注塑模具加工-深圳铭洋宇通| 新能源汽车教学设备厂家报价[汽车教学设备运营18年]-恒信教具 | 东风体检车厂家_公共卫生体检车_医院体检车_移动体检车-锦沅科贸 | 电机修理_二手电机专家-河北豫通机电设备有限公司(原石家庄冀华高压电机维修中心) | AR开发公司_AR增强现实_AR工业_AR巡检|上海集英科技 | 连栋温室大棚建造厂家-智能玻璃温室-薄膜温室_青州市亿诚农业科技 | 家庭教育吧-在线家庭教育平台,专注青少年家庭教育 | 北京乾茂兴业科技发展有限公司 | 冷热冲击试验箱_温度冲击试验箱价格_冷热冲击箱排名_林频厂家 | 塑胶跑道施工-硅pu篮球场施工-塑胶网球场建造-丙烯酸球场材料厂家-奥茵 | 药品/药物稳定性试验考察箱-埃里森仪器设备(上海)有限公司 | 开锐教育-学历提升-职称评定-职业资格培训-积分入户 | 北京浩云律师事务所-法律顾问_企业法务_律师顾问_公司顾问 | 无机纤维喷涂棉-喷涂棉施工工程-山东华泉建筑工程有限公司▲ | 一体式钢筋扫描仪-楼板测厚仪-裂缝检测仪-泰仕特(北京) | 石家庄网站建设|石家庄网站制作|石家庄小程序开发|石家庄微信开发|网站建设公司|网站制作公司|微信小程序开发|手机APP开发|软件开发 | 定硫仪,量热仪,工业分析仪,马弗炉,煤炭化验设备厂家,煤质化验仪器,焦炭化验设备鹤壁大德煤质工业分析仪,氟氯测定仪 | 小小作文网_中小学优秀作文范文大全 | 西点培训学校_法式西点培训班_西点师培训_西点蛋糕培训-广州烘趣西点烘焙培训学院 | 钢格栅板_钢格板网_格栅板-做专业的热镀锌钢格栅板厂家-安平县迎瑞丝网制造有限公司 | 深圳成考网-深圳成人高考报名网| 高铝矾土熟料_细粉_骨料_消失模_铸造用铝矾土_铝酸钙粉—嵩峰厂家 | 东莞螺杆空压机_永磁变频空压机_节能空压机_空压机工厂批发_深圳螺杆空压机_广州螺杆空压机_东莞空压机_空压机批发_东莞空压机工厂批发_东莞市文颖设备科技有限公司 | Dataforth隔离信号调理模块-信号放大模块-加速度振动传感器-北京康泰电子有限公司 | 脉冲除尘器,除尘器厂家-淄博机械 | 脉冲除尘器,除尘器厂家-淄博机械| 汽车润滑油厂家-机油/润滑油代理-高性能机油-领驰慧润滑科技(河北)有限公司 | 超声波清洗机-超声波清洗设备定制生产厂家 - 深圳市冠博科技实业有限公司 | 在线PH计-氧化锆分析仪-在线浊度仪-在线溶氧仪- 无锡朝达 |