fill_between3d
Mojo function 🡭
fill_between3d
fn def fill_between3d(df: DataFrame, x1: String, y1: String, z1: String, x2: String, y2: String, z2: String, elev: Float64 = 30, azim: Float64 = -60, theme: Theme = Theme(WHITE, Color(UInt8(30), UInt8(100), UInt8(180), UInt8(255)), Color(UInt8(80), UInt8(80), UInt8(80), UInt8(255)), Color(UInt8(225), UInt8(225), UInt8(225), UInt8(255)), Color(UInt8(40), UInt8(40), UInt8(40), UInt8(255)), SIMD(12), SIMD(3.5), SIMD(2), Int(60), Int(20), Int(20), Int(50), True, False, False, Color(UInt8(240), UInt8(240), UInt8(240), UInt8(255)), Int(3), Color(UInt8(60), UInt8(110), UInt8(200), UInt8(255)), Color(UInt8(235), UInt8(235), UInt8(235), UInt8(255)), Color(UInt8(220), UInt8(90), UInt8(40), UInt8(255)), ColorRamp(), ColorPalette(), SIMD(3), SIMD(15), True, SIMD(1), Int(0), False, Color(UInt8(200), UInt8(60), UInt8(60), UInt8(255)), Color(UInt8(224), UInt8(224), UInt8(224), UInt8(255)), Color(UInt8(120), UInt8(120), UInt8(120), UInt8(255)), Color(UInt8(100), UInt8(100), UInt8(100), UInt8(255)), Color(UInt8(230), UInt8(230), UInt8(230), UInt8(255)), Color(UInt8(255), UInt8(255), UInt8(255), UInt8(255)), UInt8(90), UInt8(160), False, False, SIMD(0), SIMD(18), SIMD(14), Color(UInt8(110), UInt8(110), UInt8(110), UInt8(255)), SIMD(14), Color(UInt8(150), UInt8(150), UInt8(150), UInt8(255)), Color(UInt8(224), UInt8(236), UInt8(246), UInt8(200)), Color(UInt8(255), UInt8(255), UInt8(255), UInt8(255)), True, False, False, True, AxisPosition.EDGE, AxisPosition.EDGE, String("sans-serif"), True, UInt8(90), Int(5), Int(4), Int(130), Int(14), Int(8), Int(14), Int(100), Int(8), SIMD(4), OutputFormat.SVG, Tooltips.AUTO, Missing.DRAW, String("(missing)"), Int(1000), False, LineStyle.SOLID, SIMD(1.5), LineStyle.SOLID, LegendPosition.RIGHT, XAxisLabelRotation.AUTO, TickFormat.AUTO, TickFormat.AUTO), width: Int = Int(640), height: Int = Int(480), title: String = "", subtitle: String = "") -> Chart[FillBetween3d]fill_between3d() over named columns of a dataframe_mojo DataFrame (#743). Each argument names a column instead of holding the values.
See Plot.encode_frame() for how columns are read and what a
column with missing values does.
Args:
- df (
DataFrame): The frame to read. - x1 (
String): The numeric column for this channel. - y1 (
String): The numeric column for this channel. - z1 (
String): The numeric column for this channel. - x2 (
String): The numeric column for this channel. - y2 (
String): The numeric column for this channel. - z2 (
String): The numeric column for this channel. - elev (
Float64): See the list overload. - azim (
Float64): See the list overload. - theme (
Theme): See the list overload. - width (
Int): See the list overload. - height (
Int): See the list overload. - title (
String): See the list overload. - subtitle (
String): See the list overload.
Returns:
Chart[FillBetween3d]: The finished chart – unrendered.
Raises:
Error: A named column is missing, has the wrong dtype for its channel, or has missing values.
fn def fill_between3d[dtype: DType](x1: List[Scalar[dtype]], y1: List[Scalar[dtype]], z1: List[Scalar[dtype]], x2: List[Scalar[dtype]], y2: List[Scalar[dtype]], z2: List[Scalar[dtype]], elev: Float64 = 30, azim: Float64 = -60, theme: Theme = Theme(WHITE, Color(UInt8(30), UInt8(100), UInt8(180), UInt8(255)), Color(UInt8(80), UInt8(80), UInt8(80), UInt8(255)), Color(UInt8(225), UInt8(225), UInt8(225), UInt8(255)), Color(UInt8(40), UInt8(40), UInt8(40), UInt8(255)), SIMD(12), SIMD(3.5), SIMD(2), Int(60), Int(20), Int(20), Int(50), True, False, False, Color(UInt8(240), UInt8(240), UInt8(240), UInt8(255)), Int(3), Color(UInt8(60), UInt8(110), UInt8(200), UInt8(255)), Color(UInt8(235), UInt8(235), UInt8(235), UInt8(255)), Color(UInt8(220), UInt8(90), UInt8(40), UInt8(255)), ColorRamp(), ColorPalette(), SIMD(3), SIMD(15), True, SIMD(1), Int(0), False, Color(UInt8(200), UInt8(60), UInt8(60), UInt8(255)), Color(UInt8(224), UInt8(224), UInt8(224), UInt8(255)), Color(UInt8(120), UInt8(120), UInt8(120), UInt8(255)), Color(UInt8(100), UInt8(100), UInt8(100), UInt8(255)), Color(UInt8(230), UInt8(230), UInt8(230), UInt8(255)), Color(UInt8(255), UInt8(255), UInt8(255), UInt8(255)), UInt8(90), UInt8(160), False, False, SIMD(0), SIMD(18), SIMD(14), Color(UInt8(110), UInt8(110), UInt8(110), UInt8(255)), SIMD(14), Color(UInt8(150), UInt8(150), UInt8(150), UInt8(255)), Color(UInt8(224), UInt8(236), UInt8(246), UInt8(200)), Color(UInt8(255), UInt8(255), UInt8(255), UInt8(255)), True, False, False, True, AxisPosition.EDGE, AxisPosition.EDGE, String("sans-serif"), True, UInt8(90), Int(5), Int(4), Int(130), Int(14), Int(8), Int(14), Int(100), Int(8), SIMD(4), OutputFormat.SVG, Tooltips.AUTO, Missing.DRAW, String("(missing)"), Int(1000), False, LineStyle.SOLID, SIMD(1.5), LineStyle.SOLID, LegendPosition.RIGHT, XAxisLabelRotation.AUTO, TickFormat.AUTO, TickFormat.AUTO), width: Int = Int(640), height: Int = Int(480), title: String = "", subtitle: String = "") -> Chart[FillBetween3d]The surface between two curves through space: a ribbon joining them sample by sample.
Mark.FILL_BETWEEN3D. Sample i of the first curve is joined to
sample i of the second, so the pairing is the caller’s rather
than something inferred from position, and the two columns must be
the same length.
Use it for the space a path sweeps, or the gap between a measured curve and a reference one where both live in three dimensions. Where the two curves cross, the quad joining them folds over itself and shows as a pinch in the ribbon – there is no order that draws a folded quad correctly, and the pinch is the honest picture of curves that cross.
Example:
from std.math import cos, sin
from dataviz import fill_between3d, save
def main() raises:
# Illustrative envelope: a helix and a wider one outside it,
# with the sheet between them.
var x1 = List[Float64]()
var y1 = List[Float64]()
var z1 = List[Float64]()
var x2 = List[Float64]()
var y2 = List[Float64]()
var z2 = List[Float64]()
for i in range(90):
var t = Float64(i) * 0.14
x1.append(cos(t))
y1.append(sin(t))
z1.append(Float64(i) * 0.04)
x2.append(cos(t) * 1.7)
y2.append(sin(t) * 1.7)
z2.append(Float64(i) * 0.04)
var c = fill_between3d(
x1,
y1,
z1,
x2,
y2,
z2,
title="Illustrative Sheet Between Two Helices",
)
save(c, "docs/src/examples/out_fill_between3d.svg")Parameters:
- dtype (
DType)
Args:
- x1 (
List[Scalar[dtype]]): The first curve’s x column. - y1 (
List[Scalar[dtype]]): The first curve’s y column, the same length. - z1 (
List[Scalar[dtype]]): The first curve’s z column, the same length. - x2 (
List[Scalar[dtype]]): The second curve’s x column, the same length. - y2 (
List[Scalar[dtype]]): The second curve’s y column, the same length. - z2 (
List[Scalar[dtype]]): The second curve’s z column, the same length. - elev (
Float64): Degrees to look down on the scene from, above the x-y plane. - azim (
Float64): Degrees to turn the scene through, about the z axis. - theme (
Theme): Full styling knobs beyond this function’s own parameters – seeTheme’s docstring. - width (
Int): Pixel width of the returnedPlot(.size()). - height (
Int): Pixel height of the returnedPlot(.size()). - title (
String): The chart’s title, shown above the plot. - subtitle (
String): A secondary line shown under the title.
Returns:
Chart[FillBetween3d]: The finished chart – unrendered. Call save(plot, path) to write it (any of .svg/.png/.pdf/.bmp), or render(plot)/render_svg(plot) for the explicit two-step.
Raises:
Error: The six columns disagree in length, or there are fewer than two samples.