Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to create a chart that has both a line and a bar chart representation of an expression. Because I'm using the same expression twice, I expect the line and the bar chart to match, but they are slightly off.

c = Plot[1000 (1 + 0.12/4)^(4 x), {x, 0, 12}, 
  PlotRange -> {{0, 12}, {0, 7000}}]
d = BarChart[Table[1000 (1 + 0.12/4)^(4 x), {x, 0, 12, 1}]]
Show[c, d]

I can't figure out why this would be. Any help would be greatly appreciated.

share|improve this question

migrated from Apr 19 '13 at 14:23

This question came from our site for professional and enthusiast programmers.

This should get you on the right track:-

c = Plot[1000 (1 + 0.12/4)^(4 x), {x, 0, 12}, PlotRange -> {{0, 12}, {0, 7000}}];
 d = BarChart[Table[1000 (1 + 0.12/4)^(4 x), {x, 1, 12, 1}]];
 Show[d, c]

enter image description here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.