Skip to main content
Ctrl+K
Matplotlib 3.10.0.dev759+ge90952ffac 文档 - Home
  • Plot types
  • User guide
  • Tutorials
  • Examples
  • Reference
  • Contribute
  • Releases
  • Gitter
  • Discourse
  • GitHub
  • Twitter
  • Plot types
  • User guide
  • Tutorials
  • Examples
  • Reference
  • Contribute
  • Releases
  • Gitter
  • Discourse
  • GitHub
  • Twitter

Section Navigation

  • 线条、条形和标记
  • 图像、轮廓和场
  • 子图、轴和图形
  • 统计
  • 饼图和极坐标图
  • 文本、标签和注释
  • 颜色
  • 形状和集合
  • 样式表
  • 模块 - pyplot
  • 模块 - axes_grid1
  • 模块 - axisartist
  • 展示
  • 动画
  • 事件处理
  • 杂项
    • 锚定艺术家
    • 识别艺术家是否相交
    • 手动轮廓
    • 坐标报告
    • 自定义投影
    • 自定义 Rc
    • AGG 过滤器
    • Ribbon box
    • 直接向图形添加线条
    • 填充螺旋
    • Findobj 演示
    • 字体索引
    • 字体属性
    • 使用矩形和多边形集合构建直方图
    • 超链接
    • 图像缩略图
    • 使用关键词绘图
    • Matplotlib 标志
    • 多页PDF
    • 多进程
    • 打包气泡图
    • 路径效果演示
    • 将图像打印到标准输出
    • 矢量图形的栅格化
    • 设置和获取属性
    • 将 SVG 滤镜应用于一行
    • SVG 滤镜派
    • 表格演示
    • TickedStroke 路径效果
    • transforms.offset_copy
    • Zorder 演示
  • 3D 绘图
  • 比例尺
  • 专业图表
  • 书脊
  • Ticks
  • 单位
  • 在图形用户界面中嵌入 Matplotlib
  • 小部件
  • 用户演示
  • 示例
  • 杂项
  • 超链接

备注

前往结尾 下载完整示例代码。

超链接#

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

目前这仅适用于SVG后端。

import matplotlib.pyplot as plt
import numpy as np

import matplotlib.cm as cm
fig = plt.figure()
s = plt.scatter([1, 2, 3], [4, 5, 6])
s.set_urls(['https://www.bbc.com/news', 'https://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('https://www.google.com/')
fig.savefig('image.svg')

下载 Jupyter 笔记本: hyperlinks_sgskip.ipynb

下载 Python 源代码: hyperlinks_sgskip.py

下载压缩文件: hyperlinks_sgskip.zip

由 Sphinx-Gallery 生成的图库

© Copyright 2002–2012 John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the Matplotlib development team; 2012–2024 The Matplotlib development team.

由 Sphinx 8.0.2创建。

Built from v3.9.2-622-gb01462c9ac-dirty.

Built with the PyData Sphinx Theme 0.15.4.