etykiety na oś obrotową w R

W R, Jak zrobić etykietę osi Y wykresu (bar)równolegle do osi X zamiast równolegle do osi Y?

Author: Zach, 2009-12-01

4 answers

Nie wiem, czy to masz na myśli, ale spróbuj ustawić las=1. Oto przykład:

require(grDevices)
tN <- table(Ni <- stats::rpois(100, lambda=5))
r <- barplot(tN, col=rainbow(20), las=1)

wyjście

, który reprezentuje styl etykiet osi. (0=równoległy, 1=wszystkie poziome, 2=wszystkie prostopadłe do osi, 3 = wszystkie pionowe)

 146
Author: Shane,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2016-10-23 19:06:49

Użyj par(las=1).

Zobacz ?par:

las
numeric in {0,1,2,3}; the style of axis labels.
0: always parallel to the axis [default],
1: always horizontal,
2: always perpendicular to the axis,
3: always vertical.
 82
Author: rcs,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2009-12-01 20:56:27

Jak wspomniał Maciej Jończyk, może być też konieczne zwiększenie marż

par(las=2)
par(mar=c(8,8,1,1)) # adjust as needed
plot(...)
 17
Author: fedorn,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2015-01-25 17:29:24

Musisz użyć funkcji theme () w następujący sposób obracając etykiety osi x o 60 stopni:

ggplot(...)+...+ theme(axis.text.x = element_text(angle=60, hjust=1))
 7
Author: MCH,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2016-12-16 15:40:08