본문 바로가기

Python148

[Python] while statement, break and continue Python의 경우, loop structure로 while statement와 for statement를 제공한다. Contol Flow와 Control Structure에 대한 개념은 다음 URL을 참고 : http://ds31x.blogspot.com/2023/07/basic-control-structures-and-control.html 참고로 do-while statement 는 while statement 만으로도 구현가능하기 때문에 Python에선 지원하지 않음. for statement가 iterator object와 함께 사용되는 것과 달리, while statement는 if statement와 매우 유사한 구조로 repetition을 가능하게 함. 일반적인 구조. while condi.. 2023. 7. 28.
[Python] if, elif, else statements if, elif, else statements (조건분기문)프로그램의 flow control를 담당함. (loop문과 함께)Flow control을 위한 Control Structures에 대한 내용은 다음 URL을 참고.http://ds31x.blogspot.com/2023/07/basic-control-structures-and-control.html C언어의 if, else if, else 와 매우 유사함.설명다음은 이들 사용을 위한 간략한 예이다.if condition: # if statement if_block # if statement's code blockelif condition: # elif statement elif_block # elif statement's co.. 2023. 7. 28.
[Python] Boolean Operators, Relational Operators, and Membership Operator Boolean Operators기본 boolean operator는 다음 3가지로 구성됨.and : and 연산자. (binary op.) : C언어 등에선 &&에 해당.or : or 연산자. (binary op.) : || 에 해당.not : not 연산자. (unary operator로 operand가 하나임.) : !에 해당.참고로 boolean operator로 묶여 있는 combining comparisons의 경우, short-circuit evaluation이 수행됨.or의 경우 왼쪽에서 오른쪽으로 evaluation이 이루어지는 도중 하나라도 True가 나오면 뒤에 대해 evaluation을 하지않고 True를 반환.and의 경우는 하나라도 Flase가 나오면 이후 evaluation을 수.. 2023. 7. 28.
[matplotlib] line 및 marker 설정하기. 기본적으로 graph에서 사용되는 line 및 marker의 스타일 (유형, 굵기, 색, 마커)을 변경하는 것은Axes에서 제공하는 다양한 graph를 그리는 모든 메서드들에서 필요하기 때문에 공통적인 parameters가 제공됨. 다음이 많이 사용되는 것들을 정리해 놓은 것임.parameterdesc.valuelinestylels로도 쓰이며, 선의 종류.'-'  : solid(실선), ':' : dotted(점선), '--' : dashed(파선), '-.' : dashdot(파점선)linewidthlw로도 쓰이며, 선의 굵기를 지정floatcolor선의 색'w' : white 'r' : red 'g' : green 'b' : blue 'y' : yellow 'c' : cyan 'm' : magenta.. 2023. 7. 21.
[matplotlib] : backend 란 matplotlib: backend란 matplotlib의 backend 관련자료를 정리한 문서임.Matplotlib ArchitectureMatplotlib 아키텍트는 다음과 같이 크게 3가지 레이어로 구성된다.Backend Layer :상위 layer에서 graph를 생성하는데 초점을 두는 것과 달리,생성된 graph를 실제 시스템에서 어떻게 보여줄지(또는 저장할지)를 처리함.Artist Layer :OOP 를 통해 customization을 수행할 수 있음.Scripting Layer :scripting을 통해 실제 graph를 그리는 부분.What is a backend?Matplotlib는 다양한 환경에서 graph를 표시하고, 다양한 출력 format으로 저장할 수 있음. 일반적으로 matpl.. 2023. 7. 20.
[matplotlib]: Figure and Axes Figure and AxesFigure의 instance는 matplotlib가 그리는 그림 하나당 하나가 할당되며, 그림이 그려질 canvas 영역을 제공한다.Figure는 1개 이상의 Axes를 가질 수 있음.Axes의 instance는 Figure가 제공하는 전체 canvas의 특정 고정영역에 할당된 좌표계를 제공한다.Axes의 instance는 Figure에 수동으로 삽입될 수도 있지만, matplotlib에서는 여러 layout manager를 사용해 자동으로 추가되기도 한다.(일반적으로 하나의 method 호출로 Figure와 포함된 Axes를 동시에 얻는 게 일반적임)matplotlib에서 그래프를 그리는 대부분의 method를 제공하며 axis의 tick과 label 등을 그리고 조절하는 .. 2023. 7. 20.
반응형