Python | Pyplot标签

There are the following types of labels,

标签有以下几种,

1)X轴贴标 (1) X-axis labelling)

plt.xlabel('Number Line')
# Default labelling

Python | Pyplot Labelling (1)
plt.xlabel('Number Line', color='green')
#Font colour Changed

Python | Pyplot Labelling (2)
plt.xlabel('Number Line', color='Green', fontsize=15)
#Font size Change

Python | Pyplot Labelling (3)
plt.xlabel('Number Line', color='Green', fontsize=15, bbox=dict(facecolor='yellow', alpha=0.5))
#Background Box Addition with opaque ratio

Python | Pyplot Labelling (4)

2)Y轴贴标 (2) Y-axis labelling)

plt.ylabel('Function')
#Default Labelling

Python | Pyplot Labelling (5)
plt.xlabel('Function', color='green')
#Colour Change

Python | Pyplot Labelling (6)
plt.xlabel('Function', color='Green', fontsize=15)
#Font Size Modification

Python | Pyplot Labelling (7)
plt.xlabel('Function', color='Green', fontsize=15, bbox=dict(facecolor='yellow', alpha=0.5))
#Background Box Addition with opaque ratio

Python | Pyplot Labelling (8)

pythion代码演示pyplot标签示例 (Pythion code to demonstrate example of pyplot labelling)

import numpy as np
import matplotlib.pyplot as plt
x = np.arange(500)
y1 = np.arange(500)
for i in range(500):
y1[i] = 2*x[i] + np.random.randint(0,56)
#x-axis labelling
#default 
plt.figure()
plt.plot(x,y1)
plt.xlabel('Number Line')
#Colour
plt.figure()
plt.plot(x,y1)
plt.xlabel('Number Line', color='green')
#size 
plt.figure()
plt.plot(x,y1)
plt.xlabel('Number Line', color='Green', fontsize=15)
#Background Box
plt.figure()
plt.plot(x,y1)
plt.xlabel('Number Line', color='Green', fontsize=15, bbox=dict(facecolor='yellow', alpha=0.5))
#y-axis labelling
#default 
plt.figure()
plt.plot(x,y1)
plt.ylabel('Function')
#Colour
plt.figure()
plt.plot(x,y1)
plt.ylabel('Function', color='g')
#size 
plt.figure()
plt.plot(x,y1)
plt.ylabel('Function', color='Green', fontsize=15)
#Background Box
plt.figure()
plt.plot(x,y1)
plt.ylabel('Function', color='Green', fontsize=15, bbox=dict(facecolor='yellow', alpha=0.5))

Output:

输出:

Output is as figure

翻译自: https://www.includehelp.com/python/pyplot-labelling.aspx

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/540639.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

LTNS的完整形式是什么?

LTNS:很久没看到 (LTNS: Long Time No See) LTNS is an abbreviation of "Long time, no see". LTNS是“长时间,看不见”的缩写 。 It is an English phrase used when people meet and greet each other after a while when in between they…

MySQL Index Condition Pushdown

2019独角兽企业重金招聘Python工程师标准>>> 一、Index Condition Pushdown简介 ICP(index condition pushdown)是mysql利用索引(二级索引)元组和筛字段在索引中的where条件从表中提取数据记录的一种优化操作。ICP的思…

ADBB的完整形式是什么?

ADBB:所有完成的再见 (ADBB: All Done Bye Bye) ADBB is an abbreviation to All Done Bye Bye. ADBB是All Done Bye Bye的缩写。 Whenever a person wants to convey his message to another person, they use some sort of short-form in the text messages. ADB…

c 环境

系统ubuntu sudo apt-get install vim g openssh-server libgl1-mesa-dev检查下安装的版本gcc -v g -v make -v gdb -v 转载于:https://blog.51cto.com/skinglzw/1964449

java.util (Collection接口和Map接口)

1:Collection和Map接口的几个主要继承和实现类 1.1 Collection接口 Collection是最基本的集合接口,一个Collection代表一组Object,即Collection的元素(Elements)。一些Collection允许相同的元素而另一些不行。一些能排…

scala 拆分字符串翻转_Scala程序分割字符串

scala 拆分字符串翻转A string is a collection that stores multiple characters, it is an immutable sequence which cannot be changed. 字符串是存储多个字符的集合,它是不可更改的不可更改的序列。 分割字符串 (Splitting a string) In Scala, using the spl…

