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
 LabTalk Forum
 Color change in grouped diagrams
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Lou356

Germany
2 Posts

Posted - 11/18/2024 :  12:51:42 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello,

I have a xy-graph with 10 groups and each group has three data sets (replicas).
Now I want each group to have a different color (all three replica within the same group the same color).
I found the following command, which is not working for me
set <LayerName> -c <Color>;

Is the command wrong? Or am I putting a wrong LayerName - then how to find the correct one?



Origin 2019 9.6.0.172
Operating System: Windows 10

ChaoC

USA
201 Posts

Posted - 11/18/2024 :  4:27:28 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

The following code will group all your plots into the same group and will use subgrouping instead to to manage the plot properties, including color:

layer -gu;
layer-g;
layer.plot1.subgroupsize=3;
layer.plot1.usepropssubgroup=2

Best regards,
Chao
Go to Top of Page

Lou356

Germany
2 Posts

Posted - 11/19/2024 :  06:39:29 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Chao,

thanks for your reply.
Ungrouping and Grouping works, but subgroupsize not. There is no error, just nothing happens.
Any ideas why?

Best regards
Go to Top of Page

ChaoC

USA
201 Posts

Posted - 11/19/2024 :  2:10:10 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

I would need to take a look at your project file to see how you have it set up.

Best,
Chao
Go to Top of Page

iniwoni

20 Posts

Posted - 07/23/2025 :  1:30:02 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

I want to perform subgrouping within a group using "By Column Label: (Userdefined) AAA (8th label row)", and I want to apply different colors for each subgroup.

Based on the forum topic, I tried the following Python code (using Originpro) to apply subgrouping and color settings:


gp = op.new_graph(template=template, hidden=False)
gl = gp[0]
for height in ORDER_HEIGHT:
    pairlist = groups[base][height]
    indices = []
    for (xidx, yidx) in pairlist:
        p = gl.add_plot(ws2, coly=yidx, colx=xidx, type='l')
        p.set_int('line.type', 1)
        p.set_int('line.width', 1)
        indices.append(p.index())
    if indices:
        gl.group(True, min(indices), max(indices))
        gl.lt_exec(f"layer.plot{min(indices)}.subgrouplabelrow=8;layer.plot{min(indices)}.usepropssubgroup=2;")


I have a few questions and issues:
  • Is there any problem with the code above, especially with the LabTalk command
    gl.lt_exec(f"layer.plot{min(indices)}.subgrouplabelrow=8;layer.plot{min(indices)}.usepropssubgroup=2;")?


  • I have 3 groups, but only the first group seems to follow the subgrouping defined in the code; the second and third groups are using the subgroup settings from the graph template instead. Moreover, even for the first group, the subgrouping does not always work perfectly. What could be the cause?

  • What does usepropssubgroup=2 mean?

Thank you in advance for your help!
Go to Top of Page

ChaoC

USA
201 Posts

Posted - 07/24/2025 :  12:54:30 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello iniwoni,

The code looks correct in general but since it seems you may have defined some stuff elsewhere in your code, I can't be certain. For example, gp = op.new_graph(template=template, hidden=False) needs to be template='template.otpu'. That is unless you defined 'template' somewhere else.
https://docs.originlab.com/originpro/classoriginpro_1_1graph_1_1GLayer.html#a9825b34f08b16f34510c809a702e70e5

usepropssubgroup=2 sets the Subgroup behavior in the Group tab of Plot Details
https://www.originlab.com/doc/LabTalk/ref/Layer-Plotn-obj#:~:text=layer.plotn.usepropssubgroup


Do you need 3 groups? There may be something wrong with the indices if you are having an issue with it. I recommend you step through your code to check if it's working as you expect.

In your case it may be better to just plot everything together in one group have the Increment by the user parameter group saved in your template. That way you don't need three groups or worry about subgrouping.
See for example:



import originpro as op

graph = op.new_graph(template='group_test.otpu')
gl = graph[0]
plot = gl.add_plot('[Book1]1!(A,B:0)', type='l')
gl.group(True,0,-1)


Best,
Chao
Go to Top of Page

iniwoni

20 Posts

Posted - 08/05/2025 :  02:52:47 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you, Chao!

Best regards,
iniwoni
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