本文簡要介紹 python 語言中 matplotlib.dates.ConciseDateFormatter 的用法。
-
基礎:
FormatterFormatter嘗試找出日期使用的最佳格式,並使其盡可能緊湊,但仍然完整。與AutoDateLocator一起使用時最有用:>>> locator = AutoDateLocator() >>> formatter = ConciseDateFormatter(locator)- 參數:
- locator
ticker.Locator -
該軸正在使用的定位器。
- tz str 或
tzinfo,默認值:rcParams["timezone"](默認值:'UTC') -
勾選時區,傳遞給
dates.num2date。 - formats 6 個字符串的列表,可選
-
6 級刻度標記的格式字符串:主要是年、月、日、小時、分鍾和秒。字符串使用與
strftime相同的格式代碼。默認為['%Y', '%b', '%d', '%H:%M', '%H:%M', '%S.%f'] - zero_formats 6 個字符串的列表,可選
-
對於給定的刻度級別,刻度標簽的格式字符串為"zeros"。例如,如果大多數刻度是月份,則 2005 年 1 月 1 日左右的刻度將被標記為 "Dec"、"2005"、"Feb"。默認為
['', '%Y', '%b', '%b-%d', '%H:%M', '%H:%M'] - offset_formats 6 個字符串的列表,可選
-
應用於 x 軸右側或 y 軸頂部的 "offset" 字符串的 6 個級別的格式字符串。結合刻度標簽,這應該完全指定日期。默認值為:
['', '%Y', '%Y-%b', '%Y-%b-%d', '%Y-%b-%d', '%Y-%b-%d %H:%M'] - show_offset 布爾值,默認值:真
-
是否顯示偏移量。
- usetex 布爾值,默認值:
rcParams["text.usetex"](默認值:False) -
啟用/禁用使用 TeX 的數學模式來呈現格式化程序的結果。
- locator
例子
請參閱使用 ConciseDateFormatter 格式化日期刻度
(
Source code、2x.png、png)
自動格式化日期標簽。默認格式用於生成一個初始字符串,然後刪除多餘的元素。
用法
class matplotlib.dates.ConciseDateFormatter(locator, tz=None, formats=None, offset_formats=None, zero_formats=None, show_offset=True, *, usetex=None)
相關用法
- Python matplotlib ConnectionStyle用法及代碼示例
- Python matplotlib ColorSequenceRegistry用法及代碼示例
- Python matplotlib ColormapRegistry用法及代碼示例
- Python matplotlib Collection.sticky_edges用法及代碼示例
- Python matplotlib Collection.set_hatch用法及代碼示例
- Python matplotlib CircleCollection.set_hatch用法及代碼示例
- Python matplotlib CircleCollection.sticky_edges用法及代碼示例
- Python matplotlib CenteredNorm用法及代碼示例
- Python matplotlib CallbackRegistry用法及代碼示例
- Python matplotlib axvspan用法及代碼示例
- Python matplotlib Axes.get_legend_handles_labels用法及代碼示例
- Python matplotlib AbstractMovieWriter用法及代碼示例
- Python matplotlib triplot用法及代碼示例
- Python matplotlib StarPolygonCollection.set_hatch用法及代碼示例
- Python matplotlib Axes.hist用法及代碼示例
- Python matplotlib boxplot用法及代碼示例
- Python matplotlib subplots用法及代碼示例
- Python matplotlib InsetPosition用法及代碼示例
- Python matplotlib ToolManager.toolmanager_disconnect用法及代碼示例
- Python matplotlib Figure.set_size_inches用法及代碼示例
- Python matplotlib figlegend用法及代碼示例
- Python matplotlib Axes.step用法及代碼示例
- Python matplotlib Axes.contour用法及代碼示例
- Python matplotlib LassoSelector用法及代碼示例
- Python matplotlib BrokenBarHCollection.set_hatch用法及代碼示例
注:本文由純淨天空篩選整理自skytowner.com大神的英文原創作品 matplotlib.dates.ConciseDateFormatter。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。
