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 9129569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:46:49+00:00 2026-06-17T07:46:49+00:00

I want to improvise my regression plot shade which is proportional to density. For

  • 0

I want to improvise my regression plot shade which is proportional to density. For example is the confidence interval is narrow the shade is dense while if confidence interval wide the fill color is light. The result graph might look like this:

enter image description here

Here is an working example:

set.seed(1234)
md <- c(seq(0.01, 1, 0.01), rev(seq(0.01, 1, 0.01)))
cv <-  c(rev(seq(0.01, 1, 0.01)), seq(0.01, 1, 0.01))
rv <- rnorm (length(md), 0.1, 0.05)

 df <- data.frame(x =1:length(md),  F = md*2.5 + rv, L =md*2.5 -rv-cv, U =md*2.5+ rv+ cv)
 plot(df$x, df$F, ylim = c(0,4), type = "l")

 polygon(c(df$x,rev(df$x)),c(df$L,rev(df$U)),col = "cadetblue", border = FALSE)
 lines(df$x, df$F, lwd = 2)
 #add red lines on borders of polygon
 lines(df$x, df$U, col="red",lty=2)
 lines(df$x, df$L, col="red",lty=2)
  • 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-17T07:46:51+00:00Added an answer on June 17, 2026 at 7:46 am

    The densregion() command in the denstrip package seems to do what you want. A little adaptation from the example in its help page:

    require(denstrip)
    x <- 1:10
    nx <- length(x)
    est <- seq(0, 1, length=nx)^3
    se <- seq(.7,1.3,length.out=nx)/qnorm(0.975)
    y <- seq(-3, 3, length=100)
    z <- matrix(nrow=nx, ncol=length(y))
    for(i in 1:nx) z[i,] <- dnorm(y, est[i], se[i])
    plot(x, type="n", ylim=c(-3, 3),xlab="")
    densregion(x, y, z)
    lines(x,est,col="white")
    

    enter image description here

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

Sidebar

Related Questions

Want to run javascript function from parent window in child window Example I have
I want to improve the performance of my app. One thing which comes to
We have a SQL Server 2005 database for which we want to improve performance
I want to improve my knowledge in module development (which is far away from
I want to improve a small framework, and therefore I want to get rid
I work on the JBJF Project on SourceForge and we want to improve on
This is my first post in stackoverflow. I want to improve its google pagerank
I am working on image processing library in c#. want to improve performance/speed and
I am teaching programming to my nephews and I want them to improve their
To improve performance of our MVC3 application we want to mark some Controller's to

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.