SampleSpace¶
Qualified name: manim.mobject.graphing.probability.SampleSpace
- class SampleSpace(height=3, width=3, fill_color=ManimColor('#444444'), fill_opacity=1, stroke_width=0.5, stroke_color=ManimColor('#BBBBBB'), default_label_scale_val=1)[source]¶
Bases:
RectangleA mobject representing a twodimensional rectangular sampling space.
Examples
Example: ExampleSampleSpace ¶
from manim import * class ExampleSampleSpace(Scene): def construct(self): poly1 = SampleSpace(stroke_width=15, fill_opacity=1) poly2 = SampleSpace(width=5, height=3, stroke_width=5, fill_opacity=0.5) poly3 = SampleSpace(width=2, height=2, stroke_width=5, fill_opacity=0.1) poly3.divide_vertically(p_list=np.array([0.37, 0.13, 0.5]), colors=[BLACK, WHITE, GRAY], vect=RIGHT) poly_group = VGroup(poly1, poly2, poly3).arrange() self.add(poly_group)
class ExampleSampleSpace(Scene): def construct(self): poly1 = SampleSpace(stroke_width=15, fill_opacity=1) poly2 = SampleSpace(width=5, height=3, stroke_width=5, fill_opacity=0.5) poly3 = SampleSpace(width=2, height=2, stroke_width=5, fill_opacity=0.1) poly3.divide_vertically(p_list=np.array([0.37, 0.13, 0.5]), colors=[BLACK, WHITE, GRAY], vect=RIGHT) poly_group = VGroup(poly1, poly2, poly3).arrange() self.add(poly_group)Methods
add_braces_and_labelsadd_labeladd_titlecomplete_p_listdivide_horizontallydivide_verticallyget_bottom_braces_and_labelsget_division_along_dimensionget_horizontal_divisionget_side_braces_and_labelsget_subdivision_braces_and_labelsget_top_braces_and_labelsget_vertical_divisionAttributes
alwaysCall a method on a mobject every frame.
animateUsed to animate the application of any method of
self.animation_overridescolordepthThe depth of the mobject.
fill_colorIf there are multiple colors (for gradient) this returns the first one
heightThe height of the mobject.
n_points_per_curvesheen_factorstroke_colorwidthThe width of the mobject.
- Parameters:
height (float)
width (float)
fill_color (ParsableManimColor)
fill_opacity (float)
stroke_width (float)
stroke_color (ParsableManimColor)
default_label_scale_val (float)
- _original__init__(height=3, width=3, fill_color=ManimColor('#444444'), fill_opacity=1, stroke_width=0.5, stroke_color=ManimColor('#BBBBBB'), default_label_scale_val=1)¶
Initialize self. See help(type(self)) for accurate signature.
- Parameters:
height (float)
width (float)
fill_color (ParsableManimColor)
fill_opacity (float)
stroke_width (float)
stroke_color (ParsableManimColor)
default_label_scale_val (float)