2017-03-08 10 views
0

LSD 패키지의 R 부분에서 열 산란으로 작업하고 있으며 본질적으로 플롯을 더 멋지게 보이려고합니다. 지금 x 축은 myData $ Date1을 플로팅 (plot)을위한 벡터로 변경해야했기 때문에 임의의 날짜 값을 읽습니다 (아래 이미지 참조).히트 스코핑 플롯 (LSD 패키지) x 축 설정 R

4 월, 5 월, 6 월, 7 월, 8 월, 9 월이라고 어떻게 xaxis를 변경할 수 있습니까?

플롯의 글꼴을 Times New Roman 또는 ggplot의 theme_tufte()로 변경하는 방법이 있습니까?

히트 스코터 대신 ggplot에 유사한 플롯을 만들면 내 문제를 해결할 수있는 또 다른 방법이 될 수 있습니다. 나는 ggplot에 정통합니다.

Current heatscatter plot

이 내가 L8 날짜가 하루에 플롯을 만드는 데 사용되는 코드는 (00) 월 (00) 년 (2015)

l8.dates <-c('04062015','04222015','05082015','05242015','06092015','06252015', 
       '07112015','07272015','08122015','08282015','09132015','09292015') 
myDate = sample(l8.dates,1000,replace= TRUE) 
NDVI2 = sample(seq(0,1, by =0.0001),1000,replace = T) 
myData = data.frame(Date1 = myDate, 
       NDVI2 = NDVI2) 

myData$Date1 = as.Date(myData$Date1,"%m%d%Y") 

heatscatter(as.vector(myData$Date1),as.vector(myData$NDVI2),      
       colpal="bl2gr2rd",ylim= c(-1,1), frame.plot=FALSE, xlab= "", ylab="NDVI") 

답변

0

어쩌면

par(family="serif") 
heatscatter(as.vector(myData$Date1),as.vector(myData$NDVI2), 
      xaxt="n", # omit axis (x-axis-type 'none') 
      colpal="bl2gr2rd",ylim= c(-1,1), frame.plot=FALSE, xlab= "", ylab="NDVI") 
breaks <- pretty(myData$Date1) 
axis(1, at = breaks, labels = format(breaks, "%b")) # set axis manually afterwards 
시도

windowsFonts() 
# $serif 
# [1] "TT Times New Roman" 
# 
# $sans 
# [1] "TT Arial" 
# 
# $mono 
# [1] "TT Courier New" 

주는

enter image description here