Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8988109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:56:51+00:00 2026-06-15T21:56:51+00:00

This may or may not be a very simplistic question. But I am trying

  • 0

This may or may not be a very simplistic question. But I am trying to alter the acf plot produced in R and am having no luck. I would like to change the way that the acf looks i.e. change from the basic plot. The figure displays the normal acf produced by R on the left and the acf I would like on the right, is there a way of changing this? enter image description here

I have tried typing ‘changing acf plot in R’ into various search engines but cannot find a suitable solution. So far I have stored the acf output:

a <- acf(blah)
xyplot(acf~lag,data=a,type = "l")

This returns a lineplot of the acf, but does not retain the 95% confidence interval. Does anyone have any suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T21:56:52+00:00Added an answer on June 15, 2026 at 9:56 pm

    I can get something similar to the plot you want by using ggplot2. I’ve used the ldeaths table for an example here. The crucial point is probably extracting the values from the acf object into a data.frame. From there you can pretty much plot whatever you want with it.

    library(ggplot2)
    
    # compute acf without plotting
    acz <- acf(ldeaths, plot=F)
    
    # 95% confidence interval limits
    ci <- qnorm((1 + 0.95)/2)/sqrt(sum(!is.na(series)))  
    
    # convert to data frame
    acd <- data.frame(lag=acz$lag, acf=acz$acf)
    
    # use data frame for ggplot
    ggplot(acd, aes(lag, acf)) + geom_area(fill="grey") +
        geom_hline(yintercept=c(ci, -ci), linetype="dashed") +
        theme_bw()
    

    enter image description here

    You can familiarise yourself with ggplot2 by looking over the documentation here. This will help you customize the plot further.

    The confidence interval is not exported by the acf function – this calculation is done inside the plot.acf function. So when drawing the ACF with ggplot, you need to compute the CI bounds yourself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This may or may not be a very simple question, but I would like
This may be a very basic question. But it is not very clear to
This may be very simplistic question but I can't find the answer. I want
This may or may not be a very trivial question, but then again, I'm
This may be a basic question but I'm not very proficient in SQL Server.
This may be a silly question, but googling that is not very effective. And
This may not be a programming question, but I don't know where to ask
This may not be the kind of question one should ask on StackOverflow, but
Sorry, this may or may not be a programming question directly, but I am
I fear this just may not be possible, but I'm trying to create a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.