4D Scatter Plot - Visual Basic - DPLOT.DLL

Q&A for Visual Basic, Visual Basic .NET, and PowerBasic developers using DPlot
Post Reply
BColbert
Posts: 1
Joined: Wed Jun 02, 2010 10:44 am

4D Scatter Plot - Visual Basic - DPLOT.DLL

Post by BColbert »

I am trying to add some VB code to automatically create 4D Scatter plots. Currently, this is not even program in the Excel add-in either because I have had to do the steps manually in DPlot to create this type of 4d scatter plot.

Is it possible to create this type of plot with the current version of the DPLOT.DLL? Or alternatively, can a Dplot Macro be created to do so? Apprarently DPLOT doesnt have a "record macro" function like Excel, so I guess I would have to learn those commands to do so? Where do I start?

Can a Dplot Macro be automatically called from a VB code? Basically I want to open DPlot, create the 4d Scatter with the appropriate settings for my type of plot, and then output a JPG. Is this possible?

Thanks,
Bob Colbert
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

Is it possible to create this type of plot with the current version of the DPLOT.DLL?
Yes, with a couple of minor changes. Open the btest project and the file Global.bas. Find the line

Global Const DATA_3DS = 7 ' 3D scatter plot

and add

Global Const DATA_4D = 8
Global Const DATA_4DS = 9

The data organization with a 4D scatter plot is identical to that of a 3D scatter plot with an additional value/point, so the 3D example is a good place to start. I'd suggest copying Command7_Click to a new routine and making these changes:

ReDim Node(2, Ntotal - 1)
to
ReDim Node(3, Ntotal - 1)

In the loop assigning values to X,Y,Z, add a line assigning some amplitude to Node(3,k)

Change
d.DataFormat = DATA_3DS
to
d.DataFormat = DATA_4DS

and in the command string change [ColorBasis(1)] to [ColorBasis(0)].
Basically I want to open DPlot, create the 4d Scatter with the appropriate settings for my type of plot, and then output a JPG. Is this possible?
Yes. After calling DPlot_Plot8, call
DPlot_Command(doc,"[FileSaveAs(""JPEG Picture"",""filename.jpg"")]")
where doc is the return value of DPlot_Plot8.

(This must be done in a separate call to DPlot_Command as suggested here, not included in the command string sent to DPlot_Plot.)
Visualize Your Data
support@dplot.com
Post Reply