New thumbnails

This commit is contained in:
Grant Sanderson 2021-08-18 20:59:10 -07:00
parent 3088f7993e
commit 487e33299f
2 changed files with 115 additions and 12 deletions

View file

@ -1019,7 +1019,7 @@ class DescriptionOfSteve(Scene):
)
class IntroduceKahnemanAndTversky(DescriptionOfSteve, MovingCameraScene):
class IntroduceKahnemanAndTversky(DescriptionOfSteve):
def construct(self):
# Introduce K and T
images = Group(
@ -4107,6 +4107,10 @@ class BayesTheoremOnProportions(Scene):
self.wait()
class GraphScene(Scene):
pass
class GlimpseOfNextVideo(GraphScene):
CONFIG = {
"x_axis_label": "",
@ -4826,3 +4830,77 @@ class Thumbnail(Scene):
self.add(equals, frac)
VGroup(formula, equals, frac).to_edge(UP, buff=SMALL_BUFF)
class Thumbnail2(Scene):
def construct(self):
diagram = BayesDiagram(0.25, 0.4, 0.1)
# Labels
diagram.set_height(3)
diagram.add_brace_attrs()
braces = VGroup(
diagram.h_brace,
diagram.he_brace,
diagram.nhe_brace,
)
diagram.add(*braces)
kw = {
"tex_to_color_map": {
"H": YELLOW,
"E": BLUE,
"\\neg": RED,
},
"font_size": 24,
}
labels = VGroup(
Tex("P(H)", **kw),
Tex("P(E|H)", **kw),
Tex("P(E|\\neg H)", **kw),
)
for label, brace, vect in zip(labels, braces, [DOWN, LEFT, RIGHT]):
label.next_to(brace, vect, buff=SMALL_BUFF)
diagram.add(*labels)
# End labels
diagram.set_height(5)
diagram.to_edge(LEFT)
diagram.to_edge(DOWN)
self.add(diagram)
frac = VGroup(
diagram.he_rect.copy(),
Line(LEFT, RIGHT).set_width(7),
VGroup(
diagram.he_rect.copy(),
Tex("+", font_size=120),
diagram.nhe_rect.copy(),
).arrange(RIGHT)
).arrange(DOWN, buff=0.5)
frac.set_width(5)
frac.move_to(diagram, UP)
frac.to_edge(RIGHT)
self.add(frac)
right_arrow = Arrow(
diagram.get_right(),
frac[1].get_left(),
thickness=0.1,
fill_color=GREEN
)
words = TexText("This is Bayes' rule", font_size=108)
words.to_edge(UP)
arrow = Arrow(
words,
frac,
thickness=0.1,
)
arrow.scale(1.5, about_point=arrow.get_start())
self.add(words, arrow)

View file

@ -57,9 +57,8 @@ def get_covid_clipboard(disease_name="SARS\\\\CoV-2", sign="+", report="Detected
# Scenes
class Thumbnail(Scene):
class Thumbnail1(Scene):
def construct(self):
self.clear()
# New
bg = FullScreenFadeRectangle()
bg.set_fill(BLACK, 1)
@ -104,14 +103,6 @@ class Thumbnail(Scene):
self.add(group)
clipboard = get_covid_clipboard("Virus")
clipboard[2][0].set_stroke(GREEN, 8)
clipboard[2].scale(0.9)
clipboard.set_width(arrow.get_width() * 1.0)
clipboard.next_to(arrow, UP)
VGroup(clipboard, arrow).shift_onto_screen(buff=MED_SMALL_BUFF)
self.add(clipboard)
# Or try something else...
self.remove(group)
randy = Randolph(color=SICKLY_GREEN, mode="sick")
@ -184,7 +175,7 @@ class Thumbnail(Scene):
self.embed()
class AltThumbnail(Scene):
class Thumbnail2(Scene):
def construct(self):
dots = Dot().get_grid(9 * 5, 16 * 5, buff=MED_LARGE_BUFF)
dots.set_height(FRAME_HEIGHT)
@ -237,6 +228,40 @@ class AltThumbnail(Scene):
# VGroup(formula, rect, rect_label).to_edge(DOWN)
class Thumbnail3(Scene):
def construct(self):
bg = FullScreenFadeRectangle()
bg.set_fill(BLACK, 1)
bg.set_gloss(0.4)
self.add(bg)
# Just the clipboard
clipboard = get_covid_clipboard("Cancer", color=GREEN)
clipboard[2][0].set_stroke(GREEN, 8)
clipboard[2].scale(0.9)
clipboard.set_height(7)
clipboard.center().to_edge(LEFT, buff=MED_SMALL_BUFF)
self.add(clipboard)
clipback = VMobject()
clipback.set_points(clipboard[1].get_subpaths()[0])
clipback.set_stroke(BLACK, 0)
clipback.set_fill(BLACK, 1)
self.add(clipback, clipboard)
# Title
words = VGroup(
TexText("90\\% test accuracy", tex_to_color_map={"90\\%": GREEN}),
Tex("&9\\%\\text{ chance it's true}", tex_to_color_map={"9\\%": RED}),
Text("...how?")
)
words.arrange(DOWN, buff=0.75, aligned_edge=LEFT)
words.set_width(FRAME_WIDTH - clipboard.get_width() - 1.5)
words.to_edge(RIGHT, buff=0.5)
words.set_stroke(BLACK, 10, background=True)
self.add(words)
class MathAsDesign(Scene):
def construct(self):
# Setup