T O P I C R E V I E W |
Lou356 |
Posted - 11/18/2024 : 12:51:42 PM 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 |
6 L A T E S T R E P L I E S (Newest First) |
iniwoni |
Posted - 08/05/2025 : 02:52:47 AM Thank you, Chao!
Best regards, iniwoni |
ChaoC |
Posted - 07/24/2025 : 12:54:30 PM 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 |
iniwoni |
Posted - 07/23/2025 : 1:30:02 PM 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!
|
ChaoC |
Posted - 11/19/2024 : 2:10:10 PM Hello,
I would need to take a look at your project file to see how you have it set up.
Best, Chao |
Lou356 |
Posted - 11/19/2024 : 06:39:29 AM 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 |
ChaoC |
Posted - 11/18/2024 : 4:27:28 PM 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 |
|
|