티스토리 뷰
그래픽 scheme 파일 만들기
그래픽 옵션을 매번 조정하는 것은 상당히 번거로운 일이다. 그래서 Stata에서는 scheme을 이용해서 옵션을 저장해 놓고 필요할 때 사용할 수 있다.
ssc install grstyle, replace
grstyle을 이용하여 다음과 같이 scheme을 비교적 쉽게 작성할 수 있다.
. grstyle init rstyle2, replace
. grstyle set imesh, horizontal minor
. grstyle set legend 4, nobox
. grstyle set color hue, n(5)
. grstyle linewidth pmark none
. grstyle color ci_area gs12%50
. grstyle color ci_arealine gs12%0
. findfile scheme-rstyle2.scheme
./scheme-rstyle2.scheme
그러면 rstyle2 라는 이름으로 scheme이 저장된다. 그리고 위의 구문은 약간의 수정을 통해서 새로운 scheme을 만들 수 있다. 혹시 실행되지 않으면 palette 등의 모듈을 추가로 설치하면 된다(에러 메시지에 어떤 모듈을 설치해야 하는지 뜬다).
이름은 rstyle2로 정했다. 이전에 만들어 놓은 rstyle이 있기 때문에 '2'를 붙였다.
. sysuse auto, clear
(1978 Automobile Data)
. separate price, by(rep78)
storage display value
variable name type format label variable label
----------------------------------------------------------------------------------
price1 int %8.0gc price, rep78 == 1
price2 int %8.0gc price, rep78 == 2
price3 int %8.0gc price, rep78 == 3
price4 int %8.0gc price, rep78 == 4
price5 int %8.0gc price, rep78 == 5
. scatter price? weight, ytitle(Price) aspect(1)
그러면 아래와 같은 새로운 scheme을 이용해 그래프를 그릴 수 있다.
'graphs' 카테고리의 다른 글
우리나라의 경기 침체기 (0) | 2018.10.21 |
---|---|
pcspike 이용하기 (0) | 2018.10.19 |
3차원 자료를 2차원으로 표현하기 (0) | 2018.10.14 |
3차원 그래프 그리기 (0) | 2018.10.14 |
confidence ellipse 그리기 (0) | 2018.10.09 |