Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Add Example to :class:`~.SampleSpace` (#1639)

Ujjayanta9a79a35b6135
diff --git a/manim/mobject/probability.py b/manim/mobject/probability.py
index c7ad4a800..c2cbc9d75 100644
--- a/manim/mobject/probability.py
+++ b/manim/mobject/probability.py
@@ -27,6 +27,24 @@ EPSILON = 0.0001
class SampleSpace(Rectangle):
+ """
+
+ Examples
+ --------
+
+ .. manim:: ExampleSampleSpace
+ :save_last_frame:
+
+ 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)
+ """
+
def __init__(
self,
height=3,