Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Using the <strong>grid</strong> package, we can have someting like this:</p> <p><img src="https://i.stack.imgur.com/HaAHg.png" alt="enter image description here"></p> <pre><code>mylabd &lt;- 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) ) ## to comapre we need o have the same scales for all organizations nskills &lt;- nlevels(mylabd$skillsDg) ncompany &lt;- nlevels(mylabd$company) barYscale &lt;- c(0, nskills) * 1.05 barXscale &lt;- c(0, max(mylabd$number) )* 1.05 ## the global scene vp &lt;- plotViewport(c(5, 4, 4, 1), yscale = barYscale, layout = grid.layout(nrow=1,ncol=nbars)) pushViewport(vp) grid.rect() grid.yaxis(at=c(1:nlevels(mylabd$skillsDg)),label=unique(mylabd$skillsDg)) grid.grill() ## split data by companya data.splitted &lt;- split(mylabd,f=mylabd$company) lapply(1:3,function(company){ x &lt;- data.splitted[[company]] vv &lt;- x$number companyName &lt;- unique(x$company) pushViewport(viewport(layout.pos.col=company, xscale = barXscale, yscale = barYscale)) grid.rect() # grid.xaxis(at= mean(x$number),label = companyName) grid.xaxis() grid.polygon(x = unit.c(unit(0.5,'npc')-unit(vv/2,'native'), unit(0.5,'npc')+unit(rev(vv)/2,'native')), y = unit.c(unit(1:nmeasures,'native'), unit(rev(1:nmeasures),'native')), gp=gpar(fill = rainbow(nmeasures)[company])) grid.polygon(x = unit.c(unit(0.5,'npc')-unit(vv/2,'native'), unit(0.5,'npc')+unit(rev(vv)/2,'native')), y = unit.c(unit(1:nmeasures,'native'), unit(rev(1:nmeasures),'native')), id = c(1:nmeasures,rev(1:nmeasures)), gp=gpar(fill = NA)) grid.text( x = unit(0.5,'npc'), y = unit(0.5,'native'), label = unique(x$company)) popViewport() }) popViewport() </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload