2

私はこれに取り組んでおりpairs()、凡例を追加したり、ファントム表記法を使用してタイトルの種の色を変更してポイントに関連付けたりしようとして、恥ずかしいほど長い時間を費やしています...どんな洞察も大歓迎です! これは問題です。

# original code
pairs(iris[1:4], 
  main = "Width and Length (cm) of Iris's Petals and Sepals: Setosa, Veriscolor, Virginica", 
  pch = 24, bg = c("mediumorchid4", "mediumpurple1", "lightpink1")[unclass(iris$Species)], 
  upper.panel=NULL, labels=c("Sepal Length","Sepal Width","Petal Length","Petal Width"), 
  font.labels=1, cex.labels=2)
4

1 に答える 1

5

(あまり良くない)受け入れられた答えがなくなった場合に備えて、これはより良い代替手段です:

pairs(iris[1:4], 
  main = "Width and Length (cm) of Iris's Petals and Sepals: Setosa, Veriscolor, Virginica", 
  pch = 24, bg = c("mediumorchid4", "mediumpurple1", "lightpink1")[unclass(iris$Species)], 
  upper.panel=NULL, labels=c("Sepal Length","Sepal Width","Petal Length","Petal Width"), 
  font.labels=1, cex.labels=2)

legend(x = "topright",legend = levels(iris$Species),
        pch = 24,pt.bg = c("mediumorchid4", "mediumpurple1", "lightpink1"),
        inset = 0.1)

locatorJosh が提案したように使用するのではなく、 inset.

于 2013-10-14T21:44:08.373 に答える