import numpy as np
import matplotlib.pyplot as plt x = np.linspace(-3, 3, 50)
y = 2 * x + 1 plt.figure(figsize=(8, 5)) ax = plt.gca()
ax.spines['right'].set_color('none')
ax.spines['top'].set_color('none') ax.xaxis.set_ticks_position('bottom')
ax.yaxis.set_ticks_position('left')
ax.spines['bottom'].set_position(('data', 0))
ax.spines['left'].set_position(('data', 0)) # 绘制特定散点
x0 = 1
y0 = 2 * x0 + 1 # 绘制散点图
plt.scatter(x0, y0, s=50, c='b') # 绘制散点处垂直于x轴的虚线
plt.plot([x0, x0], [0, y0], color='k', linestyle='--', linewidth=2) # 添加标注
# xycoords='data'基于数据的值选标注的位置
# xytext = (+30, -30)和 textcoords = 'offset points' 对标注位置的描述
# arrowprops 对箭头类型的一些设置
plt.annotate(r'$2x+1=%s$' % y0, xy=(x0, y0), xycoords='data', xytext=(+30, -30), textcoords='offset points',
fontsize=16, arrowprops=dict(arrowstyle='->', connectionstyle='arc3,rad=.2')) plt.plot(x, y)
plt.show()

matplotlib---Annotation标注的更多相关文章

  1. spring4笔记----“零配置”:spring提供的几个Annotation标注

    @Component  :标注一个普通的Spring Bean类 @Controller    :标注一个控制器组件器 @Service        :标注一个业务逻辑组件器 @Repository ...

  2. Annotation 标注

    1.画出基本图 当图线中某些特殊地方需要标注时,我们可以使用 annotation. matplotlib 中的 annotation 有两种方法, 一种是用 plt 里面的 annotate,一种是 ...

  3. 【Matplotlib】 标注细节注意

    相关文档: Artists BBox 由于蓝线和红线的存在,现在刻度标注很难看清楚.我们可以使他们更大,也可以使它们的属性以便使得线呈现半透明的白色背景.这样做我们既可以看到数据也可以看到刻度标注了. ...

  4. Annotation标注

    # View more python tutorials on my Youtube and Youku channel!!! # Youtube video tutorial: https://ww ...

  5. 【Matplotlib】 标注摄氏度符号

    之前论文中作图遇到的,其实也很简单. 关键的代码如下: ax.set_xlabel('Temperature ($^\circ$C)') 完整的样例代码如下: # -*- coding: utf-8 ...

  6. 【Matplotlib】 标注一些点

    相关的文档: Annotating axis annotate() command 标注的代码如下: ... t = 2 * np.pi / 3 plt.plot([t, t], [0, np.cos ...

  7. matplotlib画直线图的基本用法

    一  figure使用 1 import numpy as np 2 import matplotlib.pyplot as plt 3 4 # 从-3到中取50个数 5 x = np.linspac ...

  8. 一种基于annotation的Spring-mvc权限控制方法

    简介 本文介绍一种采用annotation来对spring-mvc进行权限控制的方法. 通过枚举类来定义权限项. 将annotation标注到需要控制权限的spring-mvc方法上. 然后,在spr ...

  9. 1.2.4 Java Annotation 提要

    (本文是介绍依赖注入容器Spring和分析JUnit源码的准备知识) Java Annotation(标注) java.lang.annotation.Annotation是全部Java标注的父接口. ...

  10. Java Annotation入门

    Java Annotation入门作者:cleverpig 版权声明:本文可以自由转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本声明作者:cleverpig(作者的Blog:http:/ ...

随机推荐

  1. LGP2233题解

    题目大意 求环上走 \(n\) 步从指定点到达另一指定点,到达指定点后 不得继续移动. 大家都做过P1057传球游戏吧?还记得这道题的思路吗? 设 \(dp[i][j]\) 表示传 \(i\) 次求传 ...

  2. 一些JDK自带的性能分析利器

    有时候碰到服务器CPU飙升或者程序卡死之类的问题,一般都不太好定位.这类bug一般都隐藏的比较深并且还可能是偶发性的,比较棘手. 对于此类问题,一般我们都有固定的分析流程.借助于JDK自带的一些分析工 ...

  3. Java基础——方法重写

    什么是方法重写? 子类中出现和父类中完全一样的方法声明 什么时候可以进行方法重写? 在子类需要父类的功能的同时,功能主体子类有自己的特有内容时,可以重写,一面沿袭了父类的功能一面又定义了子类特有的内容 ...

  4. springcloud学习04- 断路器Spring Cloud Netflix Hystrix

    依赖上个博客:https://www.cnblogs.com/wang-liang-blogs/p/12072423.html 1.断路器存在的原因 引用博客 https://blog.csdn.ne ...

  5. IC设计基础

    一 前言 这一周连续两场线下面试,紧接着又是微信视频面试,从连续三天的面试中,收获颇丰! 存在的问题: 一是对项目细节模糊: 二是IC基础知识薄弱: 具体表现是,在面试过程中,如被问到DDR3和千兆以 ...

  6. 搭建分布式事务组件 seata 的Server 端和Client 端详解(小白都能看懂)

    一,server 端的存储模式为:Server 端 存 储 模 式 (store-mode) 支 持 三 种 : file: ( 默 认 ) 单 机 模 式 , 全 局 事 务 会 话 信 息 内 存 ...

  7. 怎么得到InnoDB主键索引B+树的高度?

    上面我们通过推断得出B+树的高度通常是1-3,下面我们从另外一个侧面证明这个结论.在InnoDB的表空间文件中,约定page number为3的代表主键索引的根页,而在根页偏移量为64的地方存放了该B ...

  8. SpringBoot项目意外出现 循环依赖和注入的对象意外是Null的问题 Requested bean is currently in creation: Is there an unresolvable circular reference? 或 nested exception is java.lang.NullPointerException

    1.Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ...

  9. Java 中如何将字符串转换为整数?

    String s="123"; int i; 第一种方法:i=Integer.parseInt(s); 第二种方法:i=Integer.valueOf(s).intValue();

  10. linux文本编辑器vim详解

    vim 1.打开文件 vim [option] - file... 打开文件 +# 打开文件后,让光标处于第#行的行首 +/字符串 打开文件后,光标处于第一个被匹配到字符串的行首 -b file 二进 ...