Board for users of the R.Luminescence package

plot_Radialplot fails with one disc is in second dataset

Only issues concerning the plotfunctions should be discussed here!

Moderator: skreutzer

plot_Radialplot fails with one disc is in second dataset

Postby Alice » Tue May 23, 2017 8:31 am

I'm making radialplots of samples containing accepted discs and rejected discs due to iteration.
I put these two datasets in one list called data and try to plot is so i can make a difference in the symbols and color.

Below is the code I use. The error i get is
Error in density.default(x = data[[i]][, 1], kernel = "gaussian", from = limits.z[1], :
need at least 2 points to select a bandwidth automatically

I even tried it in Shiny and there the error was
Error: An error has occurred. Check your logs or contact the app author for clarification.

The problem is the sample with only one rejection. When i put in the sample double in the second dataset of shiny it will make a radialplot.
I thought the problem was the zlim, but as you can see down in the code I put it in manual but it still doesn't do it.

I would like to know if it is impossible to make a radialplot with only one disc in second dataset. If it is I'm fine with that, I just want to rule out that I'm doing something wrong.

Code: Select all
for (p in datasheets){
  sample<-readWorksheet(object=dataIn,sheet=p,region='B4:B5',colTypes = 'character')
  DR<-readWorksheet(object=dataIn,sheet=p,startRow = 40,startCol = 10,endRow = 42,endCol = 10)
  ED<-readWorksheet(object=dataIn,sheet=p,startRow = 40,startCol = 8,endRow = 42,endCol = 8)
  Age<-readWorksheet(object=dataIn,sheet=p,region='l40:l42',colTypes = 'numeric')
  aliquotes<-readWorksheet(object=dataIn,sheet=p,region='B46:B47',colTypes = 'numeric')
  Dose<-readWorksheet(object=dataIn,sheet=p,region='j55:k155',autofitRow=FALSE,colTypes = 'numeric')
  bla=c(min(Dose[,1]-Dose[,2],na.rm=TRUE)*DR[1,1],  max(Dose[,1]+Dose[,2],na.rm=TRUE)*DR[1,1])
Fit<-readWorksheet(object=dataIn,sheet=p,region='l55:l155',colTypes = 'character')
legendaccept<-paste('Iterated accepted disc n=',length(accept[,1]),sep="")
legendreject<-paste('Iterated rejected disc n=',length(reject[,1]),sep="")

subtitle<-paste('Iterated age ',round(Age[1,1],1),' +/- ',round(Age[2,1],1),' ka, n=',aliquotes,sep="")

plot_RadialPlot(data = data,
                xlim=c(0,25), #taken from Shiny, not sure how this is calculated
                plot.ratio = 0.818181818181818, #taken from Shiny, not sure how this is calculated
                zlab = 'Age [ka]',
                y.ticks = TRUE,
                grid.col = 'none',
                bar.col = c('#7F7F7FA8', 'none'),
                pch = c(16, 6),
                col = c('black', 'grey50'),
                main = paste('Radial Plot ',sample,sep=""),
                mtext = subtitle,
                log.z = TRUE,
                stats = NULL,
                legend = c(legendaccept, legendreject),
                legend.pos = 'bottomleft',
                na.rm = TRUE,
                central.value = c(Age[1,1],Age[1,1]),
                centrality = c(Age[1,1],Age[1,1]),
                lwd = c(2, 1),
                lty = c(2, 0))
Posts: 25
Joined: Wed Dec 10, 2014 11:15 am

Re: plot_Radialplot fails with one disc is in second dataset

Postby skreutzer » Mon Jul 17, 2017 8:36 am

I guess this was solved, right?
Posts: 69
Joined: Tue May 14, 2013 4:19 pm

Return to Plotfunctions

Who is online

Users browsing this forum: No registered users and 1 guest