python 网格_Python | 网格到情节

python 网格

Most of the time, we need good accuracy in data visualization and a normal plot can be ambiguous. So, it is better to use a grid that allows us to locate the approximate value near the points in the plot. It helps in reducing the ambiguity and therefore, there is a function plt.grid() which generates a grid through the plot and enables better visualization.

大多数时候,我们需要在数据可视化中具有良好的准确性,并且法线图可能会模棱两可。 因此,最好使用允许我们在绘图中的点附近定位近似值的网格。 它有助于减少歧义,因此有一个函数plt.grid()可以生成整个图的网格并实现更好的可视化。

The following are examples for understanding the implementation Grid.

以下是用于了解实现Grid的示例。

1)网格线图 (1) Line plot with Grid)

Python | Grid to the plot (1)

2)带网格的条形图 (2) Bar Graph with Grid)

Python | Grid to the plot (2)

3)带有网格的散点图 (3) Scatter Plot with Grid)

Python | Grid to the plot (3)

Python代码演示网格图示例 (Python code to demonstrate example of grid to the plot)

# Data Visualization using Python
# Adding Grid
import numpy as np
import matplotlib.pyplot as plt
# Line Plot
N = 40
x = np.arange(N)
y = np.random.rand(N)*10
yy = np.random.rand(N)*10
plt.figure()
plt.plot(x,y)
plt.plot(x,yy)
plt.xlabel('Numbers')
plt.ylabel('Values')
plt.title('Line Plot with Grid')
plt.grid()
plt.show()
# Bar Graph
N = 8
x = np.array([1,2,3,4,5,6,7,9])
xx = np.array(['a','b','c','d','e','f','g','u'])
y = np.random.rand(N)*10
plt.figure()
plt.bar(np.arange(26), np.random.randint(0,50,26), alpha = 0.6)
plt.xlabel('Numbers')
plt.ylabel('Values')
plt.title('Bar Graph with Grid')
plt.grid()
plt.show()
# Scatter Plot
N = 40
x = np.random.rand(N)
y = np.random.rand(N)*10
colors = np.random.rand(N)
area = (30 * np.random.rand(N))**2  # 0 to 15 point radii
plt.figure()
plt.scatter(x, y, s=area, c=colors, alpha=0.8)
plt.xlabel('Numbers')
plt.ylabel('Values')
plt.title('Scatter Plot with Grid')
plt.grid()
plt.show()

翻译自: https://www.includehelp.com/python/grid-to-the-plot.aspx

python 网格

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

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

相关文章

2016年1月计划

开始试着每月做计划和总结,有节奏的规划自己的时间,一月计划: 1、hive那本书拖了很久了,一月一定会看完。 2、因为跟着阚爷的风准备试着做一下讲师,分配给我的是推荐这块,所以网上多找找做推荐的资源&#…

slr1文法_SLR的完整形式是什么?

slr1文法单反:单镜头反光 (SLR: Single Lens Reflex) SLR is an abbreviation of Single Lens Reflex. It is used in high standard cameras. SLR makes use of an automatic moving mirror arrangement that makes it possible for photographers to perceive pre…

vim快捷键2

一、移动光标 1、左移h、右移l、下移j、上移k 2、向下翻页ctrl f,向上翻页ctrl b 3、向下翻半页ctrl d,向上翻半页ctrl u 4、移动到行尾$,移动到行首0(数字),移动到行首第一个字符处^ 5、移动光标到下一…

FYR的完整形式是什么?

财政年度:供您参考 (FYR: For Your Reference) FYR is an abbreviation of "For Your Reference". FYR是“供您参考”的缩写。 It is an expression, which is commonly used in the Gmail platform. It is written as a follow-up message for the info…

UIScrollView的简单使用

- UIScrollView 介绍 问&1.UIScrollView 是干什么的? • UIScrollView 也是一种控件,继承自UIView。• 用来实现”滚动”和”缩放”的控件 什么是UIScrollView? UIScrollView是一个能够滚动的视图控件,可以用来展示大量的内容&#xf…

什么是苹果耳塞?

苹果耳塞 (Apple Earbuds) Apple Earbuds are another sound device made by Apple on 23rd October 2001. It is an in-ear sound device and it has been included in all the mobile and music devices of Apple. Apple Earbuds are quite comfortable and easy to handle w…

趣说游戏AI开发:对状态机的褒扬和批判

