JLDrawFunctions Ex

jplot.spad line 1348 [edit on github]

JLDrawFunctions provides top level functions for drawing graphics of expressions.

jlContour!: (Ex, SegmentBinding Float, SegmentBinding Float) -> Void

jlContour!(f(x, y), x = a..b, y = c..d) adds the contour plot of z = f(x, y) as x ranges from min(a, b) to max(a, b) and y ranges from min(c, d) to max(c, d) on the existing graph window. f(x, y) appears as the title. Example (Concentric Circular Waves):

jlContour!(cos(x^2 + y^2), x = -3.0..3.0, y = -3.0..3.0)
jlContour: (Ex, SegmentBinding Float, SegmentBinding Float) -> Void

jlContour(f(x, y), x = a..b, y = c..d) draws the contour plot of z = f(x, y) as x ranges from min(a, b) to max(a, b) and y ranges from min(c, d) to max(c, d). f(x, y) appears as the title. Example (Rosenbrock Banana Contours):

jlContour((1 - x)^2 + 10*(y - x^2)^2, x = -2.0..2.0, y = -1.0..3.0)
jlContourf!: (Ex, SegmentBinding Float, SegmentBinding Float) -> Void

jlContourf!(f(x, y), x = a..b, y = c..d) adds the filled contour plot of z = f(x, y) as x ranges from min(a, b) to max(a, b) and y ranges from min(c, d) to max(c, d) on the existing graph window. f(x, y) appears as the title. Fills area between contours. Example (Dipole Peaks Filled Contours):

jlContourf!(exp(-(x-1)^2 - y^2) - exp(-(x+1)^2 - y^2), x = -3.0..3.0, y = -2.0..2.0)
jlContourf: (Ex, SegmentBinding Float, SegmentBinding Float) -> Void

jlContourf(f(x, y), x = a..b, y = c..d) draws the filled contour plot of z = f(x, y) as x ranges from min(a, b) to max(a, b) and y ranges from min(c, d) to max(c, d). f(x, y) appears as the title. Fills area between contours. Example (Egg Carton Filled Contours):

jlContourf(sin(x)*cos(y), x = -4.0..4.0, y = -4.0..4.0)
jlHeatmap!: (Ex, SegmentBinding Float, SegmentBinding Float) -> Void

jlHeatmap!(f(x, y), x = a..b, y = c..d) adds a 2D heatmap on the existing plot. Example (Chladni Interference Heatmap):

jlHeatmap!(cos(2*x)*cos(2*y), x = -3.0..3.0, y = -3.0..3.0)
jlHeatmap: (Ex, SegmentBinding Float, SegmentBinding Float) -> Void

jlHeatmap(f(x, y), x = a..b, y = c..d) draws a 2D heatmap of f(x, y). Example (Concentric Waves Heatmap):

jlHeatmap(sin(x^2 + y^2), x = -3.0..3.0, y = -3.0..3.0)
jlImplicitPlot: (Ex, SegmentBinding Float, SegmentBinding Float) -> Void

jlImplicitPlot(f(x, y), x = a..b, y = c..d) draws the 2D implicit curve f(x, y) = 0. Example (Folium of Descartes and Lemniscate of Bernoulli):

jlImplicitPlot(x^3 + y^3 - 3*x*y, x = -3.0..3.0, y = -3.0..3.0)
jlImplicitPlot((x^2 + y^2)^2 - 2*(x^2 - y^2), x = -2.0..2.0, y = -2.0..2.0)
jlParametricPlot!: (Ex, Ex, Ex, SegmentBinding Float) -> Void

jlParametricPlot!(x(t), y(t), z(t), t = a..b) adds the 3D space curve on existing plot. Example (Trefoil Knot):

jlParametricPlot!(sin(t) + 2*sin(2*t), cos(t) - 2*cos(2*t), -sin(3*t), t = 0..2*\%\ :code:`pi`\ )
jlParametricPlot!: (Ex, Ex, SegmentBinding Float) -> Void

jlParametricPlot!(x(t), y(t), t = a..b) adds the 2D parametric curve on existing plot. Example (Lissajous 3:4 Curve):

jlParametricPlot!(sin(3*t), sin(4*t), t = 0..2*\%\ :code:`pi`\ )
jlParametricPlot: (Ex, Ex, Ex, SegmentBinding Float) -> Void

jlParametricPlot(x(t), y(t), z(t), t = a..b) draws the 3D space curve. Example (Circular Helix):

jlParametricPlot(cos(t), sin(t), t/5, t = 0..4*\%\ :code:`pi`\ )
jlParametricPlot: (Ex, Ex, SegmentBinding Float) -> Void

jlParametricPlot(x(t), y(t), t = a..b) draws the 2D parametric curve. Example (Astroid Curve):

jlParametricPlot(cos(t)^3, sin(t)^3, t = 0..2*\%\ :code:`pi`\ )
jlPlot!: (Ex, SegmentBinding Float) -> Void

jlPlot!(f(x), x = a..b) adds the graph of y = f(x) as x ranges from min(a, b) to max(a, b) on the existing graphic window. f(x) appears as the title. Example:

