
title ( 'Overplotting? Show putative structure', loc = 'left' ) plt. legend ( loc = 'lower right', markerscale = 2 ) # titles plt. The key is to map the scatter PathCollection to a HandlerPathCollection with an updating function being set to it. The marker size is specified by the s parameter in the plt.scatter() function. Markers are used in Matplotlib to identify particular plot points.
Matplotlib scatter smaller dots code#
This has the advantage that it would not use any "private" methods and works even with other objects than scatters present in the legend. For instance, we may use the code plt.scatter(x, y, c'b', smarker size) to set the marker's color to blue, where 'b' stands for the color blue. Plt.legend(,, loc="lower left", markerscale=2, H2 = Line2D(,, marker='o', markersize=np.sqrt(20), color='r', linestyle='None') Extending the solutions by Kyrubas and hwang you can also once define a function scatteredboxplot (and add it as a method to plt.Axes ), such that you can always use scatteredboxplot instead of boxplot: fig, ax plt.subplots (figsize (5, 6)) ax.scatteredboxplot (x np.array ( 1,2,350),np.array ( 1.1,2.2,3.3)) The function. I used python errorbar to make a plot, however the arguments markersize can only be a scalar not an array, which means all the data points have the same marker size. markersize-Represents size of markerExample 1: Plot a graph using the plot method with standard marker size. The only real downside is that you have to construct the legend explicitly from lists of objects and labels, but this is a well-documented matplotlib feature so it feels pretty safe to use. Parameters: data1,data2-Variables that hold data.marker’.’ Indicates dot symbol to mark the datapoints. This is nice because it doesn't require placing an object in your axes (potentially triggering a resize event), and it doesn't require use of any hidden attributes. You can make a Line2D object that resembles your chosen markers, except with a different marker size of your choosing, and use that to construct the legend. This way they wont overlap and the patterns will be clearer. But now you can use everything scatter offers. You can try to decrease marker size in your plot. No need to touch the source, even though this is quite a hack. Now the _sizes (another underscore property) does the trick. Lgnd = plt.legend(loc="lower left", scatterpoints=1, fontsize=10)

A better hack: import matplotlib.pyplot as plt
Matplotlib scatter smaller dots update#
It may break down at any update in matplotlib.

Neither of these is very much fun, though #1 seems to be easier. The transform (scaling) has to take the original size into account.
