1
$\begingroup$

So I have a 2D histogram, in the third dimention are the counts.

What I want to achieve is by choosing two random position, make a plot of a 1D histogram along the line that passes through the two points.

I also want to be able to change the distance from the line to which points are included in the 1D histogram.

Any idea what is the best way to do this?

$\endgroup$
  • $\begingroup$ This is too general a question (you will need to explain what you have already tried and state which part of the problem you can't figure it). It's also a rather poor match for Computational Science. $\endgroup$ – Wolfgang Bangerth Dec 19 '13 at 19:21
1
$\begingroup$

Sorry for the easy question but I looked for a long time for the proper way to do this and was unable to do this.

Now someone around here taught me how this is normally done and it is shamefully easy. Still I rather post the answer than delete the post.

So the solution is given the line, divide it so that the space between each point is the same as the space between bins in the original histogram.

For each point consider the 4 nearest neighbours and interpolate the value at the point.

To integrate over a certain distance perpendicular to the line, create several lines parallel to the first up to the desired distance and with space between each line equal to the spacing between bins in the original histogram. Sum the lines. I think this should maintain the total number of counts equal.

If you have any opinions please share. Thanks

$\endgroup$

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.