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

Adding a title name in a plot is not working #10

Closed
yujung-c opened this issue Aug 1, 2024 · 2 comments
Closed

Adding a title name in a plot is not working #10

yujung-c opened this issue Aug 1, 2024 · 2 comments

Comments

@yujung-c
Copy link

yujung-c commented Aug 1, 2024

Hi, recently I have updated this package.
Everything works fine. But, title() doesn't work in plotting process.
I had used title() for adding a title in a Venn diagram in the previous version of venndir(). But, now doesn't work.
How can I add title in the Venn diagram based on the Jamba tool?

library(venndir)
main='title'
venndir(make_venn_test(100, 2, do_signed=TRUE),
              proportional=TRUE, do_plot = T,
              overlap_type="each", font_cex=1.2)
title(main)

It shows this error message.
Error in title(main = main) : plot.new has not been called yet

I appreciate for your helps and thank for your recent update :) .

@jmw86069
Copy link
Owner

jmw86069 commented Aug 1, 2024

Thank you for posting, this is a great point. I need to add the option for a title to venndir() and render_venndir().

Currently the best way to add a title is with grid functions like this:

library(venndir)
main = "Venn Title"
venndir(make_venn_test(50, 3))
grid::grid.text(x=0.5, y=0.9,
   label=main,
   gp=grid::gpar(fontsize=18, fontface="bold"))

I added the fontsize and fontface to show how to customize these values.

One reason to add the title to venndir() is so the title will be drawn for each plot, if the plot is used in a multi-panel figure. I will add it to my short list. For now, hopefully grid::grid.text() will suit your needs.

@jmw86069
Copy link
Owner

Just to close this out, there is now a main argument in venndir() used to set the plot title.
To use a custom title, use the steps above to add grid::grid.text() to the plot device afterwards.

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

2 participants