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
 Easy way to change plot style
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

majo0008

USA
Posts

Posted - 11/18/2005 :  10:31:23 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Is there any way to change the style of multiple plots that are already in a layer without removing the plots and then replotting with a different style? I would like to set up a radio button where the user could select to see the data as scatterplots or lineplots. So far the best I can come up with is to remove the plots and then replot them? Any ideas?

-Ryan

Origin Version (Select Help-->About Origin): 7.5 SR5
Operating System: XP

easwar

USA
1965 Posts

Posted - 11/20/2005 :  10:42:37 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Ryan,

Presume you are working with grouped plots.

When you first create the plot, start with a scatter plot.
Then to switch to line, you can issue the script command:
layer -i200 %c; legend;

To switch back to scatter, you can issue the script command:
layer -i201 %c; legend;

You could then alternately issue the above two commands depending on what user selects using the radio buttons. I suggest starting with scatter because otherwise the group color property seems to get reset and scatter becomes all black.

Easwar
OriginLab


Go to Top of Page

majo0008

USA
Posts

Posted - 11/21/2005 :  12:00:17 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks Easwar. The script works great. I got around the issue with the color property resetting by using the OriginC code below:

GraphLayer g1multi = Project. ActiveLayer();

if(plotType == 1) //line plot
{
g1multi.LT_execute("layer -i200 %c");//change to line plot
vector<int> vv = {0}; // 0 is for line color
GroupPlot gPlot1 = g1multi.Groups(0);
gPlot1.Increment.Nester.nVals = vv;

}

if(plotType == 2)//scatterplot
{
g1multi.LT_execute("layer -i201 %c");//change to
vector<int> vv = {4}; // 4 is for symbol EdgeColor
GroupPlot gPlot1 = g1multi.Groups(0);
gPlot1.Increment.Nester.nVals = vv;
}
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