Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change plot title in R when the package already uses an existing title?

Tags:

graph

r

I am using an R package called mixer. I want to produce some plots using the package but with my own plot title. However the plots already have existing titles. I tried to set main = NULL and use the title command to reproduce the title. But it doesn't work.... below is an example:

 require("mixer")
 data(macaque)
 mixer(macaque,qmin=8)->xout
 plot(xout, frame = 3, main = "")
 title("Something else")

If you can let me know a general solution for changing plot title when a package already has an existing plot title, that would be great! Thank you!

like image 871
user2498497 Avatar asked Oct 08 '14 01:10

user2498497


1 Answers

Here is a really cheap trick.

require(mixer)
data(macaque)
mixer(macaque,qmin=8)->xout
par(col.main='white') # Switch the plot title colour to white.
plot(xout, frame = 3, main = "")
par(col.main='black') # Switch back to black.
title("Some title")

enter image description here

like image 176
nograpes Avatar answered Jan 15 '23 18:01

nograpes