I want to create a scatter plot with matplotlib where the data points have scalar data attached to them and are assigned a color depending on how large their attached value is relative to the other points in the set. I.e., I want something akin to a heatmap. However, I'm looking for a "discrete" heatmap, i.e. nothing should be ploted where there were no points in the original data set and, in particular, no interpolation (in space) should be performed.
Can this be done?
In order to graph a TI 83 scatter plot, you'll need a set of bivariate data. Bivariate data is data that you can plot on an XY axis: you'll need a list of “x” values (for example, weight) and a list of “y” values (for example, height).
If the points on the scatter plot seem to form a line that slants down from left to right, there is a negative relationship or negative correlation between the variables. If the points on the scatter plot seem to be scattered randomly, there is no relationship or no correlation between the variables.
you can use scatter, and set the attached value to c parameter:
import numpy as np
import pylab as pl
x = np.random.uniform(-1, 1, 1000)
y = np.random.uniform(-1, 1, 1000)
z = np.sqrt(x*x+y*y)
pl.scatter(x, y, c=z)
pl.colorbar()
pl.show()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With