Author |
Topic  |
|
iniwoni
20 Posts |
Posted - 06/02/2025 : 07:08:03 AM
|
Origin Ver. and Service Release (Select Help-->About Origin): Origin2025 10.2.0.188 Operating System: Win10
Hi!
I have a graph which has almost 900 plots. I wonder whether to select some check box in object manager with python programming.
 |
|
ChaoC
USA
201 Posts |
|
iniwoni
20 Posts |
Posted - 06/10/2025 : 7:31:23 PM
|
Thank you, Chao! |
 |
|
iniwoni
20 Posts |
Posted - 06/24/2025 : 12:04:58 PM
|
Hello,
I have another problem. I'd like to control the show/hide state of plots with name in Graph object manager. But, I couldn't find the name of plots in Graph object manager. =========================================================== import originpro as op
gp = op.find_graph() gl = gp[0]
n_plots = len(gl.plot_list()) for j in range(1, n_plots + 1): lname = op.get_lt_str(f'layer.plot{j}.lname$') print(f"plot{j} Long Name: {lname}")
==> plot1 Long Name:
============================================================
Isn't it a right approach? then, is there another approach?
Best regards, iniwoni
quote: Originally posted by ChaoC
Hello,
The LabTalk command is: layer#.plot#.show=0; where # is the layer and plot number. E.g. Layer1.plot2.show=0; will hide the second plot in layer one.
You can use lt_exec() to run the LabTalk command in Python. E.g. import originpro as op op.lt_exec("layer1.plot2.show=0;")
See: https://my.originlab.com/forum/topic.asp?TOPIC_ID=48234 https://docs.originlab.com/originpro/namespaceoriginpro_1_1utils.html#ada9639911937420a7a48a37e7bcf0e9f https://www.originlab.com/doc/LabTalk/ref/Layer-obj
Best, Chao
|
Edited by - iniwoni on 06/24/2025 12:09:39 PM |
 |
|
ChaoC
USA
201 Posts |
Posted - 06/24/2025 : 5:14:17 PM
|
Hello iniwoni,
layer.plotn.lname$ is not a valid command but layer.plotn.name$ is valid and it is the dataset name. E.g. Book1_C
You can then use the dataset name and Column Label Row Characters to access its Long name in the worksheet. E.g. Book1_C[L]$ See: https://www.originlab.com/doc/LabTalk/ref/Column-Label-Row-Characters
Try the following:
import originpro as op
gp = op.find_graph()
gl = gp[0]
n_plots = len(gl.plot_list())
for j in range(1, n_plots + 1):
name = op.get_lt_str(f'layer.plot{j}.name$')
lname = op.get_lt_str(f'{name}[L]$')
print(f"plot{j} Long Name: {lname}")
Best regards, Chao
|
 |
|
iniwoni
20 Posts |
Posted - 06/24/2025 : 8:01:25 PM
|
It works like magic. Thank you, Chao.
Best regards, iniwoni |
 |
|
iniwoni
20 Posts |
Posted - 06/25/2025 : 11:31:20 AM
|
Hello, Chao
I have another question. In graph object manager, how can I remove the unchecked box? I'd like to remove all the unchecked boxes in a opju file to rescale the color.(I found 'plot.remove()', 'layer.remove_plot()) => Solved! Otherwise, is it possible to rescale the color as capture? Thank you, in advance.
Best regards, iniwoni
  |
Edited by - iniwoni on 06/26/2025 07:26:20 AM |
 |
|
iniwoni
20 Posts |
Posted - 06/26/2025 : 09:03:58 AM
|
Hello,
There is something wrong with 'graph_list()'.
Only 'p' works, but 'f', 'o' doesn't work.
What's the cause?
Best regards, iniwoni
import originpro as op
graphs = op.graph_list('f')
for gp in graphs: layer_count = gp.get_int('nlayers') for idx in range(layer_count): gl = gp[idx] plots = gl.plot_list() for p in plots[:]: if not p.show: p.remove()
==> Traceback (most recent call last): File "<string>", line 6, in <module> File "C:\Users\LGRnD\Documents\OriginLab\User Files\2.py", line 8, in <module> gl = gp[idx] ~~^^^^^ File "C:\ProgramData\OriginLab\102\PyPackage\Py3\originpro\graph.py", line 1313, in __getitem__ return GLayer(self.obj.Layers(index)) ^^^^^^^^^^^^^^^ AttributeError: 'CPyPageBase' object has no attribute 'Layers'
|
 |
