- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我制作这个例子是为了展示我正在尝试做的事情:
data = np.random.normal(loc=1000,scale=20,size=2000)
plt.hist(np.log10(data),log=True)
plt.xlabel('Log(data)')
plt.ylabel('Count')
plt.show()
执行此命令后,我得到了一个很好的直方图,其中 x 轴为 Log(data),y 轴为 Counts(y 轴为对数缩放)。出于某种原因,我希望在 y 尺度上记录(计数),我的意思不是记录轴,而是记录值本身。就像 Log(data) 与 Log(counts) 一样,轴本身不应该被记录。谢谢您的帮助。
最佳答案
我不确定您是否可以使用 hist() 函数本身来执行此操作,但您可以使用条形图轻松地重新创建它。
import numpy as np
import matplotlib.pyplot as plt
data = np.random.normal(loc=1000,scale=20,size=2000)
n, bins, patches = plt.hist(np.log10(data),log=True)
# Extract the midpoints and widths of each bin.
bin_starts = bins[0:bins.size-1]
bin_widths = bins[1:bins.size] - bins[0:bins.size-1]
# Clear the histogram plot and replace it with a bar plot.
plt.clf()
plt.bar(bin_starts,np.log10(n),bin_widths)
plt.xlabel('Log(data)')
plt.ylabel('Log(Counts)')
plt.show()
关于python - 在直方图中记录计数值,而不是轴本身,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23838544/
我正在开发一个 Java 脚本,为此我需要正则表达式来检查文本框中输入的文本是否应该是字母和数值的组合。 我尝试了 Java 脚本的 NaN 函数,但字符串的最小长度和最大长度应为 4,并以字母作为第
我给出了两个长方体,其中只有一个轴对齐(另外两个不需要对齐)和顶点坐标(在全局坐标系中),我知道它们相交。我正在寻找一种可以计算路口体积的算法。 为了检查交点,我使用了分离轴定理。 最佳答案 可以通过
我有一个类似这样的对象的 json 列表 [{ "something": "bla", "id": 2 }, { "something": "yes", "id": 1
这是一篇很长的文章,但请留在我身边... 我有一个字典,它将“PO”保存为Key,将“SO”保存为项目(在某些情况下,某个“PO”可能有多个“SO”) . 工作表中的我的 Excel 数据,字典在其中
我的问题是是否有办法使用 terms include在 numeric field在 elasticsearch aggregation . 我在 Elasticsearch 中对多个字段使用通用查询
我有一个 perl 代码片段 use JSON::XS; $a = {"john" => "123", "mary" => "456"}; print encode_json($a),"\n"; 输出
我想对 python 进行一个条件测试,以检查给定输入数字的值是否等于或小于 9,并且大于或等于 0。 number =input( "Please enter a number! :" ) Plea
我有一个这样的对象: var rock = { 5: 0.5, 0: 0.8, 10: 0.3, 2: 1.0, } 我有一个像 4.3 这样的数字,我需要前后数字的索引和值。在这个例子中我会
对于 iOS 中的 Objective-C: 如果我有一个字符串,如何读取单个字符的 unicode 数值? 例如,如果我的字符串是:“Δ”,unicode 字符是 U+0394,那么我如何读取该字符
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 要求我们推荐或查找工具、库或最喜欢的场外资源的问题对于 Stack Overflow 来说是偏离主题的,
我有这样的数组 var arrayVal_Int = ["21", "53", "92", "79"]; var arrayVal_Alpha = ["John", "Christine", "L
就像标题暗示我需要做这样的事情...... $i++;//we all know this. $value = 'a'; increment($value);// i need this functi
我有一个文件,其中包含一些不同值的概率,例如: 1 0.1 2 0.05 3 0.05 4 0.2 5 0.4 6 0.2 我想使用此分布生成随机数。是否存在处理此问题的现有模块?自己编写代码相当简单
因此,我在从使用 RCPP 创建的函数返回值时遇到了一些问题。它只返回 NumericVector 的第一个值。问题是当我在自身内部调用函数并将 NumericVector 传递回 out 变量时。任
我有下面的数字 vector 模板类(用于数值计算的 vector )。我正在尝试使编写 D=A+B+C 成为可能,其中所有变量都是 Vector 对象。 A、B 和 C 不应修改。我的想法是使用 V
本文实例讲述了mysql常用函数。分享给大家供大家参考,具体如下: 本文内容: mysql函数的介绍 聚集函数 avg count max
我正在尝试使用 python(无关)为我的公司自动化一些事情,这就是我的问题。首先,我正在从邮箱中的特定文件夹创建数据框。(到这里没问题)” RangeIndex: 36 entries, 0 to
我在让 Angular ng-if 工作时遇到了一些麻烦。我希望我的 DOM 元素之一在 $scope.week = 1 时消失。 在我的 Controller 中我设置了 $scope.week =
我正在阅读 Ingersoll、Morton 和 Farris 撰写的 Taming Text,但我不明白 solr 的数字 trie 实现如何帮助搜索文本?我对 solr.TrieField fie
这个问题已经有答案了: What is the difference between client-side and server-side programming? (3 个回答) 已关闭 9 年前
我是一名优秀的程序员,十分优秀!