2
$\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$
2
  • $\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
    Commented Apr 21, 2013 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
    Commented Apr 21, 2013 at 22:53

1 Answer 1

6
$\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$
1
  • $\begingroup$ Awesome! You saved my life! I million thanks ;) $\endgroup$
    – pablo
    Commented Apr 23, 2013 at 21:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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