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 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!

share|improve this question
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. – Michael E2 Apr 21 '13 at 22:47
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. – pablo Apr 21 '13 at 22:53
up vote 5 down vote accepted

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

share|improve this answer
Awesome! You saved my life! I million thanks ;) – pablo Apr 23 '13 at 21:57

Your Answer


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

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