Ich habe eine data.frame, das heißt von der höchsten zur niedrigsten sortiert. Zum Beispiel:ggplot2: Sortieren einer Handlung
x <- structure(list(variable = structure(c(10L, 6L, 3L, 4L, 2L, 8L,
9L, 5L, 1L, 7L), .Label = c("a", "b", "c", "d", "e", "f", "g",
"h", "i", "j"), class = c("ordered", "factor")), value = c(0.990683229813665,
0.975155279503106, 0.928571428571429, 0.807453416149068, 0.717391304347826,
0.388198757763975, 0.357142857142857, 0.201863354037267, 0.173913043478261,
0.0496894409937888)), .Names = c("variable", "value"), row.names = c(10L,
6L, 3L, 4L, 2L, 8L, 9L, 5L, 1L, 7L), class = "data.frame")
ggplot(x, aes(x=variable,y=value)) + geom_bar() +
scale_y_continuous("",formatter="percent") + coord_flip()
Jetzt sind die Daten schön und sortiert, aber wenn ich plotte, kommt es sortiert nach Faktor. Es ist nervig, wie repariere ich es?
Mit R Version 3.2.2 bekomme ich einen Fehler: 'scale_y_continuous (" ", formatter =" percent "): unbenutztes Argument (formatter =" percent ")' – Iris
Ja, ich glaube an seine 'scale_y_continuos (labels = percent) 'und Sie müssen auch das Paket' scales' laden. –
Dann habe ich einen neuen Fehler 'Fehler: stat_count() darf nicht mit einem y aesthetic.' – Iris