Version 3.3.3
matplotlib
Fork me on GitHub
  • Installation
  • Documentation
  • Examples
  • Tutorials
  • Contributing

导航

  • 索引
  • 模块 |
  • home| 
  • contents »
  • 超链接

Related Topics

  • Documentation overview

注解

Click here 下载完整的示例代码

超链接¶

此示例演示如何在各种元素上设置超链接。

这目前只适用于SVG后端。

import numpy as np
import matplotlib.cm as cm
import matplotlib.pyplot as plt
fig = plt.figure()
s = plt.scatter([1, 2, 3], [4, 5, 6])
s.set_urls(['http://www.bbc.co.uk/news', 'http://www.google.com', None])
fig.savefig('scatter.svg')
fig = plt.figure()
delta = 0.025
x = y = np.arange(-3.0, 3.0, delta)
X, Y = np.meshgrid(x, y)
Z1 = np.exp(-X**2 - Y**2)
Z2 = np.exp(-(X - 1)**2 - (Y - 1)**2)
Z = (Z1 - Z2) * 2

im = plt.imshow(Z, interpolation='bilinear', cmap=cm.gray,
                origin='lower', extent=[-3, 3, -3, 3])

im.set_url('http://www.google.com')
fig.savefig('image.svg')
Download Python source code: hyperlinks_sgskip.py
Download Jupyter notebook: hyperlinks_sgskip.ipynb

关键词:matplotlib代码示例,codex,python plot,pyplot Gallery generated by Sphinx-Gallery

© Copyright 2002 - 2012 John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the Matplotlib development team; 2012 - 2021 The Matplotlib development team.
上次更新时间: 1月 02, 2021 。 创建使用 Doc version v3.3.3-11-g0c8feb04e.