Name UP Downs
A 10 -3
B 2 -4
C 1 -1
D 4 -1
E 5 0
F 0 -1
G 6 -5
H 0 -1
I 7 -1
J 0 -1
K 0 -11
L 3 -1
M 0 -13
N 2 -1
O 0 -1
P 1 -1
Q 0 0
R 1 -1
S 0 0
T 12 -1
.....
.........
..........
(goes all the way to 2500 rows)
Here is what my R code looks like…
nba <- read.csv("test.csv")
plot(nba$UP, type="b", lwd=1, xaxt="n", ylim=c(-22, 22), col="red", xlab="Name",
ylab="Change", main="My plot")
axis(1, at=1:length(nba$Name), labels=nba$Name)
lines(rain$Downs, col="green", type="b", lwd=1)
This code works well…but the xaxis when plotted shows few selected “Name” and not all of them. The question is …Is there a way to show all the text in the xaxis (either vertical with smaller font) and is there a way when i save the file as an image…i can zoom in and view the xaxis labels.
You may find it easier to analyse your plot if you are more selective about what it is you really want to plot and label.
For example, one strategy in labelling plots with many observations is to label only the outliers. Here is an example of how you might go about labelling only the highest and lowest scores in your data.
Create some sample data and plot.
Find the 10 highest and lowest values and use
textto add the label: