Skip to content

Instantly share code, notes, and snippets.

@audhiaprilliant
Created April 25, 2022 15:35
Show Gist options
  • Select an option

  • Save audhiaprilliant/b5a415f33842f989594a9e6d94ee9124 to your computer and use it in GitHub Desktop.

Select an option

Save audhiaprilliant/b5a415f33842f989594a9e6d94ee9124 to your computer and use it in GitHub Desktop.
Simulation of Monty Hall Problem
plotnine.options.figure_size = (10, 4.8)
(
ggplot(
data = df_general
)+
geom_line(
aes(x = 'iter',
y = 'value',
group = 'status',
color = 'status'),
size = 1
)+
scale_x_continuous(
breaks = range(0, len(df_general) + 100, 100)
)+
scale_color_manual(
values = ['#981220', '#80797c'],
labels = ['Stick', 'Switch']
)+
labs(
title = 'Probability of winning the game',
color = 'Strategy'
)+
xlab(
xlab = 'Number of iteration'
)+
ylab(
ylab = 'Number of chance'
)+
theme_minimal()+
theme(
legend_position = (0.225, 0.815),
legend_direction = 'horizontal'
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment