4
$\begingroup$

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.

$\endgroup$

migrated from stackoverflow.com Apr 19 '13 at 14:23

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

3
$\begingroup$

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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy