rlabelscatterplot3d

Customize ticks and lables using scatterplot3d


My goal is to plot 9 names on my y axis (the letter "a" to "i" by one letter after another).

However only every second letter is being plotted using the function scatterplot3d in the program R. Do you know how I could solve this problem?

Sincerely

plot_how <- scatterplot3d(Test.df,
              color = "pink",
              main="test experiment",
              xlab = "time",
              ylab = "samples ",
              zlab = "output", type = "l", box = F,
              ylim = c(1,9),
              zlim = c(0, 3000), 
              grid = F, 
              yaxt = "n",  
              scale.y = 1, 
              label.tick.marks = T, 
              y.ticklabs = c("a", "b", "c", "d", "e", "f", "g", "h", "i"))

Solution

  • You have to use the command lab in scatterplot3d. If you set the command to for example because of 9 letters set lab = c(9,9,9) depending on your axis. I will give you an example with a sample data.

    Test.df <- data.frame(letter = c("a", "b", "c", "d", "e", "f", "g", "h", "i"),
                            x = c(1, 2, 3, 4, 5, 6 , 7, 8, 9),
                            z = c(1, 2, 3, 4, 5, 6 , 7, 8, 9))
    

    Test.df data:

      letter x z
    1      a 1 1
    2      b 2 2
    3      c 3 3
    4      d 4 4
    5      e 5 5
    6      f 6 6
    7      g 7 7
    8      h 8 8
    9      i 9 9
    

    You can use this code:

    library(scatterplot3d)
      plot_how <- scatterplot3d(Test.df,
                                color = "pink",
                                main="test experiment",
                                xlab = "time",
                                ylab = "samples ",
                                zlab = "output", type = "l", box = F,
                                ylim = c(1,9),
                                zlim = c(0, 9), 
                                grid = F, 
                                yaxt = "n",  
                                scale.y = 1, 
                                label.tick.marks = T, 
                                y.ticklabs = c("a", "b", "c", "d", "e", "f", "g", "h", "i"),
                                lab = c(9,9,9))
    

    Output plot:

    enter image description here

    As you can see in the plot, all the letters are now on the axis.