强制/编辑gridExtra中的轴值 [英] Force / edit axis values in latticeExtra

查看:35
本文介绍了强制/编辑gridExtra中的轴值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是一个数据集,其中X中存在的变量只有两个可能的值-2009或2010.

  2009,01,52.42009,01,49.52009,01,53.22009,01,48.22009,01,53.92009,01,42.82009,01,56.42009,01,572009,01,50.32009,01,57.42009,01,45.22009,01,552009,01,47.12009,01,42.22009,01,57.12009,01,51.72009,01,56.82009,01,56.92009,01,552009,01,52.92009,01,52.92009,01,572009,01,452009,01,52.82009,01,522009,01,55.12009,01,53.32009,01,55.22009,01,53.22009,01,56.92009,01,55.92009,02,54.72009,02,53.12009,02,54.22009,02,56.22009,02,58.52009,02,50.92009,02,57.72009,02,54.12009,02,54.52009,02,55.32009,02,53.42009,02,53.82009,02,51.32009,02,52.32009,02,532009,02,53.62009,02,552009,02,532009,02,53.62009,02,52.52009,02,54.12009,02,50.12009,02,52.22009,02,54.32009,02,52.42009,02,53.22009,02,52.52009,02,52.72009,03,56.22009,03,58.72009,03,58.22009,03,632009,03,552009,03,55.42009,03,55.82009,03,63.82009,03,562009,03,52.32009,03,55.62009,03,56.82009,03,57.42009,03,58.72009,03,59.92009,03,57.72009,03,55.32009,03,54.92009,03,61.82009,03,54.12009,03,52.92009,03,55.52009,03,55.32009,03,66.42009,03,55.72009,03,53.22009,04,55.42009,04,602009,04,54.92009,04,55.32009,04,57.52009,04,55.82009,04,57.62009,04,55.72009,04,56.42009,04,542009,04,55.82009,04,56.82009,04,54.82009,04,55.82009,04,55.82009,04,53.52009,04,56.82009,04,542009,04,56.72009,04,57.22009,04,57.82009,04,57.32009,04,57.22009,04,57.22009,04,56.22009,04,55.22009,04,54.72009,04,572009,04,55.92009,05,59.82009,05,58.92009,05,59.32009,05,58.92009,05,60.42009,05,59.12009,05,58.52009,05,73.42009,05,62.52009,05,61.42009,05,61.12009,05,61.62009,05,67.62009,05,66.52009,05,58.62009,05,61.12009,05,622009,05,72.12009,05,59.32009,05,59.62009,05,612009,05,57.12009,05,59.22009,05,60.42009,05,60.12009,05,58.52009,05,58.92009,05,59.82009,05,62.62009,05,60.92009,05,59.52009,06,63.82009,06,65.42009,06,64.72009,06,642009,06,65.82009,06,68.32009,06,63.92009,06,64.22009,06,61.92009,06,62.92009,06,63.92009,06,69.72009,06,63.72009,06,63.42009,06,63.82009,06,64.52009,06,64.42009,06,63.92009,06,66.62009,06,70.32009,06,67.12009,06,65.82009,06,65.52009,06,62.92009,06,64.42009,06,65.42009,06,64.42009,06,63.32009,06,66.32009,06,66.72009,07,64.82009,07,662009,07,66.82009,07,69.92009,07,65.92009,07,68.62009,07,67.62009,07,66.72009,07,65.52009,07,652009,07,66.52009,07,66.72009,07,67.12009,07,67.42009,07,64.82009,07,65.82009,07,64.72009,07,662009,07,682009,07,662009,07,64.12009,07,65.82009,07,652009,07,63.32009,08,65.92009,08,652009,08,65.92009,08,642009,08,66.12009,08,64.52009,08,642009,08,66.82009,08,652009,08,64.72009,08,64.82009,08,65.82009,08,64.92009,08,64.92009,08,65.12009,08,65.22009,08,672009,08,64.82009,08,65.62009,08,66.12009,08,64.92009,08,67.12009,08,64.72009,08,64.92009,08,65.12009,08,64.12009,08,64.62009,08,66.52009,08,65.42009,08,652009,09,64.22009,09,63.12009,09,65.32009,09,64.22009,09,64.72009,09,63.92009,09,70.92009,09,70.12009,09,652009,09,65.52009,09,65.42009,09,68.12009,09,64.42009,09,65.12009,09,65.72009,09,63.22009,09,64.52009,09,64.82009,09,66.42009,09,64.92009,09,67.52009,09,66.42009,09,65.72009,09,652009,09,64.42009,09,62.52009,09,62.92009,09,63.72009,09,63.32009,10,66.62009,10,62.92009,10,63.12009,10,65.42009,10,69.42009,10,71.12009,10,64.12009,10,66.92009,10,69.42009,10,66.62009,10,632009,10,67.22009,10,68.62009,10,65.22009,10,642009,10,62.42009,10,652009,10,64.32009,10,68.62009,10,682009,10,632009,10,61.22009,10,65.32009,10,64.72009,10,67.12009,10,67.22009,10,68.52009,10,65.42009,10,642009,11,58.42009,11,66.42009,11,58.22009,11,55.72009,11,59.42009,11,62.72009,11,61.52009,11,62.22009,11,63.82009,11,62.22009,11,59.92009,11,62.52009,11,61.82009,11,63.32009,11,60.52009,11,602009,11,622009,11,60.52009,11,59.42009,11,632009,11,61.82009,11,60.62009,11,62.22009,11,62.92009,11,59.32009,11,55.62009,11,61.22009,11,57.62009,11,63.32009,11,58.12009,12,45.62009,12,59.72009,12,59.42009,12,59.52009,12,582009,12,56.52009,12,60.32009,12,55.92009,12,50.62009,12,51.32009,12,62.32009,12,58.22009,12,40.62009,12,59.42009,12,55.62009,12,61.62009,12,48.12009,12,52.32009,12,57.72009,12,60.12009,12,61.32009,12,59.72009,12,52.62009,12,51.92009,12,53.22009,12,58.72009,12,55.92010,01,57.82010,01,45.42010,01,50.52010,01,56.32010,01,58.12010,01,41.82010,01,532010,01,58.92010,01,52.52010,01,50.52010,01,56.42010,01,55.92010,01,55.42010,01,392010,01,56.42010,01,57.72010,01,59.82010,01,54.92010,01,56.12010,01,55.62010,01,57.52010,01,47.42010,01,59.52010,01,48.72010,01,59.42010,01,55.52010,01,56.32010,01,45.12010,01,492010,02,43.12010,02,53.92010,02,44.22010,02,53.22010,02,48.82010,02,44.32010,02,57.32010,02,50.42010,02,59.82010,02,58.52010,02,56.32010,02,56.72010,02,58.92010,02,51.32010,02,432010,02,58.42010,02,56.92010,02,57.22010,02,51.22010,02,50.92010,02,48.72010,02,54.42010,02,55.92010,02,53.92010,02,59.32010,03,562010,03,54.92010,03,55.92010,03,58.22010,03,60.92010,03,562010,03,57.52010,03,59.12010,03,57.42010,03,51.92010,03,582010,03,55.92010,03,57.12010,03,552010,03,60.72010,03,55.72010,03,50.32010,03,57.62010,03,60.52010,03,53.72010,03,56.52010,03,57.32010,03,52.82010,03,46.72010,03,52.32010,03,55.62010,03,52.72010,03,56.12010,03,57.12010,03,55.22010,03,57.62010,04,62.42010,04,62.62010,04,55.72010,04,62.52010,04,57.52010,04,69.52010,04,63.52010,04,62.22010,04,60.72010,04,62.52010,04,622010,04,57.62010,04,61.32010,04,54.82010,04,64.32010,04,61.42010,04,67.22010,04,632010,04,64.52010,04,57.32010,04,57.42010,04,55.82010,04,58.62010,04,60.62010,04,612010,04,56.92010,04,60.22010,04,65.32010,04,60.22010,04,59.62010,05,73.92010,05,63.32010,05,56.52010,05,63.72010,05,63.22010,05,58.92010,05,58.12010,05,71.32010,05,632010,05,64.82010,05,64.12010,05,58.62010,05,55.92010,05,57.72010,05,69.12010,05,61.42010,05,59.22010,05,58.52010,05,57.32010,05,60.22010,05,59.12010,05,67.82010,05,67.12010,05,64.72010,05,61.32010,05,58.52010,05,58.72010,05,61.72010,05,59.92010,05,65.22010,06,64.42010,06,622010,06,62.22010,06,62.72010,06,65.82010,06,65.12010,06,63.42010,06,63.32010,06,62.22010,06,61.82010,06,61.52010,06,61.72010,06,64.72010,06,62.82010,06,64.22010,06,61.42010,06,63.32010,06,62.82010,06,64.12010,06,60.52010,06,62.62010,06,62.22010,06,63.12010,06,62.92010,06,632010,06,62.52010,06,62.22010,06,63.92010,06,61.92010,06,64.32010,07,652010,07,65.32010,07,65.12010,07,65.62010,07,65.62010,07,69.82010,07,74.52010,07,64.72010,07,65.62010,07,64.62010,07,72.12010,07,66.42010,07,66.82010,07,63.72010,07,65.22010,07,63.82010,07,652010,07,66.52010,07,65.42010,07,67.12010,07,65.52010,07,66.32010,07,65.92010,07,65.52010,07,64.52010,07,652010,07,65.92010,07,64.82010,07,65.32010,07,64.82010,07,65.32010,08,65.62010,08,65.52010,08,672010,08,69.42010,08,652010,08,64.32010,08,66.92010,08,65.42010,08,64.42010,08,65.12010,08,66.42010,08,63.62010,08,65.22010,08,63.32010,08,70.12010,08,65.92010,08,68.32010,08,67.82010,08,64.42010,08,65.12010,08,64.72010,08,63.72010,08,63.52010,08,67.92010,08,70.32010,08,65.82010,08,63.92010,08,66.62010,08,67.42010,08,65.42010,08,64.12010,09,66.62010,09,70.72010,09,66.32010,09,64.52010,09,66.72010,09,68.12010,09,71.22010,09,64.42010,09,652010,09,67.82010,09,64.52010,09,66.72010,09,67.82010,09,67.62010,09,68.32010,09,67.82010,09,67.62010,09,66.42010,09,68.42010,09,67.62010,09,63.72010,09,72.22010,09,67.32010,09,67.62010,09,67.62010,09,68.42010,09,64.72010,09,68.62010,09,66.42010,10,622010,10,63.32010,10,63.62010,10,63.72010,10,61.82010,10,64.22010,10,62.92010,10,65.62010,10,64.12010,10,65.22010,10,64.82010,10,61.62010,10,64.72010,10,65.72010,10,60.92010,10,61.72010,10,65.12010,10,65.52010,10,612010,10,62.12010,10,632010,10,65.82010,10,64.32010,10,65.32010,10,64.82010,10,62.52010,10,60.72010,11,61.22010,11,60.4 

