python - matplotlib scatterplot: adding 4th dimension by the marker shape -
i add fourth dimension scatter plot defining ellipticity of markers depending on variable. possible somehow ?
edit:
i avoid 3d-plot. in opinion these plots not informative.
you can place ellipse
patches directly onto axes, demonstrated in this matplotlib example. adapt use eccentricity "third dimension") keeping marker area constant:
from pylab import figure, show, rand matplotlib.patches import ellipse import numpy np import matplotlib.pyplot plt n = 25 # ellipse centers xy = np.random.rand(n, 2)*10 # ellipse eccentrities eccs = np.random.rand(n) * 0.8 + 0.1 fig = plt.figure() ax = fig.add_subplot(111, aspect='equal') = 0.1 pos, e in zip(xy, eccs): # semi-minor, semi-major axes, b , a: b = np.sqrt(a/np.pi * np.sqrt(1-e**2)) = / np.pi / b ellipse = ellipse(xy=pos, width=2*a, height=2*b) ax.add_artist(ellipse) ax.set_xlim(0, 10) ax.set_ylim(0, 10) show()
of course, need scale marker area x-, y- values in case.
Comments
Post a Comment