MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: PairedBarChart "Education and Training pay..."

  • To: mathgroup at smc.vnet.net
  • Subject: [mg123942] Re: PairedBarChart "Education and Training pay..."
  • From: Tomas Garza <tgarza10 at msn.com>
  • Date: Sun, 1 Jan 2012 02:27:43 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201112301204.HAA08352@smc.vnet.net>

Hi,
Sometimes it pays to try direct lower-level programming instead of using the ready-made graphics, especially when you come to charts. This allows for more freedom in choosing precisely what you need. Maybe it looks more laborious, but in the end it is rather straightforward (at least you can understand what you're doing). I tried my hand with your example, and produced the following, which seems to work fine:
labels = Reverse@{"Some high school,\nno diploma",     "High school graduate", "Some college,\nno degree",     "Associate degree", "Bachelor's degree", "Master's degree",     "Professional degree", "Doctoral degree"};
rates = -Reverse at {1.9, 2.4, 4.0, 5.4, 7.0, 9.2, 10.3, 14.9};
vmin = Table[i, {i, 0, 7}];
hor = Partition[Riffle[rates, vmin], 2];
earns = Table[    3.8, {8}] + {80600, 83720, 66144, 53976, 39884, 37024, 32552,      23088}/5000.;
horearns = Partition[Riffle[Reverse@earns, vmin], 2];
verts = Table[i, {i, 0.5, 9.5, 1}];
mx = Partition[Riffle[Table[0, {9}], verts], 2];
mxearns = Partition[Riffle[Table[7.6, {9}], verts], 2];
minmx = Partition[Riffle[hor, mx], 2];
minmxearns = Partition[Riffle[horearns, mxearns], 2];
Graphics[{{Pink, Rectangle[Sequence @@ #]} & /@    minmx, {Green, Rectangle[Sequence @@ #]} & /@    minmxearns, {Opacity[0.5],    Line[{{0, -0.1}, {0, 7.6}}]}, {Opacity[0.5],    Line[{{7.6, -0.1}, {7.6, 7.6}}]},   Inset[Style[    Grid[List /@ labels,      Spacings -> {0.5, {2.0, 2.1, 2.1, 2.1, 1.9, 1.5, 1.4, 1.1}}], 8,   "Label"], {3.7, 3.5}],   Table[Text[Reverse[labelsrates][[j]], hor[[j]], {1.2, -1}], {j, 1,     Length[hor]}],   Table[Text[Reverse[labelsearnings][[j]],     horearns[[j]], {-1.2, -1}], {j, 1, Length[hor]}]},  PlotRange -> {{-17.5, 23}, {-1, 9}}, ImageSize -> 500,  AspectRatio -> 0.5]
Hope this helps,
-Tomas

> Date: Fri, 30 Dec 2011 07:04:57 -0500
> From: peacenova at yahoo.com
> Subject: PairedBarChart "Education and Training pay..."
> To: mathgroup at smc.vnet.net
>
> Dear MathGroup:
>
> I'm attempting to build a chart similar to the one appearing on the
> following web page: http://www.bls.gov/emp/ep_chart_001.htm
>
> The following is what I have done far:
>
> doctoralrate = {0, 1.9}; doctoralearning = {0, 80600};
> profdegreerate = {0, 2.4}; profdegreeearning = {0, 83720};
> masterdegreerate = {0, 4.0}; masterdegreeearning = {0, 66144};
> bachelordegreerate = {0, 5.4}; bachelordegreeearning = {0, 53976};
> associatedegreerate = {0, 7.0}; associatedegreeearning = {0,39884};
> somecollegerate = {0, 9.2}; somecollegeearning = {0, 37024};
> highschoolgradrate = {0, 10.3}; highschoolearning = {0, 32552};
> somehighschoolrate = {0, 14.9}; somehighschoolearning = {0, 23088};
>
> labels = {"Some high school, no diploma", "high school graduate",
>  "Some college, no degree", "Associate degree", "Bachelor's degree",
>  "Master's degree", "Professional degree", "Doctoral degree"};
>
> labelsrates = {"1.9 %", "2.4 %", "4.0 %", "5.4 %", "7.0 %", "9.2 %",
>  "10.3 %", "14.9 %"};
>
> labelsearnings = {"$80,600", "$83,720", "$66,144", "$53,976",
>  "$39,884", "$37,024", "$32,552", "$23,088"};
>
> scalingfactorrate = 5000;
>
> PairedBarChart[
> Reverse[scalingfactorrate {doctoralrate, profdegreerate,
>  masterdegreerate, bachelordegreerate, associatedegreerate,
>  somecollegerate, highschoolgradrate, somehighschoolrate}],
> Reverse[{doctoralearning, profdegreeearning, masterdegreeearning,
>  bachelordegreeearning, associatedegreeearning, somecollegeearning,
>  highschoolearning, somehighschoolearning}],
> ChartLayout -> "Stacked", ChartStyle -> "Rainbow",
> BarSpacing -> Large,
> ChartLabels -> {Placed[{"Unemployment Rate in 2010 (%)",
>  "Median Earnings in 2010 ($)"}, Above],
>  Placed[labels, "CenterAxis"], None}, AxesLabel -> "Education",
> ImageSize -> Large, PlotLabel -> "Education and Training pay...",
> ChartElementFunction -> "GlassRectangle", Axes -> {False, True}]
>
> I'm having difficulties inserting the labelsrates, outside and to the left of
> the Unemployment rate bars. Similarly; I want to insert the labelsearnings, outside and to the right of the Median Earnings bars.
>
> I'm also having difficulties separating the two vertical axes so that, the education level labels fit  properly between the axes.
>
> Thank you for your help!
>
> Gilmar Rodr=EDguez Pierluissi


  • Prev by Date: Re: Retrieving pasteable function definition without contexts preprended
  • Next by Date: Manipulate auto re-evaluation logic puzzler
  • Previous by thread: Re: Retrieving pasteable function definition without contexts preprended
  • Next by thread: Re: PairedBarChart "Education and Training pay..."