需要幫助繪製二值圖像矩陣你好,我有一個二進制二維矩陣的圖像。
有沒有辦法可以在 JMP 上繪製圖表? 圖表中的 1 應該顯示一個黑點,而 0 則不顯示任何內容。
附件是需要繪製圖形的文件。
感謝您的幫助!
回复:需要幫助繪製二值圖像矩陣這是另一種方法,使用 JSL 並創建圖像文件
// data preparation, the data table needs some work to get it ready
_dt = Current Data Table();
_dt << Select rows( 1 );
_dt << delete rows;
For( ii = 1, ii <= N Cols( _dt ), ii++,
Column( _dt, ii ) << Set Name( "phase_" || Char( ii - 1 ) );
Column( _dt, ii ) << Set Data Type( Numeric );
Column( _dt, ii ) << Set Modeling Type( Continuous );
);
// Make an image file and display in new window with scaling control
// this assumes the entire table just has the binary columns
// get the binary values as a matrix
m = _dt << get as matrix;
// get the dimensions of the table/matrix
mdim = Dim( m );
// specify a minimum image size in pixels, this prevents the image from being
// too small to be useful
mininumimagepixeldim = [800 800];
// determine a scale factor to bring the size of the matrix up to the minimum dimensions
// specified above
scale_x = Ceiling( mininumimagepixeldim[2] / mdim[2] );
scale_y = Ceiling( mininumimagepixeldim[1] / mdim[1] );
// create a scaled image matrix, using the scale factors determined above
// and applying the direct product to scale up the image
r = 1 - Direct Product( m, J( scale_y, scale_x, 1 ) );
// create an image from the scaled image matrix
img = New Image( "rgb", {r, r, r} );
scalefactor = 1;
// create the display window
_nw = New Window( "Binary Image",
Outline Box( "Binary Image",
// create a slider controller to rescale the image
// this works by recreated the image, applying the scale factor,
// deleting the image in the display and redrawing the new image
V List Box(
H List Box(
Text Box( "Move Slider to Scale Image " ),
Slider Box(
.5,
1,
scalefactor,
img = New Image( "rgb", {r, r, r} );
img << Scale( scalefactor );
_picb << delete;
_panelb << Append( _picb = Picture Box( img ) )
;
)
),
// draw the binary image inside a panel box (just to give it an outline and a container)
_panelb = Panel Box( "Binary Image", _picb = Picture Box( img ) )
)
)
);結果看起來像這樣

回复:需要幫助繪製二值圖像矩陣非常感謝!回复:需要幫助繪製二值圖像矩陣這裡有幾種方法可以做到這一點。第一個是單元格圖。為此,需要更正您的數據表。
1. 刪除第 1 行。
2. 選擇所有列
3. 使用標準化屬性,將所有列從字符數據類型更改為數字數據類型。
4.使用Standardize Attributes,創建Value Colors的Column屬性,並將值0的顏色設置為白色,值1的顏色設置為黑色
5. 運行單元格繪圖平台
圖==>單元格圖
選擇所有列並將它們放入 Y 響應中,然後單擊“確定”

第二個例子是使用圖形生成器
1. 以上述修改後的數據表為例,需要添加一個新列來表示數據所在的行。 因此,添加一個名為“Row”的列並將其公式設置為
排()
2. 現在需要將數據基本上堆疊到一列 0 和 1 中。使用
表==>堆棧
平台,將所有列(“第 2 列”到“第 26 列”)複製到堆棧列中。
3. 在“非堆疊列”部分中,選中“選擇”複選框,然後選擇“行”列。
3. 單擊“確定”
4. 在新的堆疊數據表中,創建一個名為“Column”的新列,並將公式設置為
Num(Word(-1,:標籤," "))
這將從標籤列中獲取列號,並使其成為新列中的數值
5. 打開圖形生成器平台
圖表==>圖表生成器
6. 將行列拖至 Y 放置區域
7. 將Column列拖至X放置區域
8. 右鍵單擊圖表並選擇
更平滑==>刪除
9. 將數據列拖至顏色放置區域
10. 右鍵單擊圖例中 0 的彩色點並選擇
顏色==>白色
11. 右鍵單擊段中 1 的彩色點並選擇
顏色==>黑色
你會得到這個圖表

也可以使用其他方法。