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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:23:33+00:00 2026-05-27T02:23:33+00:00

Is it possible to annotate lattice (or ggplot2 ) figures with elements created with

  • 0

Is it possible to annotate lattice (or ggplot2) figures with elements created with polygon() (or elements created with a similar function) from the graphics library?

I’m not too familiar with either library beyond examples of simple graphs posted on the web and printed in Deepayan Sarkar’s book. Therefore, while I have code for what I’ve been doing in R with the graphics library, pointing me to relevant, equivalent functions and usage examples for lattice or ggplot2 specifically would be appreciated. Thanks.

  • 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-05-27T02:23:34+00:00Added an answer on May 27, 2026 at 2:23 am

    There are a series of methods that allow adding graphical objects to lattice plots. In the latticeExtra package there are layer and the “+” methods. In pkg:lattice itself, one can add to existing plots with trellis.focus(...) followed by panel calls such as panel.polygon(). I’ve used these in the past to annotate contourplot()s.

    If you do the example on help(contourplot) and then follow that by :

    trellis.focus("panel", 1, 1)
    do.call("panel.polygon", list(x =c(5,15,15,5,5), y=c(60,60,90,90,60) ) )
    trellis.unfocus()
    

    … you should see a rectangle with vertices c(5,60), c(15,60), c(15,90), c(5,90) has been placed in panel # 1 of the plot. Notice tha thte numbering is bsed on lower left as (1,1). I have generally not used the object-orientation to return a vlaue from that do.call(), but I suspect it would succeed.

    enter image description here

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

Sidebar

Related Questions

Is it possible to create a table (from a JPA annotated Hibernate @Entity )
Possible Duplicate: Why not use tables for layout in HTML? Under what conditions should
Possible Duplicate: How do you send email from a Java app using Gmail? How
Possible Duplicate: JavaScript: var functionName = function() {} vs function functionName() {} What's the
I tried to retrieve ordered list of elements from the database. From what I
Is it possible to annotate method to run code in UiThread? runOnUiThread(new Runnable() {
Is it possible (Java EE, JBoss 6) to cleverly annotate Java code to provide
Is it somehow possible to annotate a Java Method in that way that i
Given JPA annotated Entities, is it possible to generate (i.e. before runtime) the list
Possible Duplicate: NAnt or MSBuild, which one to choose and when? What is the

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.