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
 All Forums
 Origin Forum for Programming
 Forum for Python
 merge graphs

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
ulhong84 Posted - 08/09/2022 : 9:06:09 PM
Origin Ver. and Service Release (Select Help-->About Origin):
Operating System:OriginPro 2002 (9.9.0220)

I have ten graphs. The name of graphs is graph1, graph2, graph3..... graph10.
I merged these graphs and made the template.
How can I can merge the graphs in the code builder?



3   L A T E S T    R E P L I E S    (Newest First)
cpyang Posted - 04/02/2023 : 10:47:03 AM
hi ulhong84

If the purpose is to make a template, why not do it in Origin in GUI so you can easily tweak it until it looks right?

CP
antalfee Posted - 04/01/2023 : 3:01:16 PM
To merge the graphs in code, you can use a graphing library such as Matplotlib in Python. Here is an example code snippet that shows how to merge the 10 graphs into a single template using Matplotlib:
import matplotlib.pyplot as plt

# Load each graph into a separate subplot
fig, axs = plt.subplots(2, 5, figsize=(20, 10))
axs[0, 0].imshow(graph1)
axs[0, 1].imshow(graph2)
axs[0, 2].imshow(graph3)
axs[0, 3].imshow(graph4)
axs[0, 4].imshow(graph5)
axs[1, 0].imshow(graph6)
axs[1, 1].imshow(graph7)
axs[1, 2].imshow(graph8)
axs[1, 3].imshow(graph9)
axs[1, 4].imshow(graph10)

# Hide the axis labels and ticks
for ax in axs.flat:
ax.set(xticks=[], yticks=[], xlabel='', ylabel='')

# Adjust the layout and padding of the subplots
plt.subplots_adjust(wspace=0, hspace=0, left=0, right=1, bottom=0, top=1)

# Save the merged graph as an image file
plt.savefig('merged_graphs.png', dpi=300, bbox_inches='tight')
YimingChen Posted - 08/10/2022 : 08:50:53 AM
You need to call Labtalk X-fucntion from Python with lt_exec(), see the code below to merge 10 graphs:

import originpro as op
ids = list(range(1,11))
graphs = ["Graph" + str(i) for i in ids]
graphs = '\n'.join(graphs)
ltStr = f'merge_graph option:=specified option:=specified graphs:="{graphs}" row:=2 col:=5;'
op.lt_exec(ltStr)


James

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000