날짜/시간 축 형식
날짜/시간 인덱스가 있는 계열을 그릴 때 x축에 시간, 분, 초가 표시될 수 있습니다. 연도와 월로. 그래프의 가독성을 단순화하기 위해 과도한 시간 정보를 제거할 수 있습니다.
샘플 계열을 고려하십시오.
2014-01-01 7 2014-02-01 8 2014-03-01 9 2014-04-01 8
이 계열을 플로팅하면 처음에는 x축이 붐비는 그래프가 표시됩니다. .
import matplotlib.pyplot as plt import pandas as pd series = pd.Series([7, 8, 9, 8], index=pd.date_range('2014-01', periods=4, freq='MS')) plt.plot(series.index, series.values) plt.show()
이 문제를 해결하려면 Matplotlib의 포맷터를 활용하여 x축 눈금의 표시 형식을 제어할 수 있습니다.
import numpy as np import matplotlib.dates as mdates # generate data N = 30 drange = pd.date_range("2014-01", periods=N, freq="MS") np.random.seed(365) # for reproducible values values = {'values':np.random.randint(1,20,size=N)} df = pd.DataFrame(values, index=drange) # plot fig, ax = plt.subplots() ax.plot(df.index, df.values) # set tick formatters ax.xaxis.set_major_formatter(mdates.DateFormatter("%Y-%m")) ax.xaxis.set_minor_formatter(mdates.DateFormatter("%Y-%m")) plt.xticks(rotation=90) plt.show()
"%Y-%m을 지정하여 " 형식 문자열을 사용하면 이제 X축 레이블에 연도와 월이 단순화된 형식으로 표시됩니다.
위 내용은 더 나은 가독성을 위해 Matplotlib에서 날짜/시간 축 형식을 지정하는 방법은 무엇입니까?의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

Pythonusesahybridmodelofilationandlostretation : 1) ThePyThoninterPretreCeterCompileSsourcodeIntOplatform-IndependentBecode.

Pythonisbothingretedandcompiled.1) 1) it 'scompiledtobytecodeforportabilityacrossplatforms.2) thebytecodeisthentenningreted, withfordiNamictyTeNgreted, WhithItmayBowerShiledlanguges.

forloopsareusedwhendumberofitessiskNowninadvance, whilewhiloopsareusedwhentheationsdepernationsorarrays.2) whiloopsureatableforscenarioScontiLaspecOndCond

pythonisnotpurelynlogreted; itusesahybrideprophorfbyodecodecompilationandruntime -INGRETATION.1) pythoncompilessourcecodeintobytecode, thepythonVirtualMachine (pvm)

ToconcatenatelistsinpythonwithesameElements, 사용 : 1) OperatorTokeEpduplicates, 2) asettoremovedUplicates, or3) listComperensionForControlOverDuplicates, 각 methodHasDifferentPerferformanCeanDorderImpestications.

PythonisancerpretedLanguage, 비판적 요소를 제시하는 PytherfaceLockelimitationsIncriticalApplications.1) 해석 된 언어와 같은 thePeedBackandbackandrapidProtoTyping.2) CompilledlanguagesLikec/C transformt 해석

useforloopswhhenmerfiterationsiskNownInAdvance 및 WhileLoopSweHeniTesslationsDepoyConditionismet whilEroopsSuitsCenarioswhereTheLoopScenarioswhereTheLoopScenarioswhereTheLoopScenarioswhereTherInatismet, 유용한 광고 인 푸트 gorit


핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

Video Face Swap
완전히 무료인 AI 얼굴 교환 도구를 사용하여 모든 비디오의 얼굴을 쉽게 바꾸세요!

인기 기사

뜨거운 도구

안전한 시험 브라우저
안전한 시험 브라우저는 온라인 시험을 안전하게 치르기 위한 보안 브라우저 환경입니다. 이 소프트웨어는 모든 컴퓨터를 안전한 워크스테이션으로 바꿔줍니다. 이는 모든 유틸리티에 대한 액세스를 제어하고 학생들이 승인되지 않은 리소스를 사용하는 것을 방지합니다.

Atom Editor Mac 버전 다운로드
가장 인기 있는 오픈 소스 편집기

SublimeText3 중국어 버전
중국어 버전, 사용하기 매우 쉽습니다.

WebStorm Mac 버전
유용한 JavaScript 개발 도구

Dreamweaver Mac版
시각적 웹 개발 도구