View previous topic :: View next topic |
Author |
Message |
wombo
Joined: 19 Feb 2009 Posts: 10
|
Posted: Thu Feb 19, 2009 3:21 am Post subject: Turnary plot |
|
|
I seem to be really struggling for some reason, I think I am just missing on bit of key information.
For now all I am trying to do is convert a set of data in 2 arrays into a turnary plot.
Arrays:
Code: | N=3
ReDim x(N-1)
ReDim x(N-1)
x(0) = 0
y(0) = 0
x(1) = 40
y(1) = 20
x(2) = 20
y(2) = 60 |
I am using the following to pass to the Dplot_Plot8 command
Code: |
d = New DPLOT
d.Initialize()
d.Version = DPLOT_DDE_VERSION
d.DataFormat = DATA_XYXY
d.MaxCurves = 2 ' Must be >= number of curves we plot
d.MaxPoints = N ' Anything >= N will do
d.NumCurves = 2
d.ScaleCode = SCALE_TRIANGLE_PLOT
d.LegendX = 0.05
d.LegendY = 0.05
d.NP(0) = N
d.LineType(0) = LINESTYLE_SOLID
d.LineType(1) = LINESTYLE_LONGDASH
d.Title1 = "Data sent to DPlot via DPLOTLIB.DLL"
d.XAxis = "x"
d.YAxis = "y"
DocNum = DPlot_Plot8(s, x(0), y(0), cmds)
|
As you can see it is based on the sample code.
I think the problem is with either my arrays or the DataFormat.
I would be gratful for any help, thank you. |
|
Back to top |
|
|
DPlotAdmin Site Admin
Joined: 24 Jun 2003 Posts: 2310 Location: Vicksburg, Mississippi
|
Posted: Thu Feb 19, 2009 4:19 am Post subject: |
|
|
NumCurves should be 1, unless you really have 2 curves and aren't showing the data for the second one. _________________ Visualize Your Data
support@dplot.com |
|
Back to top |
|
|
wombo
Joined: 19 Feb 2009 Posts: 10
|
Posted: Thu Feb 19, 2009 7:44 pm Post subject: |
|
|
Ahh thanks for that its all working now.
Now im off to convert it to handle multiple curves |
|
Back to top |
|
|
wombo
Joined: 19 Feb 2009 Posts: 10
|
Posted: Thu Feb 19, 2009 9:27 pm Post subject: |
|
|
Thanks for that, I have now got it all working with multiple curves.
Heres my current code for future reference
But I have another question I am trying to implement a system where the colour gets darker gradually through the curves, the other option is for the opacity to gradually go from 100 to 0.
I havent been able to get this up and running properly yet is there any chance you could give me some pointers.
I have been using this thread for pointers but couldnt get it to work http://www.dplot.com/forums/viewtopic.php?t=223&highlight=contourcustomcolors
BTW I noticed some where that opacity wasnt passed to metafiles which I think might affect me unless there is a way around that. |
|
Back to top |
|
|
wombo
Joined: 19 Feb 2009 Posts: 10
|
Posted: Thu Feb 19, 2009 9:29 pm Post subject: |
|
|
It wouldnt let me put it in the previous post
Code: | N = 1
ReDim x(5, N - 1)
ReDim y(5, N - 1)
x(0, 0) = 10
y(0, 0) = 10
x(1, 0) = 40
y(1, 0) = 40
x(2, 0) = 50
y(2, 0) = 40
x(3, 0) = 71
y(3, 0) = 11
x(4, 0) = 51
y(4, 0) = 21
x(5, 0) = 31
y(5, 0) = 41
d = New DPLOT
d.Initialize()
d.Version = DPLOT_DDE_VERSION
d.DataFormat = DATA_XYXY
d.MaxCurves = 10 ' Must be >= number of curves we plot
d.MaxPoints = 20 ' Anything >= N will do
d.NumCurves = 6
d.ScaleCode = SCALE_TRIANGLE_PLOT
d.LegendX = 0.05
d.LegendY = 0.05
d.NP(0) = N
d.NP(1) = N
d.NP(2) = N
d.NP(3) = N
d.NP(4) = N
d.NP(5) = N
d.LineType(0) = LINESTYLE_NONE
d.LineType(1) = LINESTYLE_NONE
d.LineType(2) = LINESTYLE_NONE
d.SymbolType(0) = SYMBOLSTYLE_HEXAGON
d.SymbolType(1) = SYMBOLSTYLE_HEXAGON
d.SymbolType(2) = SYMBOLSTYLE_HEXAGON
d.SymbolType(3) = SYMBOLSTYLE_HEXAGON
d.SymbolType(4) = SYMBOLSTYLE_HEXAGON
d.SymbolType(5) = SYMBOLSTYLE_HEXAGON
d.Title1 = "Ternary Plot"
d.XAxis = "x"
d.YAxis = "y"
cmds = "[Caption(" & Chr(34) & "Ternary Plot" & Chr(34) & ")]"
cmds = cmds & "[DocMaximize()][ClearEditFlag()]"
cmds = cmds & "[SymbolOpacity(0,100)]"
cmds = cmds & "[SymbolOpacity(1,80)]"
cmds = cmds & "[SymbolOpacity(2,60)]"
cmds = cmds & "[SymbolOpacity(3,40)]"
cmds = cmds & "[SymbolOpacity(4,20)]"
cmds = cmds & "[SymbolOpacity(5,5)]"
If (hemf <> 0) Then
ret = DeleteEnhMetaFile(hemf)
hemf = 0
End If
DocNum = DPlot_Plot8(d, x(0, 0), y(0, 0), cmds)
ans.Text = DocNum
If (DocNum > 0) Then
GetMyMetafile()
' Be sure to do a FileClose after this call (if you're done with the document)
ret = DPlot_Command(DocNum, "[FileClose()]")
End If |
|
|
Back to top |
|
|
DPlotAdmin Site Admin
Joined: 24 Jun 2003 Posts: 2310 Location: Vicksburg, Mississippi
|
Posted: Thu Feb 19, 2009 11:16 pm Post subject: |
|
|
SymbolOpacity doesn't work on metafiles - only displays, bitmaps, and printed graphs. There are two reasons DPlot ignores this setting for metafiles: 1) the symbols are drawn device unit by device unit and the "unit" for metafiles is very small - so drawing things this way would yield a very large metafile. Probably more importantly 2) opacity means blending with the background (whatever background happens to be there) and there is no way to retrieve information about the background for a metafile. The only way I could possibly make this work is to throw out one of the primary features of metafiles - a transparent background - and create a large (very, very large) bitmap. _________________ Visualize Your Data
support@dplot.com |
|
Back to top |
|
|
wombo
Joined: 19 Feb 2009 Posts: 10
|
Posted: Thu Feb 19, 2009 11:37 pm Post subject: |
|
|
Yeah I thought that might be the case.
Do you know how I could acheive something similar using colours. IE going from bright red to black.
I am looking at trending the composition changes over time. |
|
Back to top |
|
|
DPlotAdmin Site Admin
Joined: 24 Jun 2003 Posts: 2310 Location: Vicksburg, Mississippi
|
Posted: Thu Feb 19, 2009 11:44 pm Post subject: |
|
|
Sure. Just replace all of those SymbolOpacity commands with Color commands. See http://www.dplot.com/help/index.htm?colorcommand.htm
Edit: FYI, the "index" argument is 1-based, not 0-based as you're using with your example and the SymbolOpacity commands. _________________ Visualize Your Data
support@dplot.com |
|
Back to top |
|
|
wombo
Joined: 19 Feb 2009 Posts: 10
|
Posted: Tue Mar 10, 2009 11:29 pm Post subject: |
|
|
Just a quick note
Thanks for your assistance I have got everything up and running really well. I am now looking into what else we can do with dplot. |
|
Back to top |
|
|
|