I want to use mpld3's MousePosition plugin to display the pixel location of my cursor. This works great, but I can't figure out how to turn off scientific notation in the plugin. Pixels > 1000 are displayed in scientific notation.
My code:
import mpld3
from mpld3 import plugins
mpld3.enable_notebook()
fig, ax = plt.subplots()
cross = cv2.imread("cross.png", 0)
img = cv2.imread('frame_400.png', 0)
res = cv2.matchTemplate(img[2500:, :1200], cv2.resize(cross, (0,0), fx = 2, fy = 2), 3)
pylab.rcParams['figure.figsize'] = (10.0, 10.0)
imshow(res, origin='lower', cmap = cm.gray)
plugins.connect(fig, plugins.MousePosition(fontsize=14))
There is a property for display format
plugins.connect(fig, plugins.MousePosition(fmt="f"))
This will display the mouse position in integer format (a float with no decimal units of precision). fmt=".1f" will display the location with 1 decimal place of precision.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.