user2498497
user2498497

Reputation: 703

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

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!

Upvotes: 8

Views: 2415

Answers (1)

nograpes
nograpes

Reputation: 18323

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

Upvotes: 14

Related Questions