1

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

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

Lattice Extra with new data entry

or

2013,01,20

Lattice Extra with new data entry

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?

molecoder
  • 423
  • 1
  • 7
  • 24

1 Answers1

2

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:

enter image description here

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

DomQ
  • 4,184
  • 38
  • 37
Kim
  • 4,080
  • 2
  • 30
  • 51
  • 1
    That's what I was looking for, thank you @Kim. The bounty can only be awarded in 11 hours, but you don't need to worry, I'm giving it to you. – molecoder Nov 12 '19 at 09:59