I am working with heatscatter in R part of the LSD package and I am essentially trying to make my plot look nicer. Right now the x-axis read a bunch of random date values because I had to change myData$Date1 to a vector for plotting (see image below).
How can I change the xaxis to say Apr, May, Jun, Jul, Aug, Sep?
Is there also a way to change the font of the plot to Times New Roman or theme_tufte() like in ggplot?
If someone can create a similar plot in ggplot instead of heatscatter that would be another way of solving my issue as I am much more well versed in ggplot.
This is the code I used to make the plot l8 dates are in day(00)month(00)year(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")
Maybe try
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
with
windowsFonts()
# $serif
# [1] "TT Times New Roman"
#
# $sans
# [1] "TT Arial"
#
# $mono
# [1] "TT Courier New"
giving