Reputation: 8172
I have tried this
#!/usr/bin/R
fcm <-c(13.0,12.5,11.8)
gk <-c(10.9 , 10.5 , 10.2)
gg <-c(12.0 , 11.0 , 10.8)
data1 <- rbind(fcm,gk,gg)
colnames(data1) <- c(5,6,7)
barplot(as.matrix(data1),ylim=c(0,15),main="P wave",
xlab="number of clusters",ylab="traveltime rms(ms)",
col=c("red", "black", "green"), beside=TRUE)
op <- par(cex=.64)
legend(legend = c("fcm","gk","gg"), fill = c( "red", "black", "green"),
"top", horiz=TRUE,text.font=3)
par(op)
dev.copy(png,"s1.png",width=4,height=4,units="in",res=200)
dev.off()
When image appears,R graphics device 2 Active looks fine.But save image has overlapping of words in legend.
How to solve this?
Upvotes: 0
Views: 2858
Reputation: 24074
Instead of using dev.copy
to save your image, you can call png
before "drawing" it :
png("Z:/GES - catalogue signatures/biblio/cdf pour Wolf/s1.png", width=4,height=4,units="in",res=200)
barplot(as.matrix(data1),ylim=c(0,15),main="P wave",
xlab="number of clusters",ylab="traveltime rms(ms)",
col=c("red", "black", "green"), beside=TRUE)
op <- par(cex=.64)
legend(legend = c("fcm","gk","gg"), fill = c( "red", "black", "green"),
"top", horiz=TRUE,text.font=3)
par(op)
dev.off()
Upvotes: 4