rmaia / pavo

tools for the analysis of color data in R
http://pavo.colrverse.com
GNU General Public License v2.0
68 stars 17 forks source link

after updating no points are added with points() #228

Closed aacocucci closed 3 years ago

aacocucci commented 3 years ago

After updating to version 2.6.1 I cannot add points to an hexagon built with colspace(x, space = 'hexagon') using points(). This was working ok before with the same script

thomased commented 3 years ago

Hi @aacocucci - we had to make some changes to plot-margin handling in 2.6.1 to return more control to users (as is standard). plot() and points() should still work as expected, like the example below, but your script might need a little tweak depending on whether there are other adjustments being made to options() and par(). Here's a reproducible example:

data(flowers)
vis.flowers <- vismodel(flowers,
                        visual = "apis", qcatch = "Ei", relative = FALSE,
                        vonkries = TRUE, achromatic = "l", bkg = "green"
)
hex.flowers <- colspace(vis.flowers, space = "hexagon")
plot(hex.flowers[1:10, ])
points(hex.flowers[11:20, ], col = 'green')
Screen Shot 2021-03-14 at 10 52 26 am

If that doesn't help — would you mind sharing the snippet of code you're using to create your plot?

aacocucci commented 3 years ago

Thanks to your quick reply. However, even with your example green points added with points are not shown in my computer. I use the latest R version and Ubuntu 18.04

thomased commented 3 years ago

That's odd. Would you mind installing the dev version then trying again? So just use remotes::install_github('rmaia/pavo') to install v2.7.0, then run that bit of example code again and let me know what happens. Thanks!

aacocucci commented 3 years ago

Yep. Now your example works ok!

thomased commented 3 years ago

Ah, excellent! Glad to hear it.

aacocucci commented 3 years ago

Sorry, does that mean that I have to alway run the dev version?


Dr. Andrea Cocucci Laboratorio de Ecología Evolutiva y Biología Floral IMBIV (CONICET-UNC) 0351-5353800 ext 30010 WEB https://eebfblog.wordpress.com/

El dom, 14 mar 2021 a las 21:08, Thomas White @.***>) escribió:

Ah, excellent! Glad to hear it.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rmaia/pavo/issues/228#issuecomment-799007873, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATG62MBE5Z4YFLEYAFAQETLTDVFXJANCNFSM4ZEJ67KA .

thomased commented 3 years ago

Good question - but no, only until we release this version with the fix to that particular bug, and it's available on CRAN. We'll probably be doing that in the next few weeks, after which time v2.7.0 will be the version you get when you update your package or run install.packages(pavo), so you can just go back to using the 'release' version.

aacocucci commented 3 years ago

New issues pop up when I follow your suggestion. This is what I get with your example [image: imagen.png]


Dr. Andrea Cocucci Laboratorio de Ecología Evolutiva y Biología Floral IMBIV (CONICET-UNC) 0351-5353800 ext 30010 WEB https://eebfblog.wordpress.com/

El lun, 15 mar 2021 a las 16:50, Thomas White @.***>) escribió:

Good question - but no, only until we release this version with the fix to that particular bug, and it's available on CRAN. We'll probably be doing that in the next few weeks, after which time v2.7.0 will be the version you get when you update your package or run install.packages(pavo), so you can just go back to using the 'release' version.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rmaia/pavo/issues/228#issuecomment-799705777, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATG62MBZG6DDWO72XYMDQILTDZQHBANCNFSM4ZEJ67KA .

thomased commented 3 years ago

That image doesn't seem to have uploaded correctly? You might need to log onto GitHub & this issue thread directly instead of replying to the email chain, at a guess.

aacocucci commented 3 years ago

Here the image to my previous comment imagen

thomased commented 3 years ago

At a guess, it looks like some plotting parameters, like the margins, are being adjusted somewhere in your script between plotting & adding points? Especially if it worked before, but doesn't now. Below is an example of what I mean, but the error can creep in in a number of ways if your script is long and/or complex, so it's probably simplest to try running that example code in a completely clean session (i.e. exit everything, then run only those few example lines above). If that works correctly, then you'll need to have a look through your script to double-check you're setting the plotting parameters (par()) in the way you really intend.

Run a model

library(pavo) data(flowers) vis.flowers <- vismodel(flowers, visual = "apis", qcatch = "Ei", relative = FALSE, vonkries = TRUE, achromatic = "l", bkg = "green" ) hex.flowers <- colspace(vis.flowers, space = "hexagon")

