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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 ploting: color & size
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

ovince

Yugoslavia
Posts

Posted - 09/16/2006 :  09:03:28 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
hi All,

I would like to learn how to color the plot and change the size of symbols. Namely, I would like to have

1) data (lot of pints)
2) mean in 10 data bins and
3) median in 10 data bins

on the same Layer. So far I am doing well with few commands like

gly.AddPlot( crvAll, IDM_PLOT_SCATTER );
gly.AddPlot( crvMean, IDM_PLOT_LINE );
gly.AddPlot( crvMedian, IDM_PLOT_LINE );

But the symbol size of the data points (crvAll) is so large that it is unconvinient to see anything else on the graph. So I would like to make the symbol size smaller. Also it would be nice to put crvMean and crvMedian in different colors. How to designate all points (crvAll, crvMean and crvMedian) in the Legend?

Anybody to help me with this?

thanks many in advance
Oliver

Mike Buess

USA
3037 Posts

Posted - 09/16/2006 :  11:27:33 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Oliver,

See the Change Plot Format example here.

Mike Buess
Origin WebRing Member
Go to Top of Page

ovince

Yugoslavia
Posts

Posted - 09/17/2006 :  06:51:30 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
thanks Mike,

I was trying to apply the recommanded help to my problem and I failed. I would like to ask for detailed help?

So, I have about 40 worksheets with
- independent variable (1st column)
- median of dependent variable (2nd column)
- mean of dependent variable (3th column),
- error bars to median (4th column),
- error bars to mean (4th column).

I am trying to make 40 plots with median and mean colored differently.
What I have done so far is very simple:

void plotting_with_err_bar()
{
PageBase pg;

// Create a Project object
Project proj;

foreach (pg in proj.Pages)
{
Worksheet wks(name);

//define curves
Curve crvMedian(wks, 0, 1);
Curve crvMean(wks, 0, 2);

//define error bars
Dataset dsErrMedian(wks, 3);
Dataset dsErrMean(wks, 4);

GraphPage gpg;
gpg.Create( "Origin.OTP" );
GraphLayer gly = gpg.Layers( 0 );

// Add the first plot
gly.AddPlot( crvMedian, IDM_PLOT_LINE );

DataPlot dp = gly.DataPlots(0);
// Redefine data plot object
dp = gly.DataPlots(0);
// Get format of data plot to tree and output tree
Tree trFormat;
trFormat = dp.Curve;
dp.Curve.Symbol.Shape.nVal = 2; // filled circles
dp.Curve.Symbol.EdgeColor.nVal = 1; // red color
dp.Curve.Symbol.Size.nVal = 3; // size 12

// Add the second plot
gly.AddPlot( crvMean, IDM_PLOT_LINE );

.............................

HOW TO DEAL WITH ADDED PLOT
}
}


I have a problem to continue. I do something wrong all the time and don't know what. Please (somebody patient enough :)) to direct me

thanks
oliver
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 09/17/2006 :  10:19:54 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Oliver,

Try this...
void plotting_with_err_bar()
{
foreach (PageBase pg in Project.Pages)
{
if( pg.GetType()==EXIST_WKS )
{
Worksheet wks(pg.GetName());

// define curves
Curve crvMedian(wks, 0, 1);
Curve crvMean(wks, 0, 2);

// define error bars
Dataset dsErrMedian(wks, 3);
Dataset dsErrMean(wks, 4);

GraphPage gpg;
gpg.Create( "Origin.OTP" );
GraphLayer gly = gpg.Layers( 0 );

// add and format Median plot
int iMedian = gly.AddPlot( crvMedian, IDM_PLOT_LINESYMB );
DataPlot dpMedian = gly.DataPlots(iMedian);
dpMedian.Curve.Symbol.Shape.nVal = 2;
dpMedian.Curve.Symbol.Size.nVal = 3;
dpMedian.Curve.Symbol.EdgeColor.nVal = 1;
dpMedian.Curve.Line.Color.nVal = 1;

// add and format Mean plot
int iMean = gly.AddPlot( crvMean, IDM_PLOT_LINESYMB );
DataPlot dpMean = gly.DataPlots(iMean);
dpMean.Curve.Symbol.Shape.nVal = 2;
dpMean.Curve.Symbol.Size.nVal = 3;
dpMean.Curve.Symbol.EdgeColor.nVal = 0;
dpMean.Curve.Line.Color.nVal = 0;

// add error bars
gly.AddErrBar( crvMedian, dsErrMedian );
gly.AddErrBar( crvMean, dsErrMean );

gly.Rescale(); // rescale
}
}
}


Mike Buess
Origin WebRing Member
Go to Top of Page

ovince

Yugoslavia
Posts

Posted - 09/17/2006 :  1:54:25 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
thanks Mike

It works fine.

oliver
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000