
We’ll also add the x and y labels, which are relatively straightforward. Since we only have one chart, we can use this to write our title, then use the title method to write the subtitle and a text for the caption. There’s a less known method called ‘suptitle,’ which is supposed to be a title for the entire visualization (mostly used for when you have multiple subplots). We only have ‘title.’ The subtitle and caption should be plotted as ‘text.’ Now that we figured out our colors and legend let’s add some texts to our visualization.įor our Python’s chart, we don’t have specific methods for drawing all those elements. R-Studio allows us to define the chart's size when exporting an image, but in Matplotlib, we need to determine our plot's size with a ‘Figure.’ # PYTHON # figure fig, ax = plt.subplots(1, figsize=(16,8)) # plot plt.scatter(df.Attack, df.Defense, color=df.leg_color) # create legend elements legend_elements =, , marker='o', color='w', markerfacecolor='#F85C54', markersize=10), Line2D(,, marker='o', color='w', markerfacecolor='#2ACC74', markersize=10)] # plot legend legend = plt.legend(legend_elements,, title='Legendary', ncol=2, loc='lower left', bbox_to_anchor=(0.45, -0.15), frameon=False, fontsize=12) # adjust legend title plt.setp(legend.get_title(),fontsize=14) legend.get_title().set_position((-110, -18)) plt.show() We won’t need to re-order the keys since we created them manually, and they’re already in the right order. We’ll set most of the parameters in it, like the title, number of columns, location, and frame. In Matplotlib, we are already using a method for plotting the legend.

Scatter Plot with Bottom Legend - Image by the author, made with R
