我已阅读有关如何在图表标题中创建斜体字的帖子,但它似乎对我不起作用。
#create a list of species
sp <- c("Etelis coruscans","Etelis carbunculus","Pristipomoides sieboldii","Pristipomoides filamentosus","Pristipomoides zonatus","Epinephelus quernus","Aphareus rutilans")
#plot hisotgrams for each spp in 1cm bins
for (i in sp){
BIN_WIDTH <- 1 #desired bin width
print(histogram(~ Length..cm. | Method, #create and print the histogram and save to variable "graph"
data = hist.data[hist.data$Scientific_name == i,],
nint = (max(hist.data$Length..cm.) - min(hist.data$Length..cm.)+1)/BIN_WIDTH,
layout = c(1,2),
main = paste("Length-Frequency of", italic(i), "by Gear"), sep = " ",
xlab = "Length (cm)"))
#save histogram to PNG file
quartz.save(paste("*Length-Frequency of", i, "by method.png", sep = " "), type = "png")
dev.off() #close the graphics diver
}
我收到一条错误消息:
Error in print(histogram(~Length..cm. | Method, data = hist.data[hist.data$Scientific_name == :
error in evaluating the argument 'x' in selecting a method for function 'print': Error in paste(italic("Length-Frequency of", i, "by Gear")) :
could not find function "italic"
有人可以指出我做错了什么吗?