jlPlot!(cos(x), x = -\%\ :code:`pi`\ ..\%\ :code:`pi`\ )
jlPlot!: (Ex, SegmentBinding Float, SegmentBinding Float) -> Void

jlPlot!(f(x, y), x = a..b, y = c..d) adds the graph of z = f(x, y) as x ranges from min(a, b) to max(a, b) and y ranges from min(c, d) to max(c, d) on the existing graph window. f(x, y) appears as the title. Example (Elliptic Paraboloid Bowl):

jlPlot!((x^2 + y^2)/2, x = -2.0..2.0, y = -2.0..2.0)
jlPlot!: (List Ex, SegmentBinding Float) -> Void

jlPlot!([f1, f2, ...], x = a..b) adds multiple curves on the existing plot. Example:

jlPlot!([cos(2*x), sin(3*x)], x = -\%\ :code:`pi`\ ..\%\ :code:`pi`\ )
jlPlot: (Ex, SegmentBinding Float) -> Void

jlPlot(f(x), x = a..b) draws the graph of y = f(x) as x ranges from min(a, b) to max(a, b). f(x) appears as the title. Example:

jlPlot(sin(x), x = -\%\ :code:`pi`\ ..\%\ :code:`pi`\ )
jlPlot: (Ex, SegmentBinding Float, SegmentBinding Float) -> Void

jlPlot(f(x, y), x = a..b, y = c..d) draws the graph of z = f(x, y) as x ranges from min(a, b) to max(a, b) and y ranges from min(c, d) to max(c, d). f(x, y) appears as the title. Example (Hyperbolic Paraboloid / Saddle):

jlPlot(x^2 - y^2, x = -2.0..2.0, y = -2.0..2.0)
jlPlot: (List Ex, SegmentBinding Float) -> Void

jlPlot([f1, f2, ...], x = a..b) draws multiple curves on the same plot. Example:

jlPlot([sin(x), cos(x), sin(2*x)], x = -\%\ :code:`pi`\ ..\%\ :code:`pi`\ )
jlPolar!: (Ex, SegmentBinding Float) -> Void

jlPolar!(r(theta), theta = a..b) adds the polar curve on existing plot. Example (4-Petal Rose):

jlPolar!(sin(2*t), t = 0..2*\%\ :code:`pi`\ )
jlPolar: (Ex, SegmentBinding Float) -> Void

jlPolar(r(theta), theta = a..b) draws the polar curve r = f(theta). Example (Cardioid):

jlPolar(1 + cos(t), t = 0..2*\%\ :code:`pi`\ )
jlSurface!: (Ex, SegmentBinding Float, SegmentBinding Float) -> Void

jlSurface!(f(x, y), x = a..b, y = c..d) adds the surface of z = f(x, y) as x ranges from min(a, b) to max(a, b) and y ranges from min(c, d) to max(c, d) on the existing graph window. f(x, y) appears as the title. Example (Gaussian Bell Hill):

jlSurface!(exp(-x^2 - y^2), x = -2.0..2.0, y = -2.0..2.0)
jlSurface: (Ex, SegmentBinding Float, SegmentBinding Float) -> Void

jlSurface(f(x, y), x = a..b, y = c..d) draws the surface of z = f(x, y) as x ranges from min(a, b) to max(a, b) and y ranges from min(c, d) to max(c, d). f(x, y) appears as the title. Example (Sombrero / Circular Waves):

jlSurface(exp(-(x^2 + y^2)/4)*cos(sqrt(x^2 + y^2)), x = -5.0..5.0, y = -5.0..5.0)
jlVectorField: (Ex, Ex, SegmentBinding Float, SegmentBinding Float) -> Void

jlVectorField(u(x, y), v(x, y), x = a..b, y = c..d) draws the 2D vector field. Example (Rotational Vortex and Hyperbolic Saddle):

jlVectorField(-y, x, x = -2.0..2.0, y = -2.0..2.0)
jlVectorField(x, -y, x = -2.0..2.0, y = -2.0..2.0)
jlWireframe!: (Ex, SegmentBinding Float, SegmentBinding Float) -> Void

jlWireframe!(f(x, y), x = a..b, y = c..d) adds the wireframe of z = f(x, y) as x ranges from min(a, b) to max(a, b) and y ranges from min(c, d) to max(c, d) on the existing graph window. f(x, y) appears as the title. Example (Cone Wireframe):

jlWireframe!(sqrt(x^2 + y^2), x = -3.0..3.0, y = -3.0..3.0)
jlWireframe: (Ex, SegmentBinding Float, SegmentBinding Float) -> Void

jlWireframe(f(x, y), x = a..b, y = c..d) draws the wireframe of z = f(x, y) as x ranges from min(a, b) to max(a, b) and y ranges from min(c, d) to max(c, d); f(x, y) appears as the title. Example (Monkey Saddle Wireframe):

jlWireframe(x^3 - 3*x*y^2, x = -2.0..2.0, y = -2.0..2.0)