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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T21:47:45+00:00 2026-05-19T21:47:45+00:00

I’m a bit lost on this one, I’ve tried messing around with geom_polygon but

  • 0

I’m a bit lost on this one, I’ve tried messing around with geom_polygon but successive attempts seem worse than the previous.

The image that I’m trying to recreate is this, the colours are unimportant, but the positions are:

enter image description here

In addition to creating this, I also need to be able to label each element with text.

At this point, I’m not expecting a solution (although that would be ideal) but pointers or similar examples would be immensely helpful.

One option that I played with was hacking scale_shape and using 1,1 as coords. But was stuck with being able to add labels.

The reason I’m doing this with ggplot, is because I’m generating scorecards on a company by company basis. This is only one plot in a 4 x 10 grid of other plots (using pushViewport)

Note: The top tier of the pyramid could also be a rectangle of similar size.

Full Disclosure: This was also posted to the ggplot2 mailing list. (I’ll update if I receive a response)

  • 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-19T21:47:45+00:00Added an answer on May 19, 2026 at 9:47 pm

    It seems like you could use a combination of geom_path() and geom_segment() since you either know or can reasonably guesstimate the coordinate locations for each major point on your graph/chart/thingamajigger up there. Maybe something like this would work? The data.frame that was constructed contains the outline of the shape above (I opted for the rectangle at the top…I’m sure you could find an easy way to generate the points to approximate a circle if you really wanted. Then use geom_segment() to divvy up that large shape as you need.

    df <- data.frame(
        x = c(-8,-4,4,8,-8, -8, -8, 8, 8, -8)
        , y = c(0,18,18,0,0, 18, 22, 22, 18, 18)
        , group = c(rep(1,5), rep(2,5)))
        
    qplot(x,y, data = df, geom = "path", group = group)+
        geom_segment(aes(x = 0, y = 0, xend = 0, yend = 12 )) +
        geom_segment(aes(x = -6.75, y = 6, xend = 6.75, yend = 6)) +
        geom_segment(aes(x = -5.25, y = 12, xend = 5.25, yend = 12)) +
        geom_segment(aes(x = -2, y = 12, xend = -2, yend = 18)) + 
        geom_segment(aes(x = 2, y = 12, xend = 2, yend = 18)) + 
        geom_text(aes(x = -5, y = 2.5), label = "hi world")
    

    Edit: qplot() was deprecated in ggplot2 3.4.0. Here is the same code using ggplot aes:

    ggplot(data = df,aes(x, y, group = group)) +
      geom_path() +
      geom_segment(aes(x = 0, y = 0, xend = 0, yend = 12 )) +
      geom_segment(aes(x = -6.75, y = 6, xend = 6.75, yend = 6)) +
      geom_segment(aes(x = -5.25, y = 12, xend = 5.25, yend = 12)) +
      geom_segment(aes(x = -2, y = 12, xend = -2, yend = 18)) + 
      geom_segment(aes(x = 2, y = 12, xend = 2, yend = 18)) + 
      geom_text(aes(x = -5, y = 2.5), label = "hi world")
    

    enter image description here

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

Sidebar

Related Questions

I need to clean up various Word 'smart' characters in user input, including but
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
i want to parse a xhtml file and display in UITableView. what is the
public static bool CheckLogin(string Username, string Password, bool AutoLogin) { bool LoginSuccessful; // Trim

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.