楼主: 匿名
20366 212

[Stata] [Stata] 如何添加直角坐标系及极坐标系及SDAS_绘图实例 [推广有奖]

151
niuniuyiwan 在职认证  发表于 2015-9-9 08:14:23
  1. /* Program that helps with specification of regular linear and logarithmic
  2. axis scales, ranges and tick lists

  3. Requires: regaxis
  4. to download this program type the following on the Stata
  5. command line (if not already loaded):*/

  6. ssc install regaxis



  7. sysuse auto, clear
  8. regaxis rep78, cycle(.5) singleok margin(0.5) lrange(yrange) lticks(ylabs)
  9. regaxis weight, include(0) lticks(xlabs)
  10. scatter rep78 weight, yscale(range(`yrange')) ylabel(`ylabs') xlabel(`xlabs')
复制代码

Graph.png



152
niuniuyiwan 在职认证  发表于 2015-9-9 08:20:45
  1. // Program that helps with specification of label positions
  2. //修改scheme(s1)为s1mono
  3. /*Requires: egenmore
  4. to download this program type the following on the Stata
  5. command line (if not already loaded):*/
  6. ssc install egenmore



  7. clear all

  8. //graph without the egenmore generated label position
  9. sysuse auto, clear
  10. egen clock = mlabvpos(mpg weight)
  11. scatter mpg weight, mlab(make) mlabvpos(clock) name(a1) ///
  12. scheme(s1mono)

  13. // look at a suitable matrix
  14. // for the egen mlabvpos option
  15. matrix z= 11, 1, 12, 11, 1 \ 10, 2, 12, 10, 2 \ 9, 3, 12, 9 ,3 \ ///
  16. 8, 4, 6, 8, 4 \ 7, 5 ,6, 7, 5       

  17. matrix list z

  18. //graph with the egenmore generated label position
  19. egen clock2 = mlabvpos(mpg weight), matrix(11 1 12 11 1 \\ ///
  20. 10 2 12 10 2 \\ 9 3 12 9 3 \\ 8 4 6 8 4 \\ 7 5 6 7 5)
  21. scatter mpg weight, mlab(make) mlabvpos(clock2) name(a2) ///
  22. title("Graph using egenmore mlabvpos generated data")    ///
  23. scheme(s1mono)
复制代码

a2.png



153
niuniuyiwan 在职认证  发表于 2015-9-9 09:03:22
  1. //sparkline-文档修改后
  2. /*sparkline graphs sparkline-type plots for one or more y
  3. variables against a single x variable. Typically, plots for
  4. different y variables or for different subsets of one y variable
  5. are stacked vertically into one image. */

  6. /*Requires: sparkline
  7. to download this program type the following on the Stata
  8. command line (if not already loaded):*/
  9. ssc install sparkline

  10. webuse grunfeld, clear
  11. drop if company!=9
  12. sparkline invest mvalue kstock year, by(company) subtitle("")   scheme(s1mono)
复制代码

Graph.png



154
niuniuyiwan 在职认证  发表于 2015-9-9 09:11:43

Graph.png


1.PNG


155
niuniuyiwan 在职认证  发表于 2015-9-9 09:19:07

Graph.png



1.PNG


156
niuniuyiwan 在职认证  发表于 2015-9-9 09:23:29

Graph.png



1.PNG


157
niuniuyiwan 在职认证  发表于 2015-9-9 09:31:36

Graph.png



捕获.PNG


158
niuniuyiwan 在职认证  发表于 2015-9-9 09:34:15

Graph.png




159
niuniuyiwan 在职认证  发表于 2015-9-9 09:35:56
  1. //ciplot

  2. /*Example of the use of ciplot.

  3. Requires: cipplot
  4. To download ciplot type the following on the Stata command line:*/
  5. ssc install ciplot

  6. webuse citytemp, clear

  7. ciplot heatdd cooldd, by(division) xla(, ang(45))

  8. //From ciplot help:Nick cox
复制代码

Graph.png



160
niuniuyiwan 在职认证  发表于 2015-9-9 09:38:46
  1. ssc install stripplot

  2. /*The data (Challenger shuttle O-ring damage) can be obtained from:
  3. http://www.stata.com/bookstore/swsdl.html*/


  4. use shuttle.dta, clear

  5. logit damage temp
  6. predict pre

  7. stripplot pre, over(temp) stack ms(sh) height(0.4) ///
  8. title("Challenger shuttle O-ring damage")  ylabel(,alt  labsize(2)) ///
  9. addplot(mspline  temp pre, bands(20))

  10. //From striplot help:Nick cox
复制代码

Graph.png


shuttle.rar (1.23 KB) 本附件包括:

  • shuttle.dta



您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2025-12-31 21:44