1

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!

Jagra
  • 14,343
  • 1
  • 39
  • 81
  • 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. – J_Nat Aug 04 '16 at 14:54
  • Or try something like this under VertexRenderingFunction: http://mathematica.stackexchange.com/questions/15250/automatically-wrap-abritrary-length-text-in-graphics – J_Nat Aug 04 '16 at 15:18

1 Answers1

3

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

halmir
  • 15,082
  • 37
  • 53
  • 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! – Gilmar Rodriguez Pierluissi Aug 05 '16 at 17:40