|
ChaoC
USA
201 Posts |
|
iniwoni
20 Posts |
Posted - 06/26/2025 : 09:39:16 AM
|
Thank you, Chao. I'll try 'layer.cmap.SetLevels(method)' to rescale the color. And...There is still something wrong.
import originpro as op
for gp in op.graph_list('f'): print(gp.name) #layer_count = gp.get_int('nlayers') #for idx in range(layer_count): #gl = gp[idx] #plots = gl.plot_list() #for p in plots[:]: #if not p.show: #p.remove()
==> Graph20 Graph19 Graph1 Graph2 Graph37 Graph21 Graph3 Graph22 Graph4 Graph23 Graph5 Graph24 Graph6 |
 |
|
iniwoni
20 Posts |
Posted - 06/28/2025 : 7:34:35 PM
|
Hello,
I have 5 PCs, some of which also have Origin2023 installed.
However, on all of them, the 'f' and 'o' do not work.
Only 'p' works.
Of course, there are graphs in the folders.
Best regards, iniwoni
 |
 |
|
ChaoC
USA
201 Posts |
Posted - 06/30/2025 : 09:29:07 AM
|
Hello,
What is the issue with?:
for gp in op.graph_list('f'):
print(gp.name Do you mean the graph list order? That is expected as the graph list is in order of oldest modification to most recent graph modification.
I tested on Origin 2023 and did not have any issue with 'f' or 'o' so there's some other issue. See:

Best, Chao |
 |
|
iniwoni
20 Posts |
Posted - 07/10/2025 : 9:18:52 PM
|
Thank you for your reply, and I also really appreciate all your help with my work.
I’m sorry, but I think I may not have explained the issue clearly in my previous message. There’s no problem with the screenshot you sent.
To clarify: the issue is that running 'p' does not cause an error, but running 'f' or 'o' does result in an error. ===================================================================== Traceback (most recent call last): File "<string>", line 6, in <module> File "C:\Users\Administrator\Documents\OriginLab\User Files\1.py", line 9, in <module> gl = gp[idx] ~~^^^^^ File "C:\ProgramData\OriginLab\101\PyPackage\Py3\originpro\graph.py", line 1313, in __getitem__ return GLayer(self.obj.Layers(index)) ^^^^^^^^^^^^^^^ AttributeError: 'CPyPageBase' object has no attribute 'Layers'
=====================================================================
Could you please help me understand why this is happening?
Thank you very much.
Best regards, iniwoni



 |
 |
|
iniwoni
20 Posts |
Posted - 07/11/2025 : 12:46:09 AM
|
These are similiar probems. Best regards, iniwoni


 |
Edited by - iniwoni on 07/11/2025 12:46:34 AM |
 |
|
ChaoC
USA
201 Posts |
Posted - 07/14/2025 : 11:12:20 AM
|
Hello iniwoni,
Thanks for the information. I think this may be a bug and I am checking with the developers.
Internal tracking ID: ORG-31701.
Best regards, Chao |
 |
|
iniwoni
20 Posts |
Posted - 07/14/2025 : 1:29:56 PM
|
Thank you,Chao!
Best regards, iniwoni |
 |
|
iniwoni
20 Posts |
Posted - 07/18/2025 : 03:25:46 AM
|
Hello,
I'd like to change the plot name in object manager as the screenshot. Which code should I use?
Best regards, iniwoni
 |
 |
|
ChaoC
USA
201 Posts |
Posted - 07/21/2025 : 11:07:04 AM
|
Hello iniwoni,
There are two ways:
1. Use lt_exec() with the legendupdate X-function: https://www.originlab.com/doc/en/X-Function/ref/legendupdate
E.g.:
op.lt_exec('legendupdate mode:=custom custom:="@U @LD"temp" @LD"room""') 2. Use originpro's label(): https://docs.originlab.com/originpro/classoriginpro_1_1base_1_1Label.html
E.g.:
gl=op.find_graph()[0]
legend=gl.label('legend')
legend.text='\l(1) %(1,@(@U @LD"temp" @LD"room"))\n\l(2) %(2,@(@U @LD"temp" @LD"room"))\n\l(3) %(3,@(@U @LD"temp" @LD"room"))'
Note: Be mindful of single and double quotes. Single quotes are not valid for LabTalk strings so make sure you use double quotes for the LabTalk string and single quotes for Python strings.
Best, Chao |
 |
|
minimax
360 Posts |
Posted - 07/22/2025 : 02:18:14 AM
|
Hi iniwoni,
We published a newer version of originpro, v1.1.13.
https://pypi.org/project/originpro/#history
It fixes the issue of op.graph_list options 'o' and 'p'.
You can upgrade from Connectivity - Python Packages dialog. |
 |
|
iniwoni
20 Posts |
Posted - 07/31/2025 : 2:28:47 PM
|
Thank you, Chao! Thank you,minimax! |
 |
|
|
Topic  |
|