Can someone send me an examples or modification to the code below to show
how to place Major and Minor Grids lines on a Log-Log plot.
I can get Major, but the minors are not showing up. Also how to get the
format of the numbers on the major ticks to be in 0.0E+00 format.
One last item the last number on the x-axis labels is being cut-off a
little how do I fix this.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim lx As NPlot.Axis = New NPlot.LogAxis
Dim ly As NPlot.Axis = New NPlot.LogAxis
Dim gxmj As NPlot.Grid = New NPlot.Grid
Dim gymj As NPlot.Grid = New NPlot.Grid
Dim gxmn As NPlot.Grid = New NPlot.Grid
Dim gymn As NPlot.Grid = New NPlot.Grid
Dim lp As NPlot.LinePlot = New NPlot.LinePlot
Dim pp As NPlot.PointPlot = New NPlot.PointPlot
Dim XDAT As ArrayList = New ArrayList
Dim YDAT As ArrayList = New ArrayList
XDAT.Clear()
YDAT.Clear()
PlotSurface2D1.Clear()
PlotSurface2D1.Title = "2D PLOT"
PlotSurface2D1.BackColor = Color.Empty
Dim x As Integer
For x = 1 To 20
XDAT.Add(x)
YDAT.Add(x)
Next
'***LINE-TYPE-PLOT****
lp.AbscissaData = XDAT
lp.DataSource = YDAT
PlotSurface2D1.Add(lp)
lp.Color = Color.Blue
'***POINT-TYPE-PLOT****
pp.AbscissaData = XDAT
pp.DataSource = YDAT
PlotSurface2D1.Add(pp)
'
'Set Axis Range
lx.WorldMax = 2000.0
lx.WorldMin = 20.0
ly.WorldMax = 0.1
ly.WorldMin = 0.000001
'Set Labels to Outside of Tick Marks
lx.TickTextNextToAxis = False
ly.TickTextNextToAxis = True
'Set Major and Minor Grids Graph
gxmj.MajorGridPen = Pens.Black
PlotSurface2D1.Add(gxmj)
gxmn.MinorGridPen = Pens.Maroon
PlotSurface2D1.Add(gxmn)
gymj.MajorGridPen = Pens.Black
PlotSurface2D1.Add(gymj)
gymn.MinorGridPen = Pens.Maroon
PlotSurface2D1.Add(gymn)
'Set Labels of Graph
PlotSurface2D1.XAxis1.Label = "X-Axis"
PlotSurface2D1.YAxis1.Label = "Y-Axis"
' Graph Data
PlotSurface2D1.XAxis1 = lx
PlotSurface2D1.YAxis1 = ly
' Force Graph area update
PlotSurface2D1.Refresh()
end sub
<mailto:edw...@na...>
|