File Exchange
Try Origin for Free
The Origin Forum
Home
|
Profile
|
Register
|
Active Topics
|
Members
|
Search
|
FAQ
|
Send File to Tech support
All Forums
Origin Forum for Programming
Forum for Python
Applying theme to a graph using python
Note:
You must be registered in order to post a reply.
To register,
click here
. Registration is FREE!
Screensize:
640 x 480
800 x 600
1024 x 768
1280 x 1024
UserName:
Password:
Anti-Spam Code:
Format Mode:
Basic
Help
Prompt
Format:
Font
Andale Mono
Arial
Arial Black
Book Antiqua
Century Gothic
Comic Sans MS
Courier New
Georgia
Impact
Lucida Console
Script MT Bold
Stencil
Tahoma
Times New Roman
Trebuchet MS
Verdana
Size
1
2
3
4
5
6
Color
Black
Red
Yellow
Pink
Green
Orange
Purple
Blue
Beige
Brown
Teal
Navy
Maroon
LimeGreen
Message:
* HTML is OFF
*
Forum Code
is ON
Smilies
[quote][i]Originally posted by Iandex[/i] [br]Hi, I want to apply a saved theme to a graph using external python code. I was trying to do smth like this: import originpro as op contour_graph = op.new_graph('maptest',template='TriContour') contour_layer = contour_graph[0] plot = contour_layer.add_plot(page, coly=1,colx=0,colz=2, type= 243) theme_path= r'C:\path\test map theme.OTH' contour_graph.activate() try: success = contour_graph.lt_exec(f'themeApply2g theme:="{theme_path}";') if success: print("Theme applied successfully.") else: print("Failed to apply theme, unknown error.") except Exception as e: print(f"Execution error: {e}") contour_layer.rescale() I get an error. op.lt_exec(f'themeApply2g theme:="{theme_path}";') just plots the map and does not apply the format. How can I apply the format then? [/quote]
Check here to include your profile signature.
Check here to subscribe to this topic.
T O P I C R E V I E W
Iandex
Posted - 09/10/2024 : 04:53:45 AM
Hi,
I want to apply a saved theme to a graph using external python code. I was trying to do smth like this:
import originpro as op
contour_graph = op.new_graph('maptest',template='TriContour')
contour_layer = contour_graph[0]
plot = contour_layer.add_plot(page, coly=1,colx=0,colz=2, type= 243)
theme_path= r'C:\path\test map theme.OTH'
contour_graph.activate()
try:
success = contour_graph.lt_exec(f'themeApply2g theme:="{theme_path}";')
if success:
print("Theme applied successfully.")
else:
print("Failed to apply theme, unknown error.")
except Exception as e:
print(f"Execution error: {e}")
contour_layer.rescale()
I get an error.
op.lt_exec(f'themeApply2g theme:="{theme_path}";')
just plots the map and does not apply the format.
How can I apply the format then?
1 L A T E S T R E P L I E S (Newest First)
YimingChen
Posted - 09/10/2024 : 09:10:54 AM
The Xfunction
themeApply2g
only accepts the theme name as input. e.g.
themeApply2g theme:="test map theme"
So you need to install the theme by dragging the theme file into Origin workspace.
Also for the
lt_exec()
function, it always returns None by design.
James
The Origin Forum
© 2020 Originlab Corporation
Snitz Forums 2000