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

  • Home
  • SEARCH
  • 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 8951309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:38:00+00:00 2026-06-15T13:38:00+00:00

As the sketch map above, you can imagine the upper one is a plot

  • 0

enter image description here

As the sketch map above, you can imagine the upper one is a plot of parameter space, for example, the mean and variance for normal distribution, and the lower one is the corresponding density plot. Any hints for doing this? Thank you~

UPDATE: As an enhancement, can I build a interactive version for this? Say, whenever I mouse-over a point, R shows the corresponding plot beneath.

  • 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-15T13:38:02+00:00Added an answer on June 15, 2026 at 1:38 pm

    Here is an interactive version, you can click on a point and then corresponding density plot appears. Mainly used ?identify and as @Tyler suggested ?zoomInPlot.

    Some more details on how it works: rxlim and rylim defined at the very beginning is the size of rectangle which surrounds the selected point, so one might want to change the factor /20. Possibility of multiple clicks is nontrivial: identify() detects clicks only in the “recent” plot, i.e.

    par(mfrow = c(1,2))
    plot(1:10) # 1
    plot(1:10) # 2
    identifyPch(1:10)
    

    detects clicks only in the plot #2 (here identifyPch() is from ?identify). For this issue par(mfg=c(1, 1)) was used:

    mfg

    A numerical vector of the form c(i, j) where i and j indicate
    which figure in an array of figures is to be drawn next (if setting)
    or is being drawn (if enquiring). The array must already have been set
    by mfcol or mfrow.

    enter image description here

    zoom <- function (x, y, xlim, ylim, xd, yd) 
    {
      rxlim <- x + c(-1, 1) * (diff(range(xd))/20)
      rylim <- y + c(-1, 1) * (diff(range(yd))/20)
      par(mfrow = c(1, 2))
      plot(xd, yd, xlab = "mean", ylab = "sd")
      xext <- yext <- rxext <- ryext <- 0
      if (par("xaxs") == "r") {
        xext <- diff(xlim) * 0.04
        rxext <- diff(rxlim) * 0.04
      }
      if (par("yaxs") == "r") {
        yext <- diff(ylim) * 0.04
        ryext <- diff(rylim) * 0.04
      }
      rect(rxlim[1] - rxext, rylim[1] - ryext, rxlim[2] + rxext, 
           rylim[2] + ryext)
      xylim <- par("usr")
      xypin <- par("pin")
      rxi0 <- xypin[1] * (xylim[2] - (rxlim[1] - rxext))/diff(xylim[1:2])
      rxi1 <- xypin[1] * (xylim[2] - (rxlim[2] + rxext))/diff(xylim[1:2])
      y01i <- xypin[2] * (xylim[4] - (rylim[2] + ryext))/diff(xylim[3:4])
      y02i <- xypin[2] * ((rylim[1] - ryext) - xylim[3])/diff(xylim[3:4])
      mu <- x
      curve(dnorm(x, mean = mu, sd = y), from = -4 * y + mu, to = 4 * y + mu, 
            xlab = paste("mean:", round(mu, 2), ", sd: ", round(y, 2)), ylab = "")
      xypin <- par("pin")
      par(xpd = NA)
      xylim <- par("usr")
      xymai <- par("mai")
      x0 <- xylim[1] - diff(xylim[1:2]) * (xymai[2] + xymai[4] + 
                                             rxi0)/xypin[1]
      x1 <- xylim[1] - diff(xylim[1:2]) * (xymai[2] + xymai[4] + 
                                             rxi1)/xypin[1]
      y01 <- xylim[4] - diff(xylim[3:4]) * y01i/xypin[2]
      y02 <- xylim[3] + diff(xylim[3:4]) * y02i/xypin[2]
      par(xpd = TRUE)
      xend <- xylim[1] - diff(xylim[1:2]) * xymai[2]/(2 * xypin[1])
      xprop0 <- (xylim[1] - xend)/(xylim[1] - x0)
      xprop1 <- (xylim[2] - xend)/(xylim[2] - x1)
      par(xpd = NA)
      segments(c(x0, x0, x1, x1), 
               c(y01, y02, y01, y02), 
               c(xend, xend, xend, xend), 
               c(xylim[4] - (xylim[4] - y01) * xprop0, 
                 xylim[3] + (y02 - xylim[3]) * xprop0, 
                 xylim[4] - (xylim[4] - y01) * xprop1, 
                 xylim[3] + (y02 - xylim[3]) * xprop1))
      par(mfg = c(1, 1))
      plot(xd, yd, xlab = "mean", ylab = "sd")
    }
    
    ident <- function(x, y, ...)
    {
      ans <- identify(x, y, n = 1, plot = FALSE, ...)
      if(length(ans)) {
        zoom(x[ans], y[ans], range(x), range(y), x, y)
        points(x[ans], y[ans], pch = 19)
        ident(x, y)
      }
    }
    
    x <- rnorm(10)
    y <- rnorm(10, mean = 5)
    par(mfrow = c(1, 2))
    plot(x, y, xlab = "mean", ylab = "sd")
    ident(x, y)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple processing sketch (you can post the code and observe the
Users can sketch in my app using a very simple tool (move mouse while
Possible Duplicate: iPhone smooth sketch drawing algorithm I'm looking for an actual demonstrable example
In the Sketch example, in -[<NSCopying> copyWithZone:] is not checked if -[<NSObject> init] returns
Can someone explain how the Count Sketch Algorithm works? I still can't figure out
I'm afraid that I can't describe the problem so I draw a sketch of
Hey, I have a big problem with my container-sketch. How can I realize this
I have a sketch pad made in Flash AS3 like this one here: http://henryjones.us/articles/using-the-as3-jpeg-encoder
Let me sketch a scenario: A spec is handed to a developer who needs
How do you sketch out your iPhone App designs and ideas? I am currently

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.