The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 directly plot a vector??

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
5*10 Posted - 08/23/2005 : 05:19:16 AM
Origin Version (Select Help-->About Origin): 7G SR4 v.7.0552
Operating System:win 2000

Hi,

is there any possability to plot the data of a vector directly. Because I want to loop over several vector, plot one of them in a graphlayer and overwrite this plot with the next plot of the next vector.
If it isnīt possible to do this, i have to write a loop in Labtalk, write every vector in an wks and plot it. This costs much time.

5*10
5   L A T E S T    R E P L I E S    (Newest First)
5*10 Posted - 08/24/2005 : 04:46:14 AM
Hi,

I just tested it without the remove function and it works either! So Í do not need this function!!
Thanks for your help!!
5*10 Posted - 08/24/2005 : 03:19:18 AM
Thank you, the function works,
but there are problems wit the "RemovePlot" function.
Origin 7 is not able to compile this!!
Is this function still implemnted in origin 7.0 pro or is it a funtion of Origin 7.5 pro??
easwar Posted - 08/23/2005 : 10:46:56 AM
Hi 5*10,

In the previous post I was suggesting creating corresponding X vector. That is actually not required. If you have just a Y col and no X col, Origin would automatically plot against row number, so the code could be simplified such as below:

Easwar
OriginLab


void plot_vec2()
{
// Create and keep a hidden worksheet with just one Y column
WorksheetPage wpg;
wpg.Create("Origin", CREATE_HIDDEN);
Worksheet wks = wpg.Layers(0);
// Delete all cols and add just one Y col
while( wks.DeleteCol(0) );
wks.AddCol();
Dataset dsY(wks, 0);

// Create a new graph page, or use existing one
GraphPage gpg;
gpg.Create("Origin");
GraphLayer gly = gpg.Layers(0);

// say you have a vector with some values, such as:
vector vecY = {1, 4, 5, 7, 8, 5, 5, 4, 3, 2, 9};


// You could change the following to loop over all your vectors...

// Copy the Y vector to the wks col
dsY = vecY;

// Create a curve from the datasets and plot the curve
Curve crv(wks, 0);

// Plot the curve
gly.RemovePlot(0); // remove previous plot if plotting repeatedly
gly.AddPlot(crv);
gly.Rescale();
}



easwar Posted - 08/23/2005 : 10:38:09 AM
Hi 5*10,

If you were referring to plotting data that is in vector objects in OC...

To make a plot you need both X and Y and thus a curve. And the curve has to be constructed from datasets attached to dataset columns in a worksheet...

So you could use a hidden worksheet that you repeatedly use, from OC, with code such as below:

Easwar
OriginLab


void plot_vec()
{
// Create and keep a hidden worksheet with X, Y datasets
WorksheetPage wpg;
wpg.Create("Origin", CREATE_HIDDEN);
Worksheet wks = wpg.Layers(0);
Dataset dsX(wks, 0);
Dataset dsY(wks, 1);

// Create a new graph page, or use existing one
GraphPage gpg;
gpg.Create("Origin");
GraphLayer gly = gpg.Layers(0);

// say you have a vector with some values, such as:
vector vecY = {1, 4, 5, 7, 8, 5, 5, 4, 3, 2, 9};


// You could change the following to loop over all your vectors...

// create an x vector with "row numbers", same size as vecY
vector vecX;
vecX.Data(1, vecY.GetSize(), 1);

// Copy these vectors to hidden wks
dsX = vecX;
dsY = vecY;

// Create a curve from the datasets and plot the curve
Curve crv(wks, 0, 1);

// Plot the curve
gly.RemovePlot(0); // remove previous plot if plotting repeatedly
gly.AddPlot(crv);
gly.Rescale();
}



Mike Buess Posted - 08/23/2005 : 07:41:20 AM
Help > Origin > Plotting Origin's Built-in Graph Types > Vector Graphs

Mike Buess
Origin WebRing Member

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000