Help with a 2D Histogram

Hi there,

I have been trying to construct a 2D histogram, and all went well until I attempted to display it in an image.
For some reason it is not scaling correctly. I had copied and pasted the code from the 2D Histogram page.
Here is the other snippet of code, which I've been using to call the function I coped from igorexchange.

//Histogram...
wave Apr11_wv100_1, Apr11_wv100_2
make/D/O/N=(50,75) Apr11_wv100_Hist12
JointHistogram(Apr11_wv100_1, Apr11_wv100_2, Apr11_wv100_Hist12)
Display/N=Apr11_wv100_Hist12; AppendImage Apr11_wv100_Hist12
ModifyImage Apr11_wv100_Hist12 ctab= {*,*,Spectrum,0}
ColorScale/E/C/N=NumberNeutrons
AppendtoTable Apr11_wv100_Hist12
end


I have been playing around with the number of rows and columns for the "Apr11_wv100_Hist12" matrix
hoping that it will in the end look like the attached picture. The original data waves that are creating the matrix are 8640 rows long.

Any help would be appreciated!

Thank you.
When you say it's not scaling correctly, do you mean the colour scale? And do you mean that you don't have a transparent/white background for your image? If the answer to both of these is yes, then you need to change the ctab= {*,*,Spectrum,0} part. The asterisks indicate that the colour scale will go from the minima to the maxima, you need to change the first asterisk to >0 (maybe 1? depends on your data). I think it should be ctab= {1,*,Spectrum,0} minRGB=NaN,maxRGB=0
That was helpful, but is not the major problem I am having. Let me try to explain this better.

The problem with my program is the the matrix that I created in order to make the histogram is not scaled correctly. I am having trouble understanding the right combination of rows to columns (in the size of the matrix) that will show the data in the way that the attached picture does. (see my first post for the picture).

The original graph of the data looks similar to the picture I attached, and I need the histogram I am making to reflect that data. However the information on the color scale was very helpful, thanks!
OK, sorry for not understanding. It looks like the example has approx 25 bins per unit in X? So your matrix would need to be 10*25=250 by 18*25=450. It has been a while since I tried this but in the end I went for the built-in function rather than the code on the snippets page. Have you tried this? Put this near the top of your procedure window #include <Bivariate Histogram 2> Now you have a more intuitive menu for creating your 2D histogram from the macros menu. Apologies if you've tried this already. Hope it helps.
Anna135 wrote:

For some reason it is not scaling correctly. I had copied and pasted the code from the 2D Histogram page.
Here is the other snippet of code, which I've been using to call the function I coped from igorexchange.

//Histogram…
...
make/D/O/N=(50,75) Apr11_wv100_Hist12
JointHistogram(Apr11_wv100_1, Apr11_wv100_2, Apr11_wv100_Hist12)
...



You seem to use the following snippet: http://www.igorexchange.com/node/1373
Note that the documentation says: "The result will be placed in the wave 'hist', which must be made beforehand and scaled to determine the histogram binning and boundaries"

Your code above does not include any scaling, such as e.g.
setscale/i x,-10,10, Apr11_wv100_Hist12
setscale/i y,20,100, Apr11_wv100_Hist12


You must derive the numbers from your data.