Function Plot 3d
Plotting three functions against each other in 3D view.
Examples
- Plotting three functions.
::
fplot3(sin, cos, {t:Float64 => t})
Result:
.. image:: ../../../tests/imgs/func_plot_3d/func_plot3d1.png :align: center :width: 360
- Plotting three functions with custom range.
::
let xt = { t:Float64 => exp(-t / 10.0) * sin(5.0 * t) }
let yt = { t:Float64 => exp(-t / 10.0) * cos(5.0 * t) }
fplot3(xt, yt, {t:Float64 => t}, -10.0, 10.0)
Result:
.. image:: ../../../tests/imgs/func_plot_3d/func_plot3d2.png :align: center :width: 360
- Plotting with different t-range.
::
let f = fplot3(sin, cos, {t:Float64 => t}, 0.0, 2.0 * PI64)
hold(true)
fplot3(sin, cos, {t:Float64 => t}, 2.0 * PI64, 4.0 * PI64, line_spec: "--or")
fplot3(sin, cos, {t:Float64 => t}, 4.0 * PI64, 6.0 * PI64, line_spec: "-.*c")
hold(false)
Result:
.. image:: ../../../tests/imgs/func_plot_3d/func_plot3d3.png :align: center :width: 360
- Plotting a complicated function (note: animation not included).
::
let xt = { t:Float64 => exp(-abs(t) / 10.0) * sin(5.0 * abs(t)) }
let yt = { t:Float64 => exp(-abs(t) / 10.0) * cos(5.0 * abs(t)) }
let zt = { t:Float64 => t }
fplot3(xt, yt, zt, -10.0, 10.0).color("r")
xlabel("e^{-|z|/10} sin(2|z|")
ylabel("e^{-|z|/10} cos(2|z|")
zlabel("z")
grid(true)
Result:
.. image:: ../../../tests/imgs/func_plot_3d/func_plot3d4.png :align: center :width: 360
- Plotting with custom view, ticks and tick labels.
::
let xt = {t:Float64 => t}
let yt = {t:Float64 => t / 2.0}
let zt = {t:Float64 => sin(6.0 * t) }
fplot3(xt, yt, zt, -2.0 * PI64, 2.0 * PI64, mesh_density: 300)
.line_width(1.0)
title("x=t, y=t/2, z=sin(6t) for -2π<t<2π")
xlabel("x")
ylabel("y")
view(52.5, 30.0)
box(true)
xrange(-2.0 * PI64, 2.0 * PI64)
yrange(-PI64, PI64)
xticks(linspace(-2.0 * PI64, 2.0 * PI64, num: 9))
xticklabels(["-2π", "-3π/2", "-π", "-π/2", "0", "π/2", "π", "3π/2", "2π"])
yticks(linspace(-PI64, PI64, num: 5))
yticklabels(["-π", "-π/2", "0", "π/2", "π"])
Result:
.. image:: ../../../tests/imgs/func_plot_3d/func_plot3d5.png :align: center :width: 360
Methods
===================== ============================ Method Description ===================== ============================ fplot3 2 methods Plot given 3d function ===================== ============================
Description
.. function:: fplot3(fx, fy, fz, line_spec!)
:param fx: (Float64)->Float64
:param fy: (Float64)->Float64
:param fz: (Float64)->Float64
:param line_spec: String
Plot a line with given function; fx, fy, fz are functions with variable t.
.. function:: fplot3(fx, fy, fz, t_start, t_end, mesh_density!, line_spec!)
:param fx: (Float64)->Float64
:param fy: (Float64)->Float64
:param fz: (Float64)->Float64
:param t_start: Float64
:param t_end: Float64
:param mesh_density: Int64
:param line_spec: String
Plot a line with given function, given the range of t and the mesh density.