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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:51:04+00:00 2026-05-16T16:51:04+00:00

In vanilla plotting, it is possible to use a polygon call in the panel.first

  • 0

In vanilla plotting, it is possible to use a polygon call in the panel.first argument to plot to highlight a background region. Is it possible to do the same in ggplot2? Can it be done while preserving the gridlines?

eg:

# plot hp and wt for mtcars data, highlighting region where hp/wt ratio < 35
with(mtcars,plot(hp,wt,
     panel.first=polygon(c(0,0,max(wt)*35),c(0,max(wt),max(wt)),
     col="#d8161688",border=NA)))
  • 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-16T16:51:04+00:00Added an answer on May 16, 2026 at 4:51 pm

    Yes, that’s possible with ggplot2. To preserve the visibility of grid lines you can use alpha transparency. Note that, in general, the order in which geoms and stats are applied matters.

    tmp <- with(mtcars, data.frame(x=c(0, 0, max(wt)*35), y=c(0, max(wt), max(wt))))
    ggplot(mtcars, aes(hp, wt)) + 
      geom_polygon(data=tmp, aes(x, y), fill="#d8161688") + 
      geom_point()
    

    ggplot2 output

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

Sidebar

Ask A Question

Stats

  • Questions 545k
  • Answers 545k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • added an answer Well, start off by thinking of which bits of data… May 17, 2026 at 9:17 am
  • added an answer For this task it is a good idea to use… May 17, 2026 at 9:15 am
  • added an answer This is exactly how the Skyhook database (built into many… May 17, 2026 at 9:15 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

If I use /clr:oldSyntax the following should work: public __value enum IceCreamFlavors { Vanilla,
I'm taking an vanilla WPF application and converting it to use the MVVM pattern.
I am trying to use vanilla forum with proxyconnect and it requires i give
Currently I have a custom tool which generates vanilla-SQL (only using standard SQL), from
My attempts to install modperl under the default vanilla Leopard Apache 2 have failed
An svn repository I'm mirroring through git-svn has changed URL. In vanilla svn you'd
I have a number of bash scripts which invoke R scripts for plotting things.
Using vanilla WPF (no MVVM framework like Prism). Let me say up front that
Plain-vanilla NHibernate setup, eg, no fluent NHibernate, no HQL, nothing except domain objects and
I have a vanilla Visual Studio 2005 Solution with a single C++ Project which

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.