Heatmap with mesh offset problem

Aug 12, 2013 at 4:55 PM
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.

Aug 13, 2013 at 7:13 PM
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?
Aug 13, 2013 at 8:08 PM
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!

Aug 14, 2013 at 7:27 AM
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.
Aug 15, 2013 at 1:31 PM
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:

Aug 15, 2013 at 3:36 PM
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.
Aug 20, 2013 at 5:04 PM
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.

Aug 22, 2013 at 8:37 PM
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?
Aug 23, 2013 at 9:28 AM
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;
Aug 27, 2013 at 11:19 PM
Edited Aug 27, 2013 at 11:20 PM
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/
Aug 28, 2013 at 12:27 AM
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.
Aug 28, 2013 at 12:59 AM
Thanks, I didn't check winforms - see the latest update, should work now.
Aug 28, 2013 at 1:28 AM
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?
Aug 28, 2013 at 5:31 AM
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.