簡體   English   中英

在SAS中繪制一維點圖

[英]Plotting a 1D dot plot in SAS

在此輸入圖像描述

你好,我想繪制一些接近這個的東西,但我似乎無法得到它。

我有數據

data table2_1;

input Modified_Mortar Unmodifided_Mortar; cards; 16.85 16.62 16.40 16.75 17.21 17.37 16.35 17.12 16.52 16.98 17.04 16.87 16.96 17.34 17.15 17.02 16.59 17.08 16.57 17.27 ; run;

我試過了

proc freq data=table2_1; tables Modified_Mortar / plots=freqplot (type=dotplot); tables Unmodifided_Mortar / plots=freqplot (type=dotplot); run;

但它給了我一個不必要的巨大情節,它的間距相等,無法按照我的意圖比較這兩個發行版。

我和sgplot玩了一下,這是我能想到的最接近的。 這不是確切的,但在圖像編輯器中稍微擺弄一下,你幾乎可以得到它。

在此輸入圖像描述

data table2_1;
input Modified_Mortar Unmodifided_Mortar;
retain mod_line 0.75 unmod_line 0;
cards;
16.85 16.62
16.40 16.75
17.21 17.37
16.35 17.12
16.52 16.98
17.04 16.87
16.96 17.34
17.15 17.02
16.59 17.08
16.57 17.27
;
run;

proc sgplot data=table2_1;
    label Modified_Mortar = 'Strength (kgf/cm squared)';

    scatter x = Modified_Mortar    y=mod_line   / markerattrs=(symbol=circlefilled color=black size=10);
    scatter x = Unmodifided_Mortar y=unmod_line / markerattrs=(symbol=circlefilled color=bib size=10);

    refline -0.25 / axis=y lineattrs=(color=bib thickness=2) name='mod' legendlabel='Unmodified' ;
    refline 0.5 / axis=y lineattrs=(color=black thickness=2) name='unmod' legendlabel='Modified';

    yaxis display=(nolabel) min=-0.25 max=15;
    xaxis values=(16.24 to 17.50 by 0.14) min=16.30 max=17.40 valueattrs=(size=12) labelattrs=(size=12);

    keylegend 'mod' 'unmod' / location=outside position=bottom valueattrs=(size=12);
run;

這是一種使用治療中的數據的不同方法:響應分類形式。 標記的三角形標記用於顯示平均值(三角形頂點是平衡點)

在此輸入圖像描述

data have;
  treatment = 'Modified  '; y=1.13; input response @; output;
  treatment = 'Unmodified'; y=0.13; input response;   output;

  attrib
    response label = "Strength (kgf/cm2)"
  ;

cards;
16.85 16.62
16.40 16.75
17.21 17.37
16.35 17.12
16.52 16.98
17.04 16.87
16.96 17.34
17.15 17.02
16.59 17.08
16.57 17.27
;
run;

proc sql;
  create table plot as 
  select * from have
  outer union corresponding
  select 
    treatment,
    case treatment
      when ('Unmodified') then -0.15
      when ('Modified  ') then  0.85
      else 0
    end as y2,
    mean(response) as mean format=5.2
  from have
  group by treatment;
quit;


ods proclabel "Concrete dot plot";

ods graphics / height=220px width=800px;

proc sgplot data=plot description="Response to treatment";
  title "Concrete strength response to treatment";

  scatter 
    x=response y=y
    / markerattrs=(symbol=circlefilled color=black size=12px)      
  ;

  scatter 
    x=mean y=y2
    / datalabel=mean
      datalabelpos=bottom
      markerattrs=(symbol=triangle color=black size=12px)
  ;

  keylegend
    / exclude = ("y" "y2")
  ;

  yaxis 
    offsetmin = 0.2
    values = ( 0 1 2 )
    valuesdisplay = ( "Unmodified" "Modified" " " )
    display = ( noticks nolabel )
    colorbands = odd 
  ;

  xaxis 
    grid 
  ;

  refline  0.00 ;
  refline  1.00 ;

run;

title;
footnote;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM