{"id":502,"date":"2011-04-07T13:03:34","date_gmt":"2011-04-07T17:03:34","guid":{"rendered":"http:\/\/www.nomad.priv.at\/researchblog\/?p=502"},"modified":"2011-04-07T13:03:34","modified_gmt":"2011-04-07T17:03:34","slug":"unable-to-plot-a-decent-x-axis-in-a-time-series-plot-using-zoo","status":"publish","type":"post","link":"http:\/\/www.nomad.priv.at\/researchblog\/?p=502","title":{"rendered":"Unable to plot a decent x-Axis in a time series plot using zoo"},"content":{"rendered":"<p>I use the R package zoo to plot a yearly time series of weekly averaged data. The problem is that my date variable (m.all$date) contains week numbers and these are plotted as x-Axis. What I would rather like to to is plot abbreviated months.<\/p>\n<p>I can suppress the x-Axis in the plot using  <code>xaxt = \"n\"<\/code> in the <code>plot.zoo<\/code> command, but cannot define a suitable x-Axis that plot abbreviated months instead.<\/p>\n<p>I tried several variations of the <code>axis.Date()<\/code> commands without luck!<br \/>\n<code><br \/>\n# Create zoo object for time series plot<br \/>\nz < - zoo(cbind(m.all$obsTPM, m.all$modTPM, m.all$refTPM), m.all$date)\nnames(z) <- c(\"Observation\",\"Model estimate\", \"Model reference\")\n# Plot\nplot.zoo(z[, 1], type = \"l\", lwd = 1, col = \"black\", screens = c(1), xlab = \"Date (2005)\", ylim=c(m.all$obsTPM,m.all$modTPM, m.all$refTPM), ylab = \"Concentration (pg m-3)\", main = \"Alert TPM: Observations vs. Model Estimates, Weekly Means\")\nlines(z[, 2], lty = 5, lwd = 1, col = \"blue\")\nlines(z[, 3], lty = 3, lwd = 1, col = \"red\")\nlegend(\"topleft\", lty = c(1,5,3), legend = colnames(z), bty = \"n\", col = c(\"black\",\"blue\",\"red\"), lwd = 1)\n<\/code><\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I use the R package zoo to plot a yearly time series of weekly averaged data. The problem is that my date variable (m.all$date) contains week numbers and these are plotted as x-Axis. What I would rather like to to is plot abbreviated months. I can suppress the x-Axis in the plot using xaxt = &hellip; <a href=\"http:\/\/www.nomad.priv.at\/researchblog\/?p=502\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Unable to plot a decent x-Axis in a time series plot using zoo<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,4],"tags":[79,277,511,317],"class_list":["post-502","post","type-post","status-publish","format-standard","hentry","category-r","category-research","tag-code","tag-plot","tag-r","tag-series"],"_links":{"self":[{"href":"http:\/\/www.nomad.priv.at\/researchblog\/index.php?rest_route=\/wp\/v2\/posts\/502","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.nomad.priv.at\/researchblog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.nomad.priv.at\/researchblog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.nomad.priv.at\/researchblog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.nomad.priv.at\/researchblog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=502"}],"version-history":[{"count":0,"href":"http:\/\/www.nomad.priv.at\/researchblog\/index.php?rest_route=\/wp\/v2\/posts\/502\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.nomad.priv.at\/researchblog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=502"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.nomad.priv.at\/researchblog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=502"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.nomad.priv.at\/researchblog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=502"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}