1
$\begingroup$

I start with a list of occupation titles:

OccTitlerules = {"Carpenters" -> "Sheet Metal Workers", "Cement Masons and Concrete Finishers" -> "Carpenters", "Construction Laborers" -> "Helpers--Carpenters", "Construction Managers" -> "Cost Estimators", "Cost Estimators" -> "Construction Managers", "Electricians" -> "Heating, Air Conditioning, and Refrigeration Mechanics and Installers", "Fence Erectors" -> "Helpers--Brickmasons, Blockmasons, Stonemasons, and Tile and Marble Setters", "First-Line Supervisors of Construction Trades and Extraction Workers" -> "First-Line Supervisors of Mechanics, Installers, and Repairers", "First-Line Supervisors of Mechanics, Installers, and Repairers" -> "First-Line Supervisors of Construction Trades and Extraction Workers", "Heating, Air Conditioning, and Refrigeration Mechanics and Installers" -> "Electricians", "Helpers--Brickmasons, Blockmasons, Stonemasons, and Tile and Marble Setters" -> "Cement Masons and Concrete Finishers", "Helpers--Carpenters" -> "Construction Laborers", "Helpers--Electricians" -> "Helpers--Carpenters", "Helpers--Pipelayers, Plumbers, Pipefitters, and Steamfitters" -> "Construction Laborers", "Insulation Workers, Mechanical" -> "Roofers", "Plumbers, Pipefitters, and Steamfitters" -> "Electricians", "Roofers" -> "Insulation Workers, Mechanical", "Sheet Metal Workers" -> "Carpenters"}; 

Then I build the following Layered Graph Plot:

LayeredGraphPlot[OccTitlerules, Bottom, VertexLabeling -> True, BaseStyle -> {FontSize -> 12}, ImageSize -> 2600, AspectRatio -> 1/2] 

Notice that I have to use a large ImageSize value because; otherwise, some of the labels contained in the text boxes will overlap. Unfortunately; doing this makes the plot so large that I'm unable to print it in regular 8.5" X 11" paper.

I cannot abbreviate the job titles because they are specific are necessary.

My question is; is there a way to "wrap" the text so that the longest job titles are better disbursed inside their text boxes?

For example; the job title:

"Air Conditioning, and Refrigeration Mechanics and Installers"

with text wrapping applied to it becomes:

"Air Conditioning, and Refrigeration

Mechanics and Installers"

Thank you!

$\endgroup$
2
  • $\begingroup$ you could use \n where you want your text to go to the next line, so "Air Conditioning, and Refrigeration \nMechanics and Installers" would give you the desired output. $\endgroup$ Commented Aug 4, 2016 at 14:54
  • $\begingroup$ Or try something like this under VertexRenderingFunction: mathematica.stackexchange.com/questions/15250/… $\endgroup$ Commented Aug 4, 2016 at 15:18

1 Answer 1

3
$\begingroup$

You could add Pane around your text:

LayeredGraphPlot[ Map[Pane[Tooltip[#, #], ImageSize -> {65, 30}, ImageSizeAction -> "ShrinkToFit"] &, OccTitlerules, {2}], Bottom, VertexLabeling -> True, BaseStyle -> {FontSize -> 12, Bold}, AspectRatio -> 1/2, ImageSize -> 900] 

enter image description here

$\endgroup$
1
  • $\begingroup$ It is a pity that the text entries get so distorted inside the boxes but, beggars can't be choosers! This will give me something extra "to fiddle about with" until I reach what I need. THANK YOU! $\endgroup$ Commented Aug 5, 2016 at 17:40

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.