没有垂直线的直方图 [英] histogram without vertical lines

查看:115
本文介绍了没有垂直线的直方图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

创建直方图时,它看起来很像这样:

When I create a histogram, it looks a lot like this:

set.seed(1)
x <- 1:100
y <- x + rnorm(50)
y=round(y)
hist(y)

有没有一种方法可以使直方图看起来像这样?我只能得到带有垃圾箱的直方图,这对于我的情节来说是不需要的.

Is there a way to make a histogram look a bit like this? I can only get a histogram with bins, which I don't need for my plot.

我不想要黑色垃圾箱,我实际上只想要蓝色,绿色和红色线条. stackoverflow可以将我指向正确的方向吗?

I don't want the black bins, I actually only want the blue, green and red lines. Can stackoverflow point me in the right direction?

推荐答案

将直方图放入对象中,并使用type ="s"来获取逐步绘图:

Put your histogram in an object, and use type="s" to get the stepwise plot :

x <- rnorm(1000)
y <- hist(x)
plot(y$breaks,
      c(y$counts,0)
   ,type="s",col="blue")

给予:

这篇关于没有垂直线的直方图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