플롯을 지우기 위해 cla(), clf() 또는 close()를 사용하는 경우
Matplotlib는 플롯을 지우는 여러 기능을 제공합니다. : cla(), clf() 및 close(). 효과적인 플롯 관리를 위해서는 개별 기능과 사용 시나리오를 이해하는 것이 중요합니다.
cla()
cla() 함수는 그림의 현재 축을 지우고 모든 축을 제거합니다. 플롯된 데이터 및 레이블. Figure 내의 다른 축에는 영향을 주지 않습니다.
사용 시기: 전체 Figure를 지우거나 창을 닫지 않고 특정 축의 데이터를 지우고 싶을 때 cla()를 사용합니다.
clf()
clf() 함수는 현재 Figure 전체를 삭제합니다. 모든 축, 플롯 요소 및 레이블을 제거합니다. Figure 자체는 열려 있으므로 후속 플롯에 재사용할 수 있습니다.
사용 시기: Figure를 완전히 지우고 새로운 그리기 표면으로 시작해야 하는 경우 clf()를 사용하세요. .
close()
close() 함수는 현재 Figure 창을 닫습니다. 해당 창의 번호나 이름을 인수로 전달하여 특정 창을 닫도록 지정할 수 있습니다. 또한 close('all')은 열려 있는 모든 Figure 창을 닫습니다.
사용 시기: 메모리에서 Figure 창을 제거하려면 close()를 사용합니다. 이는 여러 플롯이 열려 있고 리소스를 확보해야 할 때 유용합니다.
비교표
Function | Action |
---|---|
cla() | Clear the current axis |
clf() | Clear the entire current figure |
close() | Close the current figure window |
사용 예
파이플롯 인터페이스:
import matplotlib.pyplot as plt # Clear the current axis plt.cla() # Clear the entire figure plt.clf() # Close the current figure window plt.close()
Figure 클래스 메서드:
import matplotlib.pyplot as plt # Create a figure fig = plt.figure() # Clear the figure fig.clf()
참고: fig.clear() 메서드는 fig.clf()의 동의어입니다.
위 내용은 Matplotlib `cla()`, `clf()` 및 `close()`: 언제 어느 것을 사용해야 합니까?의 상세 내용입니다. 자세한 내용은 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 얼굴 교환 도구를 사용하여 모든 비디오의 얼굴을 쉽게 바꾸세요!

인기 기사

뜨거운 도구

메모장++7.3.1
사용하기 쉬운 무료 코드 편집기

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

스튜디오 13.0.1 보내기
강력한 PHP 통합 개발 환경

SublimeText3 Linux 새 버전
SublimeText3 Linux 최신 버전

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