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

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

Closed
aacocucci opened this issue Mar 13, 2021 · 19 comments
Closed

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

aacocucci opened this issue Mar 13, 2021 · 19 comments

Comments

@aacocucci
Copy link

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
Copy link
Collaborator

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
Copy link
Author

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
Copy link
Collaborator

thomased commented Mar 14, 2021

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
Copy link
Author

Yep. Now your example works ok!

@thomased
Copy link
Collaborator

Ah, excellent! Glad to hear it.

@aacocucci
Copy link
Author

aacocucci commented Mar 15, 2021 via email

@thomased
Copy link
Collaborator

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
Copy link
Author

aacocucci commented Mar 16, 2021 via email

@thomased
Copy link
Collaborator

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
Copy link
Author

Here the image to my previous comment
imagen

@thomased
Copy link
Collaborator

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
Copy link
Author

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

@Bisaloo
Copy link
Collaborator

Bisaloo commented Mar 26, 2021

Hi @aacocucci 👋, 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
Copy link
Author

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
Copy link
Collaborator

Bisaloo commented Mar 26, 2021

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

sessioninfo::session_info()

@aacocucci
Copy link
Author

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
Copy link
Author

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
Copy link
Collaborator

Bisaloo commented Mar 26, 2021

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
Copy link
Author

Thanks! It works perfect now.

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

No branches or pull requests

3 participants