Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plotVariance fails if it's the first plot in the script. #24

zeehio opened this issue Apr 29, 2016 · 1 comment

plotVariance fails if it's the first plot in the script. #24

zeehio opened this issue Apr 29, 2016 · 1 comment


Copy link

zeehio commented Apr 29, 2016

First of all thanks for your work on this package. It looks great.

In my computer the following script fails (with current CRAN 0.7.0 version and current master version):

model <- pca(people)

With error:

Error in strwidth(legend, units = "user", cex = cex, font = text.font) : has not been called yet


7 strwidth(legend, units = "user", cex = cex, font = text.font) 
6 legend(position, legend, col = col, pch = pch, lty = lty, lwd = lwd, 
    plot = plot, cex = 0.8, inset = inset, bg = "white", box.lwd = 0.75, 
    box.col = "gray", ncol = ncol) at mdaplots.R#453
5 mdaplot.showLegend(legend, position = legend.position, plot = F) at mdaplots.R#185
4 mdaplot.getAxesLim(data, show.lines = show.lines, single.x = single.x, 
    show.legend = show.legend, legend = legend, show.labels = show.labels, 
    legend.position = legend.position, xticks = xticks, yticks = yticks) at mdaplots.R#1155
3 mdaplotg(data, main = main, xlab = xlab, ylab = ylab, labels = labels, 
    legend = legend, type = type, show.labels = show.labels, 
    ...) at pca.R#641
2 plotVariance.pca(model) at defaults.R#526
1 plotVariance(model) 

Session info:

R version 3.2.5 (2016-04-14)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.2 LTS

 [1] LC_CTYPE=ca_ES.UTF-8       LC_NUMERIC=C               LC_TIME=ca_ES.UTF-8        LC_COLLATE=ca_ES.UTF-8     LC_MONETARY=ca_ES.UTF-8   
 [6] LC_MESSAGES=ca_ES.UTF-8    LC_PAPER=ca_ES.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] mdatools_0.7.0

loaded via a namespace (and not attached):
[1] tools_3.2.5

As a workaround this works:

model <- pca(people) # conventionally I don't need to use this
Copy link

svkucheryavski commented May 2, 2016

Hi Sergio,

thanks a lot for you kind feedback and the issues. My students told me once about this problem with however I did not have time so far to look at it and fix it. Now it is done, plus the other suggestions (Roxygen and wrong case in data file) as well as some other minor improvements in the code. I decided that it will be simpler for me to do these fixes locally but thanks for the pull request as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests

2 participants