Heatmap with mesh offset problem

Oystein Bjorke 6 years ago 0
This discussion was imported from CodePlex

michaeldjackson wrote at 2013-08-12 17:55:

Hey All,

I'm modeling fractures with OxyPlot. I've created a Heatmap using the Heatmap series and an overlay of the mesh using the LineSeries. However, the Heatmap is "offset" in the negative X direction (prior to Length of 0). In my dataset, all data starts at X coordinate of 0.

See this image:

Any ideas why or how to correct the problem.


everytimer wrote at 2013-08-13 20:13:

I have no idea why is this happening. Is the offset always the same? If so you can try to correct this offset by manually add that value to the initial X of your Heatmap. Good luck

P.D. Seems to be very interesting project to me, what is the purpose of the program?

michaeldjackson wrote at 2013-08-13 21:08:

I'll look into adding X offset. I'm guessing by doing that, I'll push the heatmap out beyond the mesh.

I work in the Petroleum Engineering Dept, research group, at University of Texas at Austin. This is a project to allow the industry to model, simulate and animate over time, underground fractures based on MANY (150 or so) inputs, fracturing fluids, time frames, etc. This is the culmination of a Ph.D. students 5 year research project. Using both 3D (helix3D toolkit) and 2D visuals.

It is interesting!


objo wrote at 2013-08-14 08:27:

The coordinates of the HeatMapSeries define the midpoints of the corner cells of the data array. I defined it this way so it should match the coordinates of the ContourSeries. I have added a small [2,3] example that demonstrates this.

I also corrected the calculation of the bounding box of the HeatMapSeries.

michaeldjackson wrote at 2013-08-15 14:31:

Thanks objo for the help.

I downloaded and referenced 2013.1.63.1 and tested. The heatmap offset still persists, and it is worse now than the previous version.

See this image for the increased offset problem:


objo wrote at 2013-08-15 16:36:

Yes, there should be a difference in offset in the latest version. I think the new version should be correct.
Did you adjust the X0, X1, Y0 and Y1 coordinates by half cell width/height?
See the new examples, I got exact match with the desired boundary of the heatmap.

geopars wrote at 2013-08-20 18:04:

Hi objo,
I also want to confirm that the problem with the offset still persists. The boundaries are now correct but the internal points are still shifted. Try a symmetric matrix and you will see that the diagonal is shifted.


objo wrote at 2013-08-22 21:37:

I added two 3x3 diagonal matrix examples (see the last example under HeatMapSeries and Custom series in the example browser). These seems to be correct. Can you provide an example where it is not working?

geopars wrote at 2013-08-23 10:28:

Hi objo,

Thanks for the quick reply. Check this example. image
You will see the the red line doesn't pass through the diagonal.
[Example("Diagonal matrix")]
public static PlotModel DiagonalMatrix()
   var data = new double[6, 6];
   data[0, 0] = 1;
   data[1, 1] = 1;
   data[2, 2] = 1;
   data[3, 3] = 1;
   data[4, 4] = 1;
   data[5, 5] = 1;

   var model = new PlotModel("Diagonal matrix");
   model.Axes.Add(new ColorAxis { Position = AxisPosition.Right, Palette = OxyPalettes.Jet(500), HighColor = OxyColors.Gray, LowColor = OxyColors.Black });

   // adding half cellwidth/cellheight to bounding box coordinates
   var hms = new HeatMapSeries { X0 = 0, X1 = 5, Y0 = 0, Y1 = 5, Data = data, Interpolate = true };
   return model;

objo wrote at 2013-08-28 00:19:

I have added this example (HeatMapSeries -> Diagonal matrix (6x6)) to the example library. It seems to render OK in the latest version. See http://oxyplot.org/examplebrowser/

geopars wrote at 2013-08-28 01:27:

I just saw the example that you posted on the example browser. That is correct. I just downloaded the latest source code. It is working on WPF and Silverlight but not on Winforms.

objo wrote at 2013-08-28 01:59:

Thanks, I didn't check winforms - see the latest update, should work now.

geopars wrote at 2013-08-28 02:28:

It is working correctly. Brilliant job objo. Actually I wanted to ask you, in the above example (DiagonalMatrix2). Even though we provide the limits X0 X1, Y0 and Y1, the image still shows coloring between -0.5 to 0 and 5 to 5.5. How is it possible to get rid of that in order to have an image that shows only the limits?

objo wrote at 2013-08-28 06:31:

I added a "CoordinateDefinition" property. Set it to "Edge" if you want to define the coordinates by the edges. I want to keep the default value to "Center", so the coordinates are defined the same way as for the contour series.