I want reverse the x axis two times. Now I have simply reverse the range of x axis and my result is 3, 2, 1, 0 instead of 0, 1, 2, 3.
My code:
temp2 = table(mFT$Vorschlaege, mFT$Bewertung)
barplot(temp2 , main="10 Vorschläge pro Methode", xlab="Bewertung", beside=TRUE, ylim = c(0,40), xlim= c(43,3), col = colours10)
legend("top", legend = rownames(temp2), fill = colours10)
Assuming mFT$Vorschlaege
is a factor you can reverse the order of the factor levels.Try:
mFT$Vorschlaege2 <- factor(mFT$Vorschlaege,levels = levels(mFT$Vorschlaege)[10:1])
This reverses the order of your factor levels. If mFT$Vorschlaege
is not a factor you'll have to turn it into a factor first. I renamed the variable mFT$Vorschlaege2
to avoid overwriting your original variable so you'll have to repeat the table
command with the new variable.
temp2 = table(mFT$Vorschlaege2, mFT$Bewertung)
barplot(temp2 , main="10 Vorschläge pro Methode", xlab="Bewertung", beside=TRUE, ylim = c(0,40), xlim= c(43,3), col = colours10)
legend("top", legend = rownames(temp2), fill = colours10)
Without a reproducible example I cannot test this solution but it works with my own data.