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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:12:22+00:00 2026-06-16T05:12:22+00:00

I would like to create a triangle plot with organization structure (hierarchy) showing the

  • 0

I would like to create a triangle plot with organization structure (hierarchy) showing the number of employees at each level in different companies.

Here is some example data:

mylabd <- data.frame (company = rep(c("A", "B", "C"), each = 7),
skillsDg = rep(c("Basic", "HighSc", "Undgd", "MAST", "PHD", "EXPD", "EXECT"), 3),
number = c(200, 100, 40, 30, 10, 0, 0,
           220, 110, 35, 10, 0, 4, 1,
           140, 80, 120, 50, 52, 52, 3)
           )
   company skillsDg number
1        A    Basic    200
2        A   HighSc    100
3        A    Undgd     40
4        A     MAST     30
5        A      PHD     10
6        A     EXPD      0
7        A    EXECT      0
8        B    Basic    220
9        B   HighSc    110
10       B    Undgd     35
11       B     MAST     10
12       B      PHD      0
13       B     EXPD      4
14       B    EXECT      1
15       C    Basic    140
16       C   HighSc     80
17       C    Undgd    120
18       C     MAST     50
19       C      PHD     52
20       C     EXPD     52
21       C    EXECT      3

The objective is to reflect how different companies hire different skilled or degree workers.

The hypothetical figure is this (although color fill is not perfect).
enter image description here
The idea is that the width of line at each stage is proportional and then lines are connected. If there is no category in subsequent level, it will not be connected (like in company B). I couldn’t find a program that can do this and neither could figure out. Any idea ?

Edit:

I do not alot about R, but here is my how my idea is shaping. It divides each line segment into two from a point to make it symetical. The drawn horizontal lines are then connected.

enter image description here

  • 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-16T05:12:23+00:00Added an answer on June 16, 2026 at 5:12 am

    I don’t know of any function doing that but here is one from scratch:

    my1 <- data.frame (company = rep(c("A", "B", "C"), each = 7), skillsDg = rep(c("Basic", "HighSc", "Undgd", "MAST", "PHD", "EXPD", "EXECT"), 3), number = c(200, 100, 40, 30, 10, 0, 0, 220, 110, 35, 10, 0, 4, 1, 140, 80, 120, 50, 52, 52, 3) )
    
    my2 <- split(my1,my1$company) #split your dataframe into a list where each element is a company
    # The next line create the layout
    layout(matrix(1:(length(my2)+1), nrow=1), width=c(1,rep(4,length(my2))))
    # Then we draw the x-axis:
    par(mar=c(3,0,3,0))
    plot(NA,axes=F, xlim=c(0,1),ylim=c(1,nlevels(my1$skillsDg)))
    axis(side=4,tick=F,labels=unique(my1$skillsDg),
         at=seq_along(unique(my1$skillsDg)), las=2, line=-4)
    # Then we apply a graphing function to each company:
    lapply(my2,function(x){
        par(mar=c(3,0,3,0))
        plot(NA, xlim=c(-max(my1$number),max(my1$number)), 
                 ylim=c(1,nlevels(my1$skillsDg)),axes=F)
        title(sub=x$company[1],line=1)
        abline(h=seq_along(x$skillsDg), col="grey80")
        polygon(x=c(x$number,rev(-1*x$number)), 
                y=c(seq_along(x$skillsDg),rev(seq_along(x$skillsDg))), 
                col=as.numeric(x$company))
        })
    

    enter image description here

    Edit:
    You can of course add whatever you want inside the graphing function in lapply (but in some case it might mean changing a little the dimensions of the graph):

    layout(matrix(1:(length(my2)+1), nrow=1), width=c(1,rep(4,length(my2))))
    par(mar=c(3,0,3,0))
    plot(NA,axes=F, xlim=c(0,1),ylim=c(1,nlevels(my1$skillsDg)))
    axis(side=4,tick=F,labels=unique(my1$skillsDg),
        at=seq_along(unique(my1$skillsDg)), las=2, line=-4)
    lapply(my2,function(x){
        par(mar=c(3,0,3,0))
        plot(NA, xlim=c(-max(my1$number)-50,max(my1$number)+50), 
            ylim=c(1,nlevels(my1$skillsDg)),axes=F)
        title(sub=x$company[1],line=1)
        abline(h=seq_along(x$skillsDg), col="grey80")
        text(x=x$number+5, y=seq_along(x$skillsDg)+.1, label=x$number, pos=4)
        polygon(x=c(x$number,rev(-1*x$number)), 
            y=c(seq_along(x$skillsDg),rev(seq_along(x$skillsDg))), 
            col=as.numeric(x$company))
        })
    

    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 would like create a array of structure which have a dynamic array :
I would like to create a hierarchy of exceptions. I used the C++ idiom
I would like to create a triangle and take user input from the user.
I would like to create this shape using just css. I am pretty sure
I would like to create a c++ type that mimic the build-in type exactly.
I would like to create a json object to send as a post array,
I would like to create set of strings and below is the only limitation.
I would like to create a class that runs something (a runnable) at regular
I would like to create a virtual host in apache2, but I want it
I would like to create and hold on to an iterator_range. The range is

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.