0

Im trying to remove the x-y coordinate grid lines in my ternary plot, but I lack the knowledge of where to put in the command axis = false. I've tried different places. Can you guys help?

axis <- function(title) {
  list(
    title = title,
    titlefont = list(
      size = 20
    ),
    tickfont = list(
      size = 15
    ),
    tickcolor = 'rgba(0,0,0,0)',
    ticklen = 5
  )
}

at <- list(title =  "Ler <4mu", #
           titlefont=list(size=20),
           font=list(size=20),
           tickfont=list(size=16),
           range= list(n=100,min=20,max=80)
)

bt <- list(title =  "Fint silt 4-16mu", #
           titlefont=list(size=20),
           font=list(size=20),
           tickfont=list(size=16)
)

ct <- list(title =  "Medium og groft silt 16-62mu", #
           titlefont=list(size=20),
           font=list(size=20),
           tickfont=list(size=16))


p <-  plot_ly(new_data,
              type = 'scatterternary',
              mode = 'markers',
              a = as.numeric(new_data$Fraktion1),
              b = as.numeric(new_data$Fraktion2),
              c = as.numeric(new_data$Fraktion3),
              color= as.numeric(new_data$Vandoptag),
              marker = list( 
                size = 12
              )
) %>% 
  layout(
    title = "",
    margin = list(l = 0, r=0, t=50, b=100),
    ternary = list(
      sum = 100,
      aaxis = at ,
      baxis = bt,
      caxis = ct
    )
  )
p

This here gives me this output:

Image description; There is a X-Y plot with grid lines for x and y in over my ternary diagram. I don't want to hide the grid lines for the ternary diagram, but only for the x-y coordinate system that is overlayed. I can't post a picture of how it is looking as Im new here and apparently need some points to do so, but hope you can help and that it makes sense.

  • Hi Mike, welcome to Stack Overflow! Can you provide some example data to help people give you a helpful answer? If we can run your code on data like yours, we can make sure it does what you want :-) Thanks! – Michael Roswell May 19 '21 at 16:29
  • Hey Michael, for sure! Im importing 2 seperate data files from excel and I'm creating a new data frame that is then used for the plot. Maybe it's easier to add the full code and some data? Otherwise, the data frame created is simply a sediment fraction, with 3 variable fractions and another factor which is shown by a color chart. The 3 sediment fractions are the points added in the ternary diagram where the fractions are in percentage and the for each point in the ternary diagram a color chart is added. So data point in the ternary diagram data frame would look something like this: – Mike Messerli May 19 '21 at 17:24
  • Sample name - factor - fraction 1 - fraction 2 - fraction 3 example: - 9,8 - 0,341 - 0,525 - 0,131 The code normalizes them to a 100 – Mike Messerli May 19 '21 at 17:27
  • Use R code to add data objects using SO's [edit] facilities. (There's no way we can possibly debug using the data that is pasted into your comment. Read "https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example?r=SearchResults&s=1|2897.1443 – IRTFM May 19 '21 at 17:32
  • I'm sorry, but I don't understand how I should add data into my example. I've read the link you added. I'm pretty new both at programming and here on the site. My data is loaded into R studio with a library called "readxl" and I use the library "plotly" to create the ternary diagram. The data is then processed into a new data frame, is there anyway to save that and add it somewhere here, if that is helpful enough? :) – Mike Messerli May 19 '21 at 18:15

0 Answers0