[转载] python 简单示例说明os.walk和os.path.walk的不同

参考链接: 示例说明Python2.x和Python3.x之间的重要区别 import os,os.path def func(arg,dirname,names): for filespath in names: print os.path.join(dirname,filespath) if __name__"__main__": print "os.walk" index 1 for root,subd…

c#中索引器是什么_C#中的索引器

c#中索引器是什么An Indexer is a special feature of C# to use an object as an array. If you define an indexer in a class then it will behave like a virtual array. Indexer is also known as smart array in C#. It is not a compulsory or essential part of OOPS. …

asp.net MVC5为WebAPI添加命名空间的支持

前言 默认情况下,微软提供的MVC框架模板中,WebAPI路由是不支持Namespace参数的。这导致一些比较大型的项目,无法把WebApi分离到单独的类库中。 本文将提供解决该问题的方案。 微软官方曾经给出过一个关于WebAPI支持Namespace的扩展&#xff0…

[转载] Python3.X 线程中信号量的使用方法示例

参考链接: 示例说明Python2.x和Python3.x之间的重要区别 信号量semaphore 是一个变量,控制着对公共资源或者临界区的访问。信号量维护着一个计数器,指定可同时访问资源或者进入临界区的线程数。下面这篇文章主要给大家介绍了关于Python3.X 线…

从流程的自动化中获得最大价值的10种方式

流程自动化很好,如果它可以节省时间并减少错误。但是如果它不能在业务流程中“很好地契合”,那么会难以得到普及。问问有谁没有对语音助手感到伤脑筋。 所幸的是,某些最佳实践让你可以从流程自动化中获得最大价值,以下就是其中的1…

java中null是常量吗_C_NULL Julia中的常量

java中null是常量吗Julia| C_NULL常数 (Julia | C_NULL Constant) C_NULL is a constant of Ptr{Nothing} type in Julia programming language, it represents the null pointer value, which is used for C Null Pointer while calling external code. C_NULL是Julia编程语言…

[转载] Python京东抢购

参考链接: 从Python获取输入 Python京东抢购 分析其中提交信息接口的参数,可以成功抢购商品,并且可以提交订单。。。。2018年7月17日 提交信息的获取 直接提交信息对post提交分析其中的参数。 经过分析参数大多数在:https…

6.04 从字符串中删除不需要的字符

需求:删除所有的0和元音字母。 select ename,replace(replace(replace(replace(replace(ename,A,),E,),I,),O,),U,) as stripped1,sal,replace(sal,0,) stripped2from emp;转载于:https://www.cnblogs.com/liang545621/p/7518766.html

Scala分号

Scala分号 (Scala semicolons) A semicolon or semi-colon (;) is a punctuation mark in programming, it is used to separate multiple lines of code. It is common in major programming languages like C, C, Java, Pascal. In modern programming languages like Python…

[转载] python通过adb获取android手机耗电量

参考链接: 从Python中控制台获取输入 把开发者模式打开,激活 adb 调试,然后可以使用以下python代码获取安卓手机的耗电量 # -*- coding: utf-8 -*- import re import os def getSelectDevice(): pip os.popen(adb devices) result pip.…

ES6之主要知识点(二) 变量的解构赋值。默认值

引自http://es6.ruanyifeng.com/#docs/destructuring 数组解构赋值默认值对象解构赋值用途1.数组的解构赋值 let [a, b, c] [1, 2, 3]; let [foo, [[bar], baz]] [1, [[2], 3]]; foo // 1 bar // 2 baz // 3let [ , , third] ["foo", "bar", "baz&…

python无符号转有符号_Python | 散布符号

python无符号转有符号There are multiple types of Scatter Symbols available in the matplotlib package and can be accessed through the command marker. In this article, we will show some examples of different marker types and also present a list containing all…

[转载] 基于LSTM的股票预测模型_python实现_超详细

参考链接: 从Python获取输入 文章目录 一、背景二、主要技术介绍1、RNN模型2、LSTM模型3、控制门工作原理四、代码实现五、案例分析六、参数设置七、结论完整程序下载 一、背景 近年来,股票预测还处于一个很热门的阶段,因为股票市场的波动…

shell -eom_EOM的完整形式是什么?

shell -eomEOM:消息结尾 (EOM: End Of Message) EOM is an abbreviation of "End Of Message". EOM是“消息结尾”的缩写 。 It is an expression, which is commonly used in the Gmail platform. It is also written as Eom or eom. It is written at …