和此代码

 库(latticeExtra)海森堡<-read.csv(file ="ABSOLUTE_FILE_LOCATION")x<-海森堡[[1]]y<-海森堡[[2]]z<-海森堡[[3]]cloud(z〜x + y,heisenberg,panel.3d.cloud = panel.3dbars,col.facet ='green',xbase = 0.4,ybase = 0.4,scales = list(箭头= FALSE,col = 1),参数设置=列表(axis.line =列表(col =透明")) 

创建此3D条形图

问题是,我希望X轴只有2009年和2010年,而不是2009.0、2009.2、2009.4 ...

我在代码中添加了新条目,并且该条目是在最小年份值的前三年或最高年份值的后三年,

2006,01,20

2013,01,20

没有破坏轴值.

这不是最佳解决方案,因为它会将不属于原始数据的数据引入数据集中,但总比没有好.

为这个问题服务,以了解如何强制X轴在轴变量中仅两个可能的值,而又不将它们分成很多吗?

解决方案

仅需添加

让我知道这是否不是您想要的.

I'm using one dataset where the variable present in X has only two possible values - 2009 or 2010.

2009,01,52.4
2009,01,49.5
2009,01,53.2
2009,01,48.2
2009,01,53.9
2009,01,42.8
2009,01,56.4
2009,01,57
2009,01,50.3
2009,01,57.4
2009,01,45.2
2009,01,55
2009,01,47.1
2009,01,42.2
2009,01,57.1
2009,01,51.7
2009,01,56.8
2009,01,56.9
2009,01,55
2009,01,52.9
2009,01,52.9
2009,01,57
2009,01,45
2009,01,52.8
2009,01,52
2009,01,55.1
2009,01,53.3
2009,01,55.2
2009,01,53.2
2009,01,56.9
2009,01,55.9
2009,02,54.7
2009,02,53.1
2009,02,54.2
2009,02,56.2
2009,02,58.5
2009,02,50.9
2009,02,57.7
2009,02,54.1
2009,02,54.5
2009,02,55.3
2009,02,53.4
2009,02,53.8
2009,02,51.3
2009,02,52.3
2009,02,53
2009,02,53.6
2009,02,55
2009,02,53
2009,02,53.6
2009,02,52.5
2009,02,54.1
2009,02,50.1
2009,02,52.2
2009,02,54.3
2009,02,52.4
2009,02,53.2
2009,02,52.5
2009,02,52.7
2009,03,56.2
2009,03,58.7
2009,03,58.2
2009,03,63
2009,03,55
2009,03,55.4
2009,03,55.8
2009,03,63.8
2009,03,56
2009,03,52.3
2009,03,55.6
2009,03,56.8
2009,03,57.4
2009,03,58.7
2009,03,59.9
2009,03,57.7
2009,03,55.3
2009,03,54.9
2009,03,61.8
2009,03,54.1
2009,03,52.9
2009,03,55.5
2009,03,55.3
2009,03,66.4
2009,03,55.7
2009,03,53.2
2009,04,55.4
2009,04,60
2009,04,54.9
2009,04,55.3
2009,04,57.5
2009,04,55.8
2009,04,57.6
2009,04,55.7
2009,04,56.4
2009,04,54
2009,04,55.8
2009,04,56.8
2009,04,54.8
2009,04,55.8
2009,04,55.8
2009,04,53.5
2009,04,56.8
2009,04,54
2009,04,56.7
2009,04,57.2
2009,04,57.8
2009,04,57.3
2009,04,57.2
2009,04,57.2
2009,04,56.2
2009,04,55.2
2009,04,54.7
2009,04,57
2009,04,55.9
2009,05,59.8
2009,05,58.9
2009,05,59.3
2009,05,58.9
2009,05,60.4
2009,05,59.1
2009,05,58.5
2009,05,73.4
2009,05,62.5
2009,05,61.4
2009,05,61.1
2009,05,61.6
2009,05,67.6
2009,05,66.5
2009,05,58.6
2009,05,61.1
2009,05,62
2009,05,72.1
2009,05,59.3
2009,05,59.6
2009,05,61
2009,05,57.1
2009,05,59.2
2009,05,60.4
2009,05,60.1
2009,05,58.5
2009,05,58.9
2009,05,59.8
2009,05,62.6
2009,05,60.9
2009,05,59.5
2009,06,63.8
2009,06,65.4
2009,06,64.7
2009,06,64
2009,06,65.8
2009,06,68.3
2009,06,63.9
2009,06,64.2
2009,06,61.9
2009,06,62.9
2009,06,63.9
2009,06,69.7
2009,06,63.7
2009,06,63.4
2009,06,63.8
2009,06,64.5
2009,06,64.4
2009,06,63.9
2009,06,66.6
2009,06,70.3
2009,06,67.1
2009,06,65.8
2009,06,65.5
2009,06,62.9
2009,06,64.4
2009,06,65.4
2009,06,64.4
2009,06,63.3
2009,06,66.3
2009,06,66.7
2009,07,64.8
2009,07,66
2009,07,66.8
2009,07,69.9
2009,07,65.9
2009,07,68.6
2009,07,67.6
2009,07,66.7
2009,07,65.5
2009,07,65
2009,07,66.5
2009,07,66.7
2009,07,67.1
2009,07,67.4
2009,07,64.8
2009,07,65.8
2009,07,64.7
2009,07,66
2009,07,68
2009,07,66
2009,07,64.1
2009,07,65.8
2009,07,65
2009,07,63.3
2009,08,65.9
2009,08,65
2009,08,65.9
2009,08,64
2009,08,66.1
2009,08,64.5
2009,08,64
2009,08,66.8
2009,08,65
2009,08,64.7
2009,08,64.8
2009,08,65.8
2009,08,64.9
2009,08,64.9
2009,08,65.1
2009,08,65.2
2009,08,67
2009,08,64.8
2009,08,65.6
2009,08,66.1
2009,08,64.9
2009,08,67.1
2009,08,64.7
2009,08,64.9
2009,08,65.1
2009,08,64.1
2009,08,64.6
2009,08,66.5
2009,08,65.4
2009,08,65
2009,09,64.2
2009,09,63.1
2009,09,65.3
2009,09,64.2
2009,09,64.7
2009,09,63.9
2009,09,70.9
2009,09,70.1
2009,09,65
2009,09,65.5
2009,09,65.4
2009,09,68.1
2009,09,64.4
2009,09,65.1
2009,09,65.7
2009,09,63.2
2009,09,64.5
2009,09,64.8
2009,09,66.4
2009,09,64.9
2009,09,67.5
2009,09,66.4
2009,09,65.7
2009,09,65
2009,09,64.4
2009,09,62.5
2009,09,62.9
2009,09,63.7
2009,09,63.3
2009,10,66.6
2009,10,62.9
2009,10,63.1
2009,10,65.4
2009,10,69.4
2009,10,71.1
2009,10,64.1
2009,10,66.9
2009,10,69.4
2009,10,66.6
2009,10,63
2009,10,67.2
2009,10,68.6
2009,10,65.2
2009,10,64
2009,10,62.4
2009,10,65
2009,10,64.3
2009,10,68.6
2009,10,68
2009,10,63
2009,10,61.2
2009,10,65.3
2009,10,64.7
2009,10,67.1
2009,10,67.2
2009,10,68.5
2009,10,65.4
2009,10,64
2009,11,58.4
2009,11,66.4
2009,11,58.2
2009,11,55.7
2009,11,59.4
2009,11,62.7
2009,11,61.5
2009,11,62.2
2009,11,63.8
2009,11,62.2
2009,11,59.9
2009,11,62.5
2009,11,61.8
2009,11,63.3
2009,11,60.5
2009,11,60
2009,11,62
2009,11,60.5
2009,11,59.4
2009,11,63
2009,11,61.8
2009,11,60.6
2009,11,62.2
2009,11,62.9
2009,11,59.3
2009,11,55.6
2009,11,61.2
2009,11,57.6
2009,11,63.3
2009,11,58.1
2009,12,45.6
2009,12,59.7
2009,12,59.4
2009,12,59.5
2009,12,58
2009,12,56.5
2009,12,60.3
2009,12,55.9
2009,12,50.6
2009,12,51.3
2009,12,62.3
2009,12,58.2
2009,12,40.6
2009,12,59.4
2009,12,55.6
2009,12,61.6
2009,12,48.1
2009,12,52.3
2009,12,57.7
2009,12,60.1
2009,12,61.3
2009,12,59.7
2009,12,52.6
2009,12,51.9
2009,12,53.2
2009,12,58.7
2009,12,55.9
2010,01,57.8
2010,01,45.4
2010,01,50.5
2010,01,56.3
2010,01,58.1
2010,01,41.8
2010,01,53
2010,01,58.9
2010,01,52.5
2010,01,50.5
2010,01,56.4
2010,01,55.9
2010,01,55.4
2010,01,39
2010,01,56.4
2010,01,57.7
2010,01,59.8
2010,01,54.9
2010,01,56.1
2010,01,55.6
2010,01,57.5
2010,01,47.4
2010,01,59.5
2010,01,48.7
2010,01,59.4
2010,01,55.5
2010,01,56.3
2010,01,45.1
2010,01,49
2010,02,43.1
2010,02,53.9
2010,02,44.2
2010,02,53.2
2010,02,48.8
2010,02,44.3
2010,02,57.3
2010,02,50.4
2010,02,59.8
2010,02,58.5
2010,02,56.3
2010,02,56.7
2010,02,58.9
2010,02,51.3
2010,02,43
2010,02,58.4
2010,02,56.9
2010,02,57.2
2010,02,51.2
2010,02,50.9
2010,02,48.7
2010,02,54.4
2010,02,55.9
2010,02,53.9
2010,02,59.3
2010,03,56
2010,03,54.9
2010,03,55.9
2010,03,58.2
2010,03,60.9
2010,03,56
2010,03,57.5
2010,03,59.1
2010,03,57.4
2010,03,51.9
2010,03,58
2010,03,55.9
2010,03,57.1
2010,03,55
2010,03,60.7
2010,03,55.7
2010,03,50.3
2010,03,57.6
2010,03,60.5
2010,03,53.7
2010,03,56.5
2010,03,57.3
2010,03,52.8
2010,03,46.7
2010,03,52.3
2010,03,55.6
2010,03,52.7
2010,03,56.1
2010,03,57.1
2010,03,55.2
2010,03,57.6
2010,04,62.4
2010,04,62.6
2010,04,55.7
2010,04,62.5
2010,04,57.5
2010,04,69.5
2010,04,63.5
2010,04,62.2
2010,04,60.7
2010,04,62.5
2010,04,62
2010,04,57.6
2010,04,61.3
2010,04,54.8
2010,04,64.3
2010,04,61.4
2010,04,67.2
2010,04,63
2010,04,64.5
2010,04,57.3
2010,04,57.4
2010,04,55.8
2010,04,58.6
2010,04,60.6
2010,04,61
2010,04,56.9
2010,04,60.2
2010,04,65.3
2010,04,60.2
2010,04,59.6
2010,05,73.9
2010,05,63.3
2010,05,56.5
2010,05,63.7
2010,05,63.2
2010,05,58.9
2010,05,58.1
2010,05,71.3
2010,05,63
2010,05,64.8
2010,05,64.1
2010,05,58.6
2010,05,55.9
2010,05,57.7
2010,05,69.1
2010,05,61.4
2010,05,59.2
2010,05,58.5
2010,05,57.3
2010,05,60.2
2010,05,59.1
2010,05,67.8
2010,05,67.1
2010,05,64.7
2010,05,61.3
2010,05,58.5
2010,05,58.7
2010,05,61.7
2010,05,59.9
2010,05,65.2
2010,06,64.4
2010,06,62
2010,06,62.2
2010,06,62.7
2010,06,65.8
2010,06,65.1
2010,06,63.4
2010,06,63.3
2010,06,62.2
2010,06,61.8
2010,06,61.5
2010,06,61.7
2010,06,64.7
2010,06,62.8
2010,06,64.2
2010,06,61.4
2010,06,63.3
2010,06,62.8
2010,06,64.1
2010,06,60.5
2010,06,62.6
2010,06,62.2
2010,06,63.1
2010,06,62.9
2010,06,63
2010,06,62.5
2010,06,62.2
2010,06,63.9
2010,06,61.9
2010,06,64.3
2010,07,65
2010,07,65.3
2010,07,65.1
2010,07,65.6
2010,07,65.6
2010,07,69.8
2010,07,74.5
2010,07,64.7
2010,07,65.6
2010,07,64.6
2010,07,72.1
2010,07,66.4
2010,07,66.8
2010,07,63.7
2010,07,65.2
2010,07,63.8
2010,07,65
2010,07,66.5
2010,07,65.4
2010,07,67.1
2010,07,65.5
2010,07,66.3
2010,07,65.9
2010,07,65.5
2010,07,64.5
2010,07,65
2010,07,65.9
2010,07,64.8
2010,07,65.3
2010,07,64.8
2010,07,65.3
2010,08,65.6
2010,08,65.5
2010,08,67
2010,08,69.4
2010,08,65
2010,08,64.3
2010,08,66.9
2010,08,65.4
2010,08,64.4
2010,08,65.1
2010,08,66.4
2010,08,63.6
2010,08,65.2
2010,08,63.3
2010,08,70.1
2010,08,65.9
2010,08,68.3
2010,08,67.8
2010,08,64.4
2010,08,65.1
2010,08,64.7
2010,08,63.7
2010,08,63.5
2010,08,67.9
2010,08,70.3
2010,08,65.8
2010,08,63.9
2010,08,66.6
2010,08,67.4
2010,08,65.4
2010,08,64.1
2010,09,66.6
2010,09,70.7
2010,09,66.3
2010,09,64.5
2010,09,66.7
2010,09,68.1
2010,09,71.2
2010,09,64.4
2010,09,65
2010,09,67.8
2010,09,64.5
2010,09,66.7
2010,09,67.8
2010,09,67.6
2010,09,68.3
2010,09,67.8
2010,09,67.6
2010,09,66.4
2010,09,68.4
2010,09,67.6
2010,09,63.7
2010,09,72.2
2010,09,67.3
2010,09,67.6
2010,09,67.6
2010,09,68.4
2010,09,64.7
2010,09,68.6
2010,09,66.4
2010,10,62
2010,10,63.3
2010,10,63.6
2010,10,63.7
2010,10,61.8
2010,10,64.2
2010,10,62.9
2010,10,65.6
2010,10,64.1
2010,10,65.2
2010,10,64.8
2010,10,61.6
2010,10,64.7
2010,10,65.7
2010,10,60.9
2010,10,61.7
2010,10,65.1
2010,10,65.5
2010,10,61
2010,10,62.1
2010,10,63
2010,10,65.8
2010,10,64.3
2010,10,65.3
2010,10,64.8
2010,10,62.5
2010,10,60.7
2010,11,61.2
2010,11,60.4

and this code

library(latticeExtra)

heisenberg <- read.csv(file="ABSOLUTE_FILE_LOCATION")

x <- heisenberg[[1]]
y <- heisenberg[[2]]
z <- heisenberg[[3]]

cloud(z~x+y, heisenberg, panel.3d.cloud=panel.3dbars, col.facet='green',
      xbase=0.4, ybase=0.4,scales=list(arrows=FALSE, col=1), 
      par.settings = list(axis.line = list(col = "transparent")))

to create this 3D bar chart

Thing is, i want the X axis to have only 2009 and 2010 instead of 2009.0, 2009.2, 2009.4 ...

I added new entries to the code and when the entry was three years before the smallest year value or three years after the highest year value,

2006,01,20

or

2013,01,20

didn't break the axis values.

This isn't the best solution because it introduces data that's not part of the original into the dataset but it's better than nothing.

Serves this question to know how to force the X axis to have only the 2 possible values, in the axis variable, without breaking them into many?

解决方案

It's only a matter of adding as.factor to express that 2009 and 2010 are ordinal and not continuous I think. That is,

x <- heisenberg[[1]]
x <- factor(x, levels = c(2009, 2010), ordered = TRUE) ## The only difference
y <- heisenberg[[2]]
z <- heisenberg[[3]]

cloud(
  z ~ x + y, heisenberg,
  panel.3d.cloud = panel.3dbars, col.facet = "green",
  xbase = 0.4, ybase = 0.4, scales = list(arrows = FALSE, col = 1),
  par.settings = list(axis.line = list(col = "transparent"))
)

Then you would have the following plot:

Let me know if this wasn't what you were going for.

这篇关于强制/编辑gridExtra中的轴值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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