BBohua ZhanAdd more docs.
4be840a1创建于 2022年9月16日历史提交

Plot Matrix

Plot matrix shows the relationship between two matrices of data or between each pair of rows in a single matrix.

If two matrices :math:x and :math:y are given, it produces the scatter plot of :math:i'th row of :math:y and :math:x for each :math:i.

If one matrix :math:x is given, it produces histogram of each row of :math:x, and scatter plot comparing each pair of rows in :math:x.

Examples

  1. Basic plot matrix (providing :math:x, y values).

::

var m: Random = Random(1)

let X = empty<Float64>(3, 50)
X[0] = randn(m, 50, 0.0, 1.0)
X[1] = randn(m, 50, 0.0, 1.0)
X[2] = randn(m, 50, 0.0, 1.0)

let Y = empty<Float64>(3, 50)
Y[0] = linspace(1.0, 50.0, num:50)
Y[1] = linspace(51.0, 100.0, num:50)
Y[2] = linspace(101.0, 150.0, num:50)
plotmatrix(X, Y)

Result:

.. image:: ../../../tests/imgs/plot_matrix/plot_matrix_1.png :align: center :width: 360

  1. Basic plot matrix (providing only :math:x values).

::

var m: Random = Random(1)

let X = empty<Float64>(3, 200)
X[0] = randn(m, 200, 0.0, 1.0)
X[1] = randn(m, 200, 0.0, 1.0)
X[2] = randn(m, 200, 0.0, 1.0)

plotmatrix(X)

Result:

.. image:: ../../../tests/imgs/plot_matrix/plot_matrix_2.png :align: center :width: 360

  1. Basic plot matrix with custom line style.

::

var m: Random = Random(1)

let X = empty<Float64>(3, 200)
X[0] = randn(m, 200, 0.0, 1.0)
X[1] = randn(m, 200, 0.0, 1.0)
X[2] = randn(m, 200, 0.0, 1.0)

plotmatrix(X, line_spec: "*r")

Result:

.. image:: ../../../tests/imgs/plot_matrix/plot_matrix_3.png :align: center :width: 360

Methods

============================== =============================== Method Description ============================== =============================== plotmatrix 2 methods Plot a plotmatrix ============================== ===============================

Description

.. function:: plotmatrix(x, y, line_spec!)

:param x: Matrix<Float64>
:param y: Matrix<Float64>
:param line_spec: String

Plot a plotmatrix with two matrices.

.. function:: plotmatrix(x, line_spec!)

:param x: Matrix<Float64>
:param line_spec: String

Plot a plotmatrix with single matrix input.