# How can I draw this plot?

How can I draw a plot like this one? I want to be able to specify the x-axis, y-axis, and z-axis ticks and the number of bars in the plot.

-
This looks like a Mathematica generated plot. Where did you find it? Can you supply a link? –  m_goldberg Feb 25 '13 at 13:30
I got it from google. –  niren Feb 25 '13 at 13:57
Please post the link anyway. Many students had come in the past with homework plots to be reproduced. Not your case, surely –  belisarius Feb 25 '13 at 14:07
A hint f[x_, y_, n_] := Total@Flatten@ Table[UnitBox[(x - a)/100, (y - b)/100], {a, 200, n 200, 200}, {b, 200, n 200, 200}]; –  belisarius Feb 25 '13 at 14:30
"I got it from google" - perhaps there's some data on the same page that might be useful... –  cormullion Feb 25 '13 at 18:31

Since the Google reference isn't forthcoming, it's probably easier to fake it like this:

i = Blur[
Image[Graphics[{
Black,
Table[Rectangle[{x, y}, 20 + {x, y}],
{x, 0, 100, 35},
{y, 0, 100, 35}]},
Background -> White],
ImageSize -> 100],
1];
xticks = Transpose[{Range[0, 100, 20], Range[0, 1000, 200]}];
yticks = Transpose[{Range[0, 100, 20], Range[0, 1000, 200]}];
zticks = Transpose[{Range[0, 1, .2], Range[0, 25, 5]}];
ListPlot3D[ImageData[i] /. {x_, y_, z_} -> 1 - z,
Mesh -> 20,
Ticks -> {xticks, yticks, zticks},


-
Thank you for your answer. I got another problem not only with this Plot, its with all the try that i made for the same plot. When i Deploy the code in CDFDeploy, its working fine but i couldn't rotate the plot. –  niren Feb 27 '13 at 6:42
I have found myself the answer for CDFDeploy problem. I have resolved the problem using Manipulate. –  niren Feb 27 '13 at 11:05
I have customized the number of bars i want on the plot, But i couldn't customize the height of each bar, Because in your code you get the data from image which range between 0 and 1. I want the height of some bar to be 20 and some to be 25 and so on. –  niren Feb 27 '13 at 11:20
@niren I think you should probably first of all specify/supply the 'data' that you want to plot, then people here on this site can help you plot it in different ways. I just used an image because there was no data. To change the heights of the bars in my example, I would make some of the squares less black ...:) Perhaps you really want to construct a 3D object from Cuboids? If you put more effort into your question, any answers you get will be more relevant and useful to you. –  cormullion Feb 27 '13 at 11:39

You could do something similar to the given example using Histogram3D, which comes with many options.

You need to specify the data you have in hand in your question. If you really need a flat top, as you show in your example, you could use the function UniformDistribution as the input for Histogram3D.

-
Thank you for your reply, but Histogram3D doesn't give me the plot the way i want. –  niren Feb 26 '13 at 5:54
What's the problem with Histogram3D? Do you want a gap between the colummns? –  fcpenha Feb 26 '13 at 11:42

You really need to specify better what you want. In case you want to draw 3D rectangular columns with some gap in between, the following code would do the work:

    max = 10;
step = max;
factor = 2*max;

DiscretePlot3D[ factor * PDF[
UniformDistribution[{-max, max}], {x, y} ],
{x, -max, max, step}, {y,-max, max, step},
ExtentSize -> max/2 ]

-