Matplotlib the UI using the Cursor positioning

Matplotlib programming

import matplotlib.pyplot as plt
import numpy as np
from matplotlib.widgets import Cursor

lineprops = dict(color="red", lw=2)

fig, ax = plt.subplots(1, 1, subplot_kw=dict(facecolor="lemonchiffon"))

x = np.random.random(100)
y = np.random.random(100)
ax.scatter(x, y, marker="o", color="red")
ax.set_xlim(-0.02, 1.02)
ax.set_ylim(-0.02, 1.02)

cursor = Cursor(ax, useblit=True, **lineprops)

plt.show()

Finished Screenshot

Here Insert Picture Description

Explanation

This is a dynamic UI renderings, so their experience will know the experience, very good play of.

If you use PyCharm generate a static map, not dynamic, see this blog → Here

Published 515 original articles · won praise 1014 · Views 210,000 +

Guess you like

Origin blog.csdn.net/weixin_43896318/article/details/104332585