The first method is the one I've personally used, the second I just found looking at the matplotlib documentation. A Computer Science portal for geeks. prints the text that I supply vertically (and of course it doesn't print (2). Since the legends were covering datapoints I moved them, and the locations for legends can be found here. You can find other colormaps from Matplotlib colormap catalogue. I also tried to get the method using patches to work, as on the matplotlib legend guide page, but it didn't seem to work so i gave up. The following code shows how to create a scatter plot in matplotlib with a default legend: import matplotlib.pyplot as plt #define data to plot x = [1, 2, 3, 4, 5, 6, 7] We can remove legend from figure in Matplotlib by using matplotlib.axes.Axes.get_legend ().remove () method. If we pass False as the argument to matplotlib.axes.Axes.get_legend ().set_visible () method, we can remove legend from figure in Matplotlib. This method actually sets the legend invisible but not delete the legend. Find centralized, trusted content and collaborate around the technologies you use most. x = [1, 3, Minimising the environmental effects of my dyson brain. Redoing the align environment with a specific formatting. Site design / logo 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA. You can either use this to only put some of your lines in the legend, or you can use it to put whatever you want in the legend. I want a legend box that says "