Python dot color Matplotlib

I was looking for a temperature graph with sensors and wanted to find how can I either build a contour / heat map or change the colors of my points based on cmap?

I have the following very simple plot:

import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
from pylab import *

figure(figsize=(15, 8))
# use ginput to select markers for the sensors
matplotlib.pyplot.hot()

markers = [(269, 792, 0.65), (1661, 800, 0.5), (1017, 457, 0.8)]
x,y,t = zip(*markers)

img = mpimg.imread('floor.png')
imgplot = plt.imshow(img, cmap=cm.hot)
plot(x, y, 'h', c=t, ms=15)

colorbar()
show()

The third value in the markers should, we hope, be point. However, when I make a graph, it colors each point in the same way, using the first value in the markers. Is it possible to set cmap points so that I can use hot and relate it to the actual temperature? Current points are plotted in light purple / purple, which I assume is the default CMAP. I see that cmap is not a valid value for the graph, so I'm not sure where I would indicate this.

, , histogram2d, . ? , , , , . - / , , , ? , .

!

+5
1

scatter plot :

import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
from pylab import *

figure(figsize=(15, 8))
# use ginput to select markers for the sensors
matplotlib.pyplot.hot()

markers = [(269, 792, 0.65), (1661, 800, 0.5), (1017, 457, 0.8)]
x,y,t = zip(*markers)

img = mpimg.imread('floor.png')
imgplot = plt.imshow(img, cmap=cm.hot)
scatter(x, y, marker='h', c=t, s=150)

colorbar()
show()

, plot - . , cmap scatter

+2

All Articles