R中使用晶格的条形图 [英] barchart in R using lattice

查看:71
本文介绍了R中使用晶格的条形图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的代码:

d<-data.frame(column1=rep(Names, each=1),column2=rep(c("one"),1),column3=values)
barchart(column3 ~ column1, groups=column2, d, auto.key = list(columns = 1))

我的价值观之一是负面的.在我的图片上,我看到所有的条形都从负值开始,一直增长到它们的值,但是我想看到所有的条形都从0开始(一个条形具有反转方向).

One of my values is negative. On my picture I see all the bars starting from negative values and growing up to their values, but I want to see all the bars starting at 0 (one bar has revers direction).

我该怎么做?

我不确定晶格,其他任何方法都可以.我尝试使用barplot,它以正确的方式绘制,但是我的标签太长,因此当我缩小字体时-由于其样式,我无法阅读anithyng.

I'm not sure about lattice, any other way is ok. I tried barplot, it plots in the right way, but my lables are too long, so when I make the font smaller - I can't read anithyng because of its style.

推荐答案

使用origin自变量:

barchart(column3 ~ column1, groups=column2, d, auto.key = list(columns = 1), origin=0)

这篇关于R中使用晶格的条形图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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