Plot 1, with an example margin-tweak between plotting & adding points

plot(hex.flowers[1:10, ]) par(oma = c(0, 0, 12, 0)) # change the outer margin points(hex.flowers[11:20, ], col = 'green')

Screen Shot 2021-03-17 at 7 38 55 am

Plot 2, with outer margins reset to their default (or just run the example code with a completely clean session to test if this is the problem)

par(oma = c(0, 0, 0, 0)) # default outer-margin plot(hex.flowers[1:10, ]) points(hex.flowers[11:20, ], col = 'green')

Screen Shot 2021-03-17 at 7 38 02 am
aacocucci commented 3 years ago

The plot I posted some days ago was run in a clean session with your script and nothing else.

Bisaloo commented 3 years ago

Hi @aacocucci :wave:, could you please post here the output of sessioninfo::sessioninfo::session_info() and par(no.readonly = TRUE) just after you run the script above?

It might help us find out what's different between your computer and ours and could cause this issue.

aacocucci commented 3 years ago

sessioninfo::sessioninfo::session_info() Error: inesperado '::' in "sessioninfo::sessioninfo::" par(no.readonly = TRUE) $xlog [1] FALSE

$ylog [1] FALSE

$adj [1] 0.5

$ann [1] TRUE

$ask [1] FALSE

$bg [1] "white"

$bty [1] "o"

$cex [1] 1

$cex.axis [1] 1

$cex.lab [1] 1

$cex.main [1] 1.2

$cex.sub [1] 1

$col [1] "black"

$col.axis [1] "black"

$col.lab [1] "black"

$col.main [1] "black"

$col.sub [1] "black"

$crt [1] 0

$err [1] 0

$family [1] ""

$fg [1] "black"

$fig [1] 0 1 0 1

$fin [1] 5.447917 4.458333

$font [1] 1

$font.axis [1] 1

$font.lab [1] 1

$font.main [1] 2

$font.sub [1] 1

$lab [1] 5 5 7

$las [1] 0

$lend [1] "round"

$lheight [1] 1

$ljoin [1] "round"

$lmitre [1] 10

$lty [1] "solid"

$lwd [1] 1

$mai [1] 1.02 0.82 0.82 0.42

$mar [1] 5.1 4.1 4.1 2.1

$mex [1] 1

$mfcol [1] 1 1

$mfg [1] 1 1 1 1

$mfrow [1] 1 1

$mgp [1] 3 1 0

$mkh [1] 0.001

$new [1] FALSE

$oma [1] 0 0 0 0

$omd [1] 0 1 0 1

$omi [1] 0 0 0 0

$pch [1] 1

$pin [1] 4.207917 2.618333

$plt [1] 0.1505163 0.9229063 0.2287850 0.8160748

$ps [1] 12

$pty [1] "m"

$smo [1] 1

$srt [1] 0

$tck [1] NA

$tcl [1] -0.5

$usr [1] 0 1 0 1

$xaxp [1] 0 1 5

$xaxs [1] "r"

$xaxt [1] "s"

$xpd [1] FALSE

$yaxp [1] 0 1 5

$yaxs [1] "r"

$yaxt [1] "s"

$ylbias [1] 0.2

Bisaloo commented 3 years ago

Oh sorry, there was a typo in my previous message. The correct command for session info is:

sessioninfo::session_info()
aacocucci commented 3 years ago

There again in a clean session

sessioninfo::session_info() ─ Session info ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── setting value
version R version 3.6.3 (2020-02-29) os Ubuntu 18.04.5 LTS
system x86_64, linux-gnu
ui RStudio
language es_AR:es
collate es_AR.UTF-8
ctype es_AR.UTF-8
tz America/Argentina/Cordoba
date 2021-03-26

