Python How to get pixel value from a color map?

AI Thread Summary
To extract individual mass values at specific pixel points from a scatter plot generated using two 1D arrays in Python, the discussion centers on the need to correlate the plotted data with corresponding mass values. The user has provided code that utilizes hexbin for plotting and a colorbar for normalization, but seeks clarity on how to retrieve mass values at the plotted locations. The focus is on determining whether the goal is to display mass values directly on the plot or to obtain the color assignments based on mass values. The conversation emphasizes the importance of linking the plotted data points to their respective mass values for accurate representation and analysis.
Atr cheema
Messages
67
Reaction score
0
I have a python code where it generates two 1D arrays, plots them using scatter plot and then draws colorbar using normalization range. How can I find individual values at those individual pixel points?

Python:
HC = data["HC"]
OC  = data["OC"]
sample = y
widthmm, heightmm = 171, 233
ratio = (widthmm/2.0)/(heightmm/4.0)
widthinch = widthmm/25.40
fig = plt.figure(figsize=(widthinch,widthinch/ratio))
ax1 = fig.add_subplot(111)
ax1 = plt.hexbin(OC,HC,cmap=glocmap,bins=None,gridsize=(20,15),alpha=0.75,mincnt=1,vmax=50,linewidth=0,vmin=7)

CvarLab = 0
cb = plt.colorbar(ax1)
cb.set_label(CvarLab,size=20)
cb.ax.tick_params(labelsize=20)
cb.set_alpha(1)
cb.draw_all()

and it generates a plot like this .My question is how can I find values of 'Mass' on those individual points shown in image given than we have only two 1 dimensional arrays?
 
Technology news on Phys.org
What is it you're wanting to do? is it to show the mass values on the plot? or to get the colors the mass values were assigned?
 
jedishrfu said:
What is it you're wanting to do? is it to show the mass values on the plot? or to get the colors the mass values were assigned?
I want to get mass values at those individual points on the plot.
 
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...
Back
Top