After some research I found the way to prevent an uninformative legend from displaying
... + opts(legend.position = "none")
Where can I find all the available "opts" for ggplot2?
After some research I found the way to prevent an uninformative legend from displaying
... + opts(legend.position = "none")
Where can I find all the available "opts" for ggplot2?
How about the source code? It is not that the author hides it from you...
Plus, CRAN packages have to have documentation for all user-visible functions and their arguments so there is that too. But here I do agree that help(opts)
does not get you very far.
All the options I've ever used have been explained in hadley's great ggplot2 book.
The ggplot2
package does not contain much reference information-- this is probably because Hadley has put a lot of work into developing and polishing the package, creating a website full of examples and writing an excellent book that describes the system in detail.
The first place I would look for answers would be the ggplot2
website:
However, since opts()
is not really a geom, stat or scale there are no examples that focus specifically on it. The next place to look would be the section of the website that contains material from the book-- including source code for examples:
http://had.co.nz/ggplot2/book/
The example code for the chapter "Polishing your plots for publication" contains some well commented examples of using set_theme()
and opts()
to alter plot appearance.
The ultimate source for information is of course the book it's self. If you find ggplot2
has simplified and streamlined your workflow for producing statistical graphics, buying a copy of the book is a great way to say "thank you" and support the further development of the package.
Update
After some further investigation, you may be able to find a relatively complete list of options by listing out the source of one of the "theme" functions such as theme_bw
. The source doesn't provide a description of the possible key=value
pairs, but it does at least show most of the key
names that have an effect when set via opts()
.