# Formatting bar charts: size and ticks

I'm trying to format my bar charts so that I have only specific ticks with specific labels, and I can't seem to figure out how to do this. It always either comes up with ticks on every bar or without the labels I want. I'm also trying to make the chart 1/3 the automatic height with the same (automatic) width and having some trouble figuring out how to do that. If anyone can help me, it would be greatly appreciated.

I have 56 bars representing data from each year of 1960 to 2015, inclusive. I want ticks on bars 1, 11, 21, 31, 41, and 51 with labels 1960, 1970, 1980, 1990, 2000, and 2010 respectively. In case it's helpful, I'm putting the code for the charts below.

Regarding the size, the essence of what I'm doing is having a line plot on the left, and to the right of it, I'm placing three bar charts, each on top of the other. I need each bar chart to be 1/3 the height but the same width of the line plot, stacked in this way. Preferably, each bar graph should have its own y-axis label (the A, B, or C) with one communal label ("Fraction of Publications"), and only the bottom bar graph should have the year labels. I've tried to use a graphics grid to no avail. Do you have any ideas on what I should use. Current code is below.

Code is enclosed in a do loop which increments i.

Print[Show[BarChart[
dataset1,
PlotLabel -> labels[[i]] <> " A",
FrameLabel -> {{"Fraction of Publications", None}, {"Year",
None}},
ChartStyle -> {{Red}, {EdgeForm[]}},
BaseStyle -> {FontFamily -> "Ariel", FontSize -> 10},
Frame -> False,
PlotRange -> {0,
Max[alldata]}]]];
Print[Show[BarChart[
dataset2,
PlotLabel -> labels[[i]] <> " B",
FrameLabel -> {{"Fraction of Publications", None}, {"Year",
None}},
ChartStyle -> {{Blue}, {EdgeForm[]}},
BaseStyle -> {FontFamily -> "Ariel", FontSize -> 10},
Frame -> False,
PlotRange -> {0,
Max[alldata]}]]];
Print[Show[BarChart[
dataset3,
PlotLabel -> labels[[i]] <> " C",
FrameLabel -> {{"Fraction of Publications", None}, {"Year",
None}},
ChartStyle -> {{Purple}, {EdgeForm[]}},
BaseStyle -> {FontFamily -> "Ariel", FontSize -> 10},
Frame -> False,
PlotRange -> {0,
Max[alldata]}]]


EDIT: I'm looking to make the ticks look somewhat like the ones in this line plot:

EDIT2: Here's the updated code I'm working with now based on some helpful suggestions:

Print[Show[GraphicsColumn[{Show[BarChart[
dataset1,
FrameLabel -> {{"A", None}, {None, None}},
ChartStyle -> {{Red}, {EdgeForm[]}},
BaseStyle -> {FontFamily -> "Arial", FontSize -> 10},
Frame -> {{True, None}, {None, None}},
PlotRange -> {0,
Max[alldata]}]],
Show[BarChart[
dataset2,
FrameLabel -> {{"B", None}, {None, None}},
ChartStyle -> {{Blue}, {EdgeForm[]}},
BaseStyle -> {FontFamily -> "Arial", FontSize -> 10},
Frame -> {{True, None}, {None, None}},
PlotRange -> {0,
Max[alldata]}]],
Show[BarChart[
dataset3,
FrameLabel -> {{"C", None}, {None, None}},
Frame -> {{True, None}, {None, None}},
ChartStyle -> {{Purple}, {EdgeForm[]}},
BaseStyle -> {FontFamily -> "Arial", FontSize -> 10},
PlotRange -> {0,
Max[alldata]}]]} ,
PlotLabel -> labels[[i]]],
Frame -> True,
FrameLabel -> {{"Fraction of Publications", None}, {"Year", None}},
FrameTicks -> None,
BaseStyle -> {FontFamily -> "Arial", FontSize -> 10}]]


However, it's giving me a weird product. Example:

Note, I would prefer if it didn't have the frame around it, though were the frame placed correctly, I suppose I could remove it in Photoshop if need be.

• Totally unrelated to what you're asking: the well-known sans-serif font is spelled "Arial", not "Ariel". – Michael Seifert Aug 23 '16 at 16:44
• That sounds like something I should've been aware of. Thank you. One would think that would raise an error message. – user3769181 Aug 23 '16 at 16:54
• Welcome! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – user9660 Aug 23 '16 at 17:05
• @Louis: When I vote, it doesn't show up. Is it still recorded? – user3769181 Aug 23 '16 at 17:22
• Make sure you have upvoted and/or update the page. Check the FAQs. Ask on Meta. – user9660 Aug 23 '16 at 17:26

## 1 Answer

Concerning the ticks: does this do what you want?

mockdata = Table[RandomInteger[{10, 20}], {i, 1, 56}];
BarChart[mockdata,
FrameLabel -> {{"Fraction of Publications", None}, {"Year", None}},
ChartStyle -> {{Purple}, {EdgeForm[]}},
BaseStyle -> {FontFamily -> "Arial", FontSize -> 10},
ChartLabels -> Table[If[Mod[i, 10] == 1, i + 1959, ""], {i, 1, Length[mockdata]}]
]


As an aside: using Frame -> False means the the FrameLabel option is not invoked (at least in the version of MM I'm using.) So I'm not sure why you have them both there. If you set Frame -> True instead, then the ticks point inwards from the frame, but the labelling still works as in the image above.

• Not exactly. Yes for the labels, but I'm looking to only have ticks at those labels and not in between. I'm using v9, and it looks like you're right about the labels. It's probably a relic from whatever I tried previously. – user3769181 Aug 23 '16 at 16:57
• Where should the ticks for the labelled bars be placed horizontally? In their centers? On the left edge? On the right edge? – Michael Seifert Aug 23 '16 at 17:01
• In the center. For reference, I edited in a line plot with the type of x-axis I'm looking for. Suppose I should've had that there from the start. – user3769181 Aug 23 '16 at 17:09
• Also, unrelated to the ticks, I updated my original post with the update I'm working with now. – user3769181 Aug 23 '16 at 17:40