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

nonpareil.curve.batch - double legend? #43

Closed
russejenn opened this issue Mar 19, 2020 · 3 comments
Closed

nonpareil.curve.batch - double legend? #43

russejenn opened this issue Mar 19, 2020 · 3 comments
Assignees
Labels

Comments

@russejenn
Copy link

Hello,

I am trying to graph 24 samples together using Nonpareil.curve.batch, and the regular command outputs a legend that goes right over top of my curves, and the box isn't see-through. When I try to move the legend using nonpareil.legend, it makes a second legend (so the graph has two). Is there a way to remove the legend from the Nonpareil.curve.batch command? Or am I doing something wrong? (note that I am currently just working with 2 samples to get it to work).

Here is my code:
samples <- read.table('Nonpareil.samples.txt', sep='\t', header=TRUE)
attach(samples)
non <- Nonpareil.curve.batch(File, libnames=Name, skip.model=TRUE, plot=TRUE)
image

Nonpareil.legend(non, 'topright')
image

Thanks!

@lmrodriguezr lmrodriguezr self-assigned this Mar 20, 2020
@lmrodriguezr
Copy link
Owner

Hello @russejenn
Note that you're using a syntax that is no longer supported (kept for backwards compatibility). I'm suggesting below the easier-to-use version of the same code you have (using Nonpareil.set instead of Nonpareil.curve.batch).

There are two ways to achieve this.
My preferred option is to turn off the legend first, and then plot the legend separately:

samples <- read.table('Nonpareil.samples.txt', sep = '\t', header = TRUE, as.is = TRUE)
non <- Nonpareil.set(samples$File,
  labels = samples$Name,
  plot.opts = list(plot.model = FALSE, legend.opts = FALSE))
Nonpareil.legend(non, 'topright')

However, you can also achieve that with a single command:

samples <- read.table('Nonpareil.samples.txt', sep = '\t', header = TRUE, as.is = TRUE)
non <- Nonpareil.set(samples$File,
  labels = samples$Name,
  plot.opts = list(plot.model = FALSE, legend.opts = list(x = 'topright')))

@lmrodriguezr
Copy link
Owner

Please feel to reopen if this doesn't work for you

@ReneKat
Copy link

ReneKat commented Jan 22, 2022

Hello!
First, a big THANK YOU for making nonpareil and its documentation.
This is just a comment on manipulating legends. I had a similar issue to others that have posted regarding legends. I wanted to share what worked for me. As was already mentioned, any argument in legend() can be applied to legend.opts .
I found cex = XX to be an easy fix to shrink or enlarge a legend. For example,
Nonpareil.set(File, col=Color, labels=Name, plot.opts = list(legend.opts = list(cex = 0.6)))
shrank my legend so all of it could be visible.
Hope this helps someone!
Take Care,
Rene

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

No branches or pull requests

3 participants