0x00 前言 因为临近年关工作繁忙,已经有一段时间没有更新博客了。到了元旦终于有时间来写点东西,既是积累也是分享。如题目所示,本文要来聊一聊在游戏开发中经常会涉及到的话题——游戏AI。设计游戏AI的目标之一是要找到一种便于使用并容易拓…

类中函数模板 typeof_Julia中的typeof()函数

类中函数模板 typeofJulia| typeof()函数 (Julia | typeof() function) typeof() function is a library function in Julia programming language, it is used to get the concrete type of the given value or variable. typeof()函数是Julia编程语言中的库函数,…

sencha touch调试时Please close other application using ADB: Monitor, DDMS, Eclipse

1、运行——cmd—— netstat -aon|findstr "5037" 2、打开任务管理器,查看所有进程 显示进程pid(文件-查看)--查找pid7740的结束。转载于:https://www.cnblogs.com/taoshengyujiu/p/5099588.html

定时器mia是什么意思_MIA的完整形式是什么?

定时器mia是什么意思MIA:行动失踪 (MIA: Missing In Action) MIA is an abbreviation of "Missing In Action". MIA是“缺少行动”的缩写。 It is an expression, which is commonly used in the Gmail platform. It is written to show that the origin…

window下自己主动备份数据库成dmp格式的bat写法

复制以下的命令到一个txt文本文档&#xff0c;然后改动相应的參数为自己须要的參数&#xff0c;一切完毕之后&#xff0c;将文件保存为bat格式。这样每次须要备份的时候仅仅须要双击一下这个bat文件。其它的都不用你了&#xff0c;你仅仅须要静静的等待……</pre><pre…

l和l_L&T的完整形式是什么?

l和&lL&#xff06;T&#xff1a;Larsen和Toubro (L&T: Larsen and Toubro) L&T is an abbreviation of Larsen and Toubro. It is an Indian multinational conglomerate corporation with international networks and operations. It is dynamically engaged in …

例题 3-5 生成元 digit generator

1 #include<stdio.h>2 #include<string.h>3 #define maxn 1000054 int ans[maxn]; //类似于 比较大的数组还是开导外面比较好一点,防止报错.5 int main()6 {7 int x,y,m,T,n;8 memset(ans,0,sizeof(ans)); //数组归零.9 for(m1;m<maxn;m…

CRT的完整形式是什么?

CRT&#xff1a;阴极射线管 (CRT: Cathode Ray Tube) CRT is an abbreviation of Cathode Ray Tube. Cathode Ray Tube is a vacuum tube that accommodates one or more than one electron filled guns and a phosphorescent screen, which is used in television and convent…

Python打包程序

到py2exe的官网下载程序&#xff0c;注意对应的python版本&#xff0c;比如所用的python版本为2.7&#xff0c;那么就下载适配2.7版本的py2exe软件下载完成后安装&#xff08;与普通软件安装方式相同&#xff09; 2将要转换的python脚本放到Python文件夹内 在python的目录下面&…

ruby中!!_Ruby反向! 功能

ruby中!!逆转&#xff01; Ruby中的功能 (reverse! function in Ruby) As the name suggests, reverse! function is used to reverse the elements of an array. Most of the times, we need to reverse an array but if we do it with the help of loops, the program will b…

mcal rtm_RTM的完整形式是什么?

mcal rtmRTM&#xff1a;阅读手册 (RTM: Read The Manual) RTM is an abbreviation of "Read The Manual". RTM是“阅读本手册”的缩写 。 It is an expression, which is commonly used in messaging or chatting on social media networking sites like Facebook,…

mysql悲观锁总结和实践

使用场景举例&#xff1a;以MySQL InnoDB为例商品t_goods表中有一个字段status&#xff0c;status为1代表商品未被下单&#xff0c;status为2代表商品已经被下单&#xff0c;那么我们对某个商品下单时必须确保该商品status为1。假设商品的id为1。 一、如果不采用锁&#xff0c;…

2G的完整形式是什么?

2G&#xff1a;第二代 (2G: Second Generation) 2G is an abbreviation of the "Second-Generation Cellular Network". 2G是“第二代蜂窝网络”的缩写 。 In 1991, 2G cellular networks were commercially introduced on the GSM standard in Finland by Radiolin…

推送证书

2019独角兽企业重金招聘Python工程师标准>>> 推送证书 1 openssl pkcs12 -in CertificateName.p12 -out CertificateName.pem -nodes 转换文件上传 2证书有效期 openssl x509 -in xxx.pem -noout -dates —反馈 notBeforeDec 12 07:42:27 2015 GMT notAfterDec 11…