─ Packages ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── package version date lib source
abind 1.4-5 2016-07-21 [1] CRAN (R 3.6.2) assertthat 0.2.1 2019-03-21 [1] CRAN (R 3.6.2) cli 2.0.2 2020-02-28 [1] CRAN (R 3.6.3) cluster 2.1.1 2021-02-14 [4] CRAN (R 3.6.3) codetools 0.2-18 2020-11-04 [4] CRAN (R 3.6.3) crayon 1.3.4 2017-09-16 [1] CRAN (R 3.6.2) digest 0.6.27 2020-10-24 [1] CRAN (R 3.6.3) fansi 0.4.0 2018-10-05 [1] CRAN (R 3.6.2) future 1.21.0 2020-12-10 [1] CRAN (R 3.6.3) future.apply 1.7.0 2021-01-04 [1] CRAN (R 3.6.3) geometry 0.4.5 2019-12-04 [1] CRAN (R 3.6.2) globals 0.14.0 2020-11-22 [1] CRAN (R 3.6.3) glue 1.4.0 2020-04-03 [1] CRAN (R 3.6.3) lattice 0.20-41 2020-04-02 [4] CRAN (R 3.6.3) lightr 1.3 2020-06-30 [1] CRAN (R 3.6.3) listenv 0.8.0 2019-12-05 [1] CRAN (R 3.6.3) magic 1.5-9 2018-09-17 [1] CRAN (R 3.6.2) magick 2.7.0 2021-03-09 [1] CRAN (R 3.6.3) magrittr 2.0.1 2020-11-17 [1] CRAN (R 3.6.3) misc3d 0.9-0 2020-09-06 [1] CRAN (R 3.6.3) parallelly 1.24.0 2021-03-14 [1] CRAN (R 3.6.3) pavo
2.6.1 2020-12-18 [1] CRAN (R 3.6.3) plot3D 1.3 2019-12-18 [1] CRAN (R 3.6.2) progressr 0.7.0 2020-12-11 [1] CRAN (R 3.6.3) Rcpp 1.0.6 2021-01-15 [1] CRAN (R 3.6.3) rstudioapi 0.11 2020-02-07 [1] CRAN (R 3.6.3) sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 3.6.3) sp 1.4-5 2021-01-10 [1] CRAN (R 3.6.3) withr 2.1.2 2018-03-15 [1] CRAN (R 3.6.2) xml2 1.3.2 2020-04-23 [1] CRAN (R 3.6.3)

[1] /home/andrea/R/x86_64-pc-linux-gnu-library/3.6 [2] /usr/local/lib/R/site-library [3] /usr/lib/R/site-library [4] /usr/lib/R/library

aacocucci commented 3 years ago

par(no.readonly = TRUE) $xlog [1] FALSE

$ylog [1] FALSE

$adj [1] 0.5

$ann [1] TRUE

$ask [1] FALSE

$bg [1] "white"

$bty [1] "o"

$cex [1] 1

$cex.axis [1] 1

$cex.lab [1] 1

$cex.main [1] 1.2

$cex.sub [1] 1

$col [1] "black"

$col.axis [1] "black"

$col.lab [1] "black"

$col.main [1] "black"

$col.sub [1] "black"

$crt [1] 0

$err [1] 0

$family [1] ""

$fg [1] "black"

$fig [1] 0 1 0 1

$fin [1] 5.447917 4.458333

$font [1] 1

$font.axis [1] 1

$font.lab [1] 1

$font.main [1] 2

$font.sub [1] 1

$lab [1] 5 5 7

$las [1] 0

$lend [1] "round"

$lheight [1] 1

$ljoin [1] "round"

$lmitre [1] 10

$lty [1] "solid"

$lwd [1] 1

$mai [1] 1.02 0.82 0.82 0.42

$mar [1] 5.1 4.1 4.1 2.1

$mex [1] 1

$mfcol [1] 1 1

$mfg [1] 1 1 1 1

$mfrow [1] 1 1

$mgp [1] 3 1 0

$mkh [1] 0.001

$new [1] FALSE

$oma [1] 0 0 0 0

$omd [1] 0 1 0 1

$omi [1] 0 0 0 0

$pch [1] 1

$pin [1] 4.207917 2.618333

$plt [1] 0.1505163 0.9229063 0.2287850 0.8160748

$ps [1] 12

$pty [1] "m"

$smo [1] 1

$srt [1] 0

$tck [1] NA

$tcl [1] -0.5

$usr [1] 0 1 0 1

$xaxp [1] 0 1 5

$xaxs [1] "r"

$xaxt [1] "s"

$xpd [1] FALSE

$yaxp [1] 0 1 5

$yaxs [1] "r"

$yaxt [1] "s"

$ylbias [1] 0.2

Bisaloo commented 3 years ago

Thank you! It should work if you install the latest version from CRAN (released a couple of days ago):

install.packages("pavo")
sessioninfo::session_info() # should show that pavo is now on version 2.7.0

Hopefully it will solve your issues.

aacocucci commented 3 years ago

Thanks! It works perfect now.