需要帮助绘制二值图像矩阵你好,我有一个二进制二维矩阵的图像。
有没有办法可以在 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 的彩色点并选择
颜色==>黑色
你会得到这个图表

也可以使用其他方法。