1
$\begingroup$

I would like to make a plot of a function defined just for integer values, like

f[n_, m_] := 2 - (1/IntegerPart[n]) - (1/IntegerPart[m])

If I try to plot

Plot3D[f[n, m], {n, 1, 6}, {m, 1, 6}, PlotRange -> All, 
PlotPoints -> 100, Exclusions -> None, 
ColorFunction -> "BlueGreenYellow"]

I need this 100 points to get a "decent" result. This takes a long time, and the result is not very similar as the histogram one. Do you know if there is anyway to do this?

Thanks in advance!

$\endgroup$
  • $\begingroup$ There's ListPointPlot3D and ListPlot3D. But I'm confused: If 1 <= n <=6 and 1 <= m <= 6 and n, m are integers, then there are only 36 points. $\endgroup$ – Michael E2 Apr 21 '13 at 22:47
  • $\begingroup$ Sorry, I didn copied propperly, now is updated. THe problem in doing the ListPlot3D does only plot a point, I would like to have the chart bars aspect, like in the Histogram3D case. $\endgroup$ – pablo Apr 21 '13 at 22:53
5
$\begingroup$

Is this what you're after?

DiscretePlot3D[f[n, m], {n, 1, 6}, {m, 1, 6}, PlotRange -> All, 
 ColorFunction -> "BlueGreenYellow", ExtentSize -> Full]

Plot of function

$\endgroup$
  • $\begingroup$ Awesome! You saved my life! I million thanks ;) $\endgroup$ – pablo Apr 23 '13 at 21:57

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.