r语言 绘制直方图_如何在R中绘制直方图

r语言 绘制直方图

In this tutorial, we’ll go over the steps to plot a histogram in R. A histogram is a graphical representation of the values along with its range. It is similar to a bar plot and each bar present in a histogram will represent the range and height of the specified value.

在本教程中,我们将介绍在R中绘制直方图的步骤。 直方图是值及其范围的图形表示。 它类似于条形图,直方图中的每个条形都将表示指定值的范围和高度。

R offers standard function hist() to plot the histogram in Rstudio. It also offers function geom_density() to plot histogram using ggplot2.

R提供标准函数hist()来绘制Rstudio中的直方图。 它还提供了函数geom_density()来使用ggplot2绘制直方图。

直方图的优点 (Advantages of Histograms)

  • A histogram provides the distribution of the data, frequency of the data along with its range.

    直方图提供数据分布,数据的频率及其范围。
  • It is an easier way to visualize large data sets.

    这是一种可视化大型数据集的简便方法。
  • The histogram also shows the skewness of the data.

    直方图还显示了数据偏度


R中直方图的类型 (Types of Histogram plots in R)

Based on the distribution of the data, a histogram exhibits many different shapes. In this section, we will try to understand the different types of histogram shapes and their meaning.

根据数据的分布,直方图显示许多不同的形状。 在本节中,我们将尝试了解直方图形状的不同类型及其含义。

The major types of histogram distributions are,

直方图分布的主要类型是

  • Normal distribution.

    正态分布。
  • Right skewed distribution.

    右偏分布。
  • Left skewed distribution.

    左偏分布。
  • Bimodal distribution

    双峰分布


R中的基本直方图 (Basic Histogram in R)

In this section, we will plot a simple histogram using the ‘airquality’ data set.

在本节中,我们将使用“空气质量”数据集绘制一个简单的直方图。

Execute the below code to plot this simple histogram.

执行以下代码以绘制此简单直方图。

<
  • 10
    点赞
  • 82
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值