acorg / Racmacs

Racmacs R package for performing antigenic cartography
https://acorg.github.io/Racmacs/
GNU Affero General Public License v3.0
20 stars 9 forks source link

Missing legends/text on plot(map) #145

Open drserajames opened 1 year ago

drserajames commented 1 year ago

When using plot(map), the borders of the plot can not have text or a legend on them. Resolved by setting par(mar=rep(0,4)) prior to calling plot.

> library(Racmacs)
> packageVersion("Racmacs")
[1] ‘1.1.38’
> 
> set.seed(123)
> dat <- matrix(10*2^round(10*runif(100)), ncol=10)
> set.seed(456)
> map <- make.acmap(dat, verbose=F, options=list(report_progress = F))
> plot(map)
> legend("bottomleft", c("lots", "of", "important", "things"))
> legend("bottomright", c("lots", "of", "important", "things"))
> legend("topleft", c("lots", "of", "important", "things"))
> legend("topright", c("lots", "of", "important", "things"))
> text(0,0, "Cos I wonder where you are")
> text(-5, 5, "Is it me you're looking for?")
> text(-5, 7.2, "Hello")

Rplot01

par(mar=rep(0,4))
plot(map)
legend("bottomleft", c("lots", "of", "important", "things"))
legend("bottomright", c("lots", "of", "important", "things"))
legend("topleft", c("lots", "of", "important", "things"))
legend("topright", c("lots", "of", "important", "things"))
text(0,0, "Cos I wonder where you are")
text(-5, 5, "Is it me you're looking for?")
text(-5, 7.2, "Hello")

Rplot02

judyssister commented 1 year ago

Dear Sarah, I am confused about what will be added to the map when using the legend() function. I only can see a box with black text. However, I hope for a series of colored circles and rectangles as a legend like the attached figure. Could please give me some suggestions about the legend ?

image

Thank you very much. Cheers, Jing