이 아마 그것을 할 가장 우아한 방법이 아니다,하지만 당신은 plot
, points
및 axis
와 함께 사용하여 모든 것을 해결할 수 :
내 데이터는 다음과 같습니다 하나, 축에 레이블을 어떻게 바꿀 수 있는지 설명합니다) : ?axis
, ?plot
, ?points
.
먼저 당신 유사한 데이터 프레임을 내가 보여줄 수 ...
# make a data frame similar to yours
mydf <- data.frame(Name=LETTERS,
Up=sample.int(15,size=26,replace=T),
Down=-sample.int(15,size=26,replace=T))
이제 줄거리.
# set up a plot: x axis goes from 1 to 26,
# y limit goes from -15 to 15 (picked manually, you can work yours out
# programmatically)
# Disable plotting of axes (axes=FALSE)
# Put in some x and y labels and a plot title (see ?plot...)
plot(0,xlim=c(1,26),ylim=c(-15,15),type='n',
axes=FALSE, # don't draw axis -- we'll put it in later.
xlab='Name',ylab='Change', # x and y labels
main='Ups and Downs') #,frame.plot=T -- try if you like. ?plot.default
# Plot the 'Up' column in green (see ?points)
points(Up~Name,mydf,col='green')
# Plot the 'Down' column in red
points(Down~Name,mydf,col='red')
# ***Draw the x axis, with labels being A-Z
# (type in 'LETTERS' to the prompt to see what they are)
# see also ?axis
axis(1,at=1:26,labels=LETTERS)
# Draw the y axis
axis(2)
당신이 원하는대로 그것을 조정할 :
?points
및
?par
및
?axis
은이 점에서 특히 도움이됩니다.
[문서는 친구입니다. 읽어. 그것을 사랑해. 그것을 사용하십시오.] (http://stat.ethz.ch/R-manual/R-devel/library/graphics/html/plot.html) –
이 페이지를 읽었습니다 ... 문제는 제 xaxis가 텍스트라는 것입니다. .. – RnD
@ mathematical.coffe .i CSV 파일을 "nba"변수로 가져온 다음 plot (nba [, 1], nba [, 2]) ...을 입력하면 원하는 결과를 얻을 수 없습니다. – RnD