Reputation: 20345
I wish to draw some pedestrian trajectories given the coordinates of every point on the trajectories. This can be easily done using matplotlib
.
But in my case, the trajectories mean nothing if they are simply drawn over a blank background. They will only make sense when I overlay them on the real floor map such as the one below.
So I am wondering whether it is possible to make my floor map as the background of the figure, and then draw the points and trajectories over it?
Upvotes: 1
Views: 110
Reputation: 284582
Sure, just plot the map with imshow
and then plot your lines on top of it.
For example:
import matplotlib.pyplot as plt
import numpy as np
x = np.arange(500) + 100
y = 50 * np.cos(x / 10.0) + 100
fig, ax = plt.subplots()
ax.imshow(plt.imread('floor_plan.gif'), origin='lower')
ax.autoscale(False)
ax.plot(x, y)
plt.show()
Upvotes: 3