bf4785d2创建于 2022年9月19日历史提交

Scatter Plot 3d

Produces 3-dimensional version of scatter plots.

Examples

  1. Scatter plot of concentric spheres.

::

let (x, y, z) = generate_data()
let sz = x.size() / 3
scatter3(x, y, z)

Result:

.. image:: ../../../tests/imgs/scatter3_plot/scatter3Plot_1.png :align: center :width: 360

  1. Scatter plot where dots have different sizes.

::

let (x, y, z) = generate_data()
let sz = x.size() / 3
let sizes = concat([vector(sz, 16.0), vector(sz, 8.0), vector(sz, 2.0)])
scatter3(x, y, z, sizes)
view(40.0, 35.0)

Result:

.. image:: ../../../tests/imgs/scatter3_plot/scatter3Plot_2.png :align: center :width: 360

  1. Scatter plot where dots have different sizes and colors.

::

let (x, y, z) = generate_data()
let sz = x.size() / 3
let sizes = concat([vector(sz, 16.0), vector(sz, 8.0), vector(sz, 2.0)])
let colors = concat([vector(sz, 1.0), vector(sz, 2.0), vector(sz, 3.0)])
scatter3(x, y, z, sizes, colors)
view(40.0, 35.0)

Result:

.. image:: ../../../tests/imgs/scatter3_plot/scatter3Plot_3.png :align: center :width: 360

  1. Make scattered plot with filled circles.

::

let r: Random = Random(1)
let z = linspace(0.0, 4.0 * PI64, num: 250)
let x = z.apply(cos) * 2.0 + rand(r, 250)
let y = z.apply(sin) * 2.0 + rand(r, 250)
scatter3(x, y, z, line_spec: "filled")

Result:

.. image:: ../../../tests/imgs/scatter3_plot/scatter3Plot_4.png :align: center :width: 360

  1. Make scattered plot with x-markers.

::

let r: Random = Random(1)
let z = linspace(0.0, 4.0 * PI64, num: 250)
let x = z.apply(cos) * 2.0 + rand(r, 250)
let y = z.apply(sin) * 2.0 + rand(r, 250)
scatter3(x, y, z, line_spec: "*")

Result:

.. image:: ../../../tests/imgs/scatter3_plot/scatter3Plot_5.png :align: center :width: 360

  1. Customize marker face color.

::

let (x, y, z) = generate_data()
let sz = x.size() / 3
let sizes = concat([vector(sz, 16.0), vector(sz, 8.0), vector(sz, 2.0)])
let colors = concat([vector(sz, 1.0), vector(sz, 2.0), vector(sz, 3.0)])
scatter3(x, y, z, sizes, colors).marker_face_color(0.0, 0.5, 0.5)
view(40.0, 35.0)

Result:

.. image:: ../../../tests/imgs/scatter3_plot/scatter3Plot_6.png :align: center :width: 360

Methods

=========================== ============================================== Method Description =========================== ============================================== scatter3 2 methods Plot a 3d scatter line =========================== ==============================================

Description

.. function:: scatter3(x, y, z, line_spec!)

:param x: Vector<Float64>
:param y: Vector<Float64>
:param z: Vector<Float64>
:line_spec: String

Plot a 3d scatter line with :math:`x`, :math:`y`, :math:`z`.

.. function:: scatter3(x, y, z, sz, line_spec!)

:param x: Vector<Float64>
:param y: Vector<Float64>
:param z: Vector<Float64>
:param sz: ector<Float64>
:line_spec: String

Plot a 3d scatter line with :math:`x`, :math:`y`, :math:`z` with size of every point.