Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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 stackoverflow.com Apr 19 '13 at 14:23

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

add comment

1 Answer 1

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
add comment

Your Answer

 
discard

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