// For a contingency table report, swap the x and y
// currently can swap the mosaic plot only
Names Default to Here(1);
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
myr = Contingency( Y( :Age ), X( :sex ) );
// Have to have a Contingency Analysis report open
// Can add test to make sure it is open in the future
myr = Current Report();
// taking apart CrossTabBox was easier using XML than JSL
mys = myr["Contingency Table"][CrossTabBox(1)] << Get XML;
// get current X role or rows of contingency table
start = Contains(mys,"<CROSSTABBOXROWSLABEL>")+22;
end = Contains(mys,"</CROSSTABBOXROWSLABEL>");
newY = Substr(mys,start,end-start);
// get current Y role or cols of contingency table
start = Contains(mys,"<CROSSTABBOXCOLSLABEL>")+22;
end = Contains(mys,"</CROSSTABBOXCOLSLABEL>");
newX = Substr(mys,start,end-start);
// Recreate same contingency table but with X and Y flipped
// also temporarily use Value Order to match the Mosaic Plot
myValueLabels = Reverse(Associative Array(Column(dt,newX)) << Get Keys);
Column(dt,newX) << Set Property("Value Ordering",myValueLabels);
tempCont = Contingency( Y(Column(dt,newY) ), X(Column(dt,newX) ), Contingency Table );
tempContr = tempCont << Report;
mycopy = tempContr["Contingency Table"][CrossTabBox(1)] << Clone Box;
tempCont << Close Window;
Column(dt,newX) << Delete Property("Value Ordering");
// remove the original contingency table and replace with transpose
myr["Contingency Table"][CrossTabBox(1)] << Delete;
myr["Contingency Table"] << Append(mycopy);
// show original side by side
obj = Contingency( Y( :Age ), X( :sex ) );
Report(obj)["Contingency Table"] << Set Title("Contingency Table - Current output");
myr["Contingency Table"] << Set Title("Contingency Table - Wish List for JMP15");우발 테이블과 모자이크 계획의 방향에 의해 괴롭혀지는 사람이 있습니까? 나는 그것을 사용하지 않지만 JMP 사용자 중 한 명은 모자이크 플롯과 일치하도록 테이블의 방향을 반전시키고 자했다. X와 Y를 바꾸면 테이블과 모자이크 플롯이 모두 업데이트된다는 것을 알았습니다. 예제를 실행하고 이들을 나란히 비교하려면 아래 스크립트를 참조하십시오. 테이블의 숫자를 모자이크 플롯의 셀과 일렬로 정렬하여보기 쉽고 참조하기를 원할 것입니다. 이전의 토론을 찾을 수 없었습니다. 비상 계획 테이블은 변경 될 수없는 것처럼 보입니다. 이는 CrossTabBox로, 변경 사항에 영향을 미치지 않습니다. 아래 스크립트는 상단 부분에 x와 y를 바꿀 때 테이블의 복제본을 만든 다음 모자이크 플롯에 추가하는 작업을합니다. 또한 Value Ordering을 사용하여 조금씩 조정해야했습니다. JMP15 위시리스트에 추가됩니다. EA 연구소와 개발자들과 JMP Discovery Summit에서 논의했습니다.
dir () 인수를 사용하여 가로 및 세로를 지정할 수있는 R 언어의 게시물을 발견했습니다. RStudio의 "카운트"출력은 방향에 대해 동일하게 유지됩니다.
# R 모자이크 플롯 예제 - 방향 변경
getwd ()
직원 <- read.csv ( "Products.csv", TRUE, sep = ",",
na.strings = TRUE)
count <- 테이블 (employee $ EnglishCountryRegionName,
직원 $ 색상)
카운트
mosaicplot (count, main = "국가 모자이크 플롯",
sub = "국가 별 제품 색상",
xlab = "색상",
ylab = "국가",
las = 1,
dir = c ( "h", "v"),
color = "skyblue2",
border = "chocolate")