sas - 限制 SAS 生成的直方图中的条形数量
问题描述
我在 SAS 中运行 proc sgplot 来创建直方图。Y 轴:人数,X 轴:英里数。问题是直方图使用 30+ 条非常小的 x 轴间隔来显示数据。我只想在直方图中显示 10 个条形图。我可以在代码中添加一个简单的功能来限制直方图只显示 10 条吗?下面的代码:
proc sgplot data= miles;
title "Cumulative Miles Driven by Number of Individuals"
histogram CumulativeMiles/scale= count
fillattrs=(color=blue);
xaxis values= (0 to 1000 by 100)
label= "Cumulatve Miles Driven"
yaxis values= (0 to 50000 by 10000)
label= "Number of Individuals";
run;
解决方案
NBINS=10
声明上的选项HISTOGRAM
。
NBINS=numeric-value 指定 bin 的数量。系统确定 BINWIDTH= 值。箱总是跨越数据的范围。
该过程尝试生成易于解释的刻度值(例如,5、10、15、20)。该过程有时会相应地调整第一个 bin 的位置和 bin 宽度。因此,图中显示的 bin 数量可能与 NBINS= 指定的数量不完全匹配。
或指定 BINWIDTH 和/或 BINSTART 选项。请参阅此处的绘图选项。
推荐阅读
- postgresql - 如何在给定的日期按分钟分组,在postgresql中的时间范围内生成最大最小值和平均值?
- java - 将 JSONArray 写入文件,仅写入第一个值集合
- c# - 在 C# Xamarin.iOS 中将 AVAudioPcmBuffer 音频数据作为 float[] 读取
- c++ - C ++如何管理动态分配对象的清理,该对象也动态分配内存
- chilkat - SetSslClientCertPfx 不允许更改文件位置
- laravel-5.6 - 我想在插入时检查重复值而不使用唯一关键字
- python-3.x - 如何使用 for 循环从嵌套列表中选择元素
- python - “from __builtin__ import True”的目的是什么?
- c# - 如何使用 iTextsharp 和 C# 在不破坏文件的情况下删除/替换 PDF 文件中的图像
- node.js - 使用ajax从mongoose获取数据到前端