def create_plot(position, angle, hjust, vjust):
if position == 'top' or position == 'bottom':
theme_element = theme(axis_text_x=element_text(angle=angle, hjust=hjust, vjust=vjust), axis_title="blank") + \
scale_x_discrete(position = f'{position}')
x_data = "x"
else:
theme_element = theme(axis_text_y=element_text(angle=angle, hjust=hjust, vjust=vjust), axis_title="blank") + \
scale_y_discrete(position = f'{position}')
x_data = "z"
return (
ggplot(data) +
geom_point(aes(x=x_data, y="y"), size=5) +
theme_classic() +
ggtitle(f"h{hjust}, v{vjust}") +
theme_element
)
def generate_all_plots(position, angle):
return [create_plot(position=position, angle=angle, hjust=hjust, vjust=vjust)
for hjust in justifications
for vjust in justifications]