Contour plot, fill color and logarithmic scale
This discussion was imported from CodePlex
nhrl wrote at 2013-09-19 16:42:
Hi everybody !
I'm using Oxyplot as a library for .Net framework 4.0, in VB Express 2010 environment.
I'm trying to make contour plots and my questions are the following.
NHRL
I'm using Oxyplot as a library for .Net framework 4.0, in VB Express 2010 environment.
I'm trying to make contour plots and my questions are the following.
- Is it possible to have a logarithmic scale for the third axis ? If it is, what's the way to do it ?
- Is it possible to fill the gap between contour levels ?
NHRL
objo wrote at 2013-09-20 09:10:
You can set the ContourLevels property of the ContourSeries.
Currently, it is not possible to fill the gap between the contour levels.
But you can add a HeatMapSeries before the ContourSeries - see the examples.
If you use a RangeColorAxis, I think you can get almost the same result.
Currently, it is not possible to fill the gap between the contour levels.
But you can add a HeatMapSeries before the ContourSeries - see the examples.
If you use a RangeColorAxis, I think you can get almost the same result.
nhrl wrote at 2013-09-20 10:41:
Thank you objo for you answer.
Indeed, I set the ContourLevels to {1,10,100,1000}, creating a logarithmic scale.
Concerning the HeatMapSeries, I did not managed to use it.
I have the following error :
Indeed, I set the ContourLevels to {1,10,100,1000}, creating a logarithmic scale.
Concerning the HeatMapSeries, I did not managed to use it.
I have the following error :
La référence d'objet n'est pas définie à une instance d'objet.
with the following code :Dim Plotmodel1 As New PlotModel
Plotmodel1.Title = "Atlas de vagues - " & ComboBox1.SelectedItem
Dim linearAxis1 As New LinearAxis()
linearAxis1.Position = AxisPosition.Bottom
linearAxis1.Title = "Tz (s)"
linearAxis1.MajorGridlineStyle = LineStyle.Solid
linearAxis1.MinorGridlineStyle = LineStyle.LongDash
Plotmodel1.Axes.Add(linearAxis1)
Dim linearAxis2 As New LinearAxis()
linearAxis2.MajorGridlineStyle = LineStyle.Solid
linearAxis2.MinorGridlineStyle = LineStyle.LongDash
linearAxis2.Title = "Hs (m)"
Plotmodel1.Axes.Add(linearAxis2)
Dim contourSeries1 As New ContourSeries()
Dim heatMapSeries1 As New HeatMapSeries()
heatMapSeries1.X0 = tz_ss(0)
heatMapSeries1.X1 = tz_ss(UBound(tz_ss, 1))
heatMapSeries1.Y0 = hs_ss(0)
heatMapSeries1.Y1 = hs_ss(UBound(hs_ss, 1))
heatMapSeries1.Data = prob_ss
contourSeries1.ColumnCoordinates = tz_ss
contourSeries1.ContourLevels = {1, 10, 100, 1000, 10000}
contourSeries1.LineStyle = LineStyle.Solid
contourSeries1.StrokeThickness = 5
contourSeries1.ContourColors = {OxyColors.Aquamarine, OxyColors.Aqua, OxyColors.CadetBlue, OxyColors.Blue, OxyColors.Black}
contourSeries1.Data = prob_ss
contourSeries1.RowCoordinates = hs_ss
Plotmodel1.Series.Add(heatMapSeries1)
Plotmodel1.Series.Add(contourSeries1)
Plotmodel1.Background = OxyColors.White
Plotmodel1.PlotAreaBackground = OxyColors.White
Plot1.Model = Plotmodel1
If I add only the contourseries1 to the Plotmodel1, it works. But with the heatMapSeries1, it fails.nhrl wrote at 2013-09-20 16:00:
In addition to my previous post, I can tell you that :
- On my oxyplot version, the method "Add" doesn't exist for the "Data" method of "Heatmapseries"
- The version of Oxyplot I use seems to be different of the one used for the exemple (?)
- I cannot reproduce the simple examples of Heatmapseries that are provided in the examplebrowser..
nhrl wrote at 2013-10-01 10:45:
Does anybody have an idea ?
objo wrote at 2013-10-01 22:09:
Did you check the real source code for the examples? I see that the generated code is not correct for Array properties.
I added an issue on this: https://oxyplot.codeplex.com/workitem/10083
thanks!
I added an issue on this: https://oxyplot.codeplex.com/workitem/10083
thanks!
objo wrote at 2013-10-01 22:51:
the issue with the arrays should now be fixed
nhrl wrote at 2013-10-02 13:35:
Hi objo.
Thank you for your answer. Unfortunately, it did not solve my problem.
Actually, I code in VB.net, not in C#.
I'm trying to translate the example code from C# to VB.net, but I have errors.
Particularly, I don't know how to translate this line :
Do you have any idea ?
Thank you for your answer. Unfortunately, it did not solve my problem.
Actually, I code in VB.net, not in C#.
I'm trying to translate the example code from C# to VB.net, but I have errors.
Particularly, I don't know how to translate this line :
heatMapSeries1.Data = new Double[100, 100];
And I think this line is important. Do you have any idea ?
objo wrote at 2013-10-02 13:42:
nhrl wrote at 2013-10-02 14:05:
Ok, the translation in VB.net should be :
NHRL
heatmapseries1.Data = New Double(2, 2) {{1, 2, 3}, {3, 2, 1}, {1, 1, 1}}`
Now, here is my entire code :Plotmodel1.Title = "Atlas de vagues - " & ComboBox1.SelectedItem
Dim linearColorAxis1 As New LinearColorAxis()
linearColorAxis1.HighColor = OxyColors.Gray
linearColorAxis1.LowColor = OxyColors.Black
linearColorAxis1.Position = AxisPosition.Right
Plotmodel1.Axes.Add(linearColorAxis1)
Dim linearAxis1 As New LinearAxis()
linearAxis1.Position = AxisPosition.Bottom
linearAxis1.Title = "Tz (s)"
linearAxis1.MajorGridlineStyle = LineStyle.Solid
linearAxis1.MinorGridlineStyle = LineStyle.LongDash
linearAxis1.Position = AxisPosition.Bottom
Plotmodel1.Axes.Add(linearAxis1)
Dim linearAxis2 As New LinearAxis()
linearAxis2.MajorGridlineStyle = LineStyle.Solid
linearAxis2.MinorGridlineStyle = LineStyle.LongDash
linearAxis2.Title = "Hs (m)"
Plotmodel1.Axes.Add(linearAxis2)
Plotmodel1.Background = OxyColors.White
Plotmodel1.PlotAreaBackground = OxyColors.White
Dim heatmapseries1 As New HeatMapSeries
heatmapseries1.X0 = 0.5
heatmapseries1.X1 = 10.5
heatmapseries1.Y0 = 0.5
heatmapseries1.Y1 = 15.5
heatmapseries1.Data = New Double(2, 2) {{1, 2, 3}, {3, 2, 1}, {1, 1, 1}}
Plotmodel1.Series.Add(heatmapseries1)
Plot1.Model = Plotmodel1
But the error remain. Actually, visual studio doesn't return any error, but my plot is empty with the following text in red :OxyPlot paint exception : La référence d'objet n'est pas définie à une instance d'objet.
in english :OxyPlot paint exception : object reference not set to an instance of an object
Thank you again. NHRL
nhrl wrote at 2013-10-08 10:52:
Does anybody have an idea ?
I find OxyPlot is a wonderful toolbox, but it's a pity that I can't use its full capabilities..
I find OxyPlot is a wonderful toolbox, but it's a pity that I can't use its full capabilities..
Customer support service by UserEcho