Hi salman,
We made an example to show how to connect Origin in Python using OriginExt to create graphs. You can download the zip file in the link:
https://www.dropbox.com/s/trgoq3ia5jskhwj/OriginExtGraph.zip?dl=0
You can place the project file "PyGraphEx.opju" in the zip file to Origin's User Files folder. Create a folder C:\Test for the folder of the created image, run the py file in the zip file, and it will create a graph to replace the project's data with data specified in py file, and export the created graph to your defined folder. In this way you can plot any number of variables in Python.
Note that if you want to run the py file without opening Origin, you must open Origin by Run as administrator at least once.
The created graph by py file is shown as below:

The Python script is pasted here:
#This example requires to install OriginExt package
import OriginExt as oe
#keep one copy of Origin running only
app = oe.ApplicationSI()
app.Visible = app.MAINWND_SHOW
#Assume the sample project file is in Origin's User Files folder
uff = app.Path(app.APPPATH_USER)
strOpju = uff + 'PyGraphEx.opju'
app.Load( strOpju, False )
bkNames=['Book1', 'Book2']
#Change y data in Book1 and Book2 with following data and update graph
bkData = [ [20.89296, 0.22387, 54.95409, 0.10471, 1.90546, 60.25596],
[0.00251, 0.00354, 0.00225, 0.00383, 0.00296, 0.0023],
[0.20893, 5.7544, 1.04713, 2.51189, 0.1122, 24.54709, 0.70795],
[0.00475, 0.00325, 0.004, 0.00359, 0.00512, 0.00278, 0.00406],
[3.23594, 54.95409, 0.14454, 4.46684, 0.6166],
[0.00418, 0.00282, 0.0066, 0.004, 0.00536],
[23.98833, 1.58489, 34.67369, 13.18257, 75.85776],
[0.0068, 0.00957, 0.00658, 0.00724, 0.00584],
[95.49926, 5.01187, 10.47129, 1.25893, 9.77237, 16.2181, 23.44229],
[0.00631, 0.01006, 0.00875, 0.01224, 0.00896, 0.00819, 0.00769],
[10.71519, 11.74898, 89.12509, 1.12202, 32.35937, 1.44544] ]
for i, strbk in enumerate( bkNames ):
sheet = app.FindWorksheet( strbk )
bk = sheet.Parent
#Change data in first three sheets in each book
for j in range(3):
bk[j].SetData( bkData[ 2*j+6*i : 2*j+2+6*i ] )
#Delete Book3 and the legend for its curves in the graph
app.DestroyPage('Book3')
gl = app.FindGraphLayer( 'Graph1' )
#Execute LT on the context of the graph layer
gl.LT_execute( 'label -r Legend3;' )
#Force to recalculate apparant linear fit before exporting graphs
app.LT_execute( 'run -p au;')
#Export Graph1 to a custom folder. File name is Test.png and width is 2000.
imgPath='C:\\Test'
app.LT_set_str( '%A', imgPath )
gp = gl.Parent
gp.LT_execute( 'expGraph type:=png filename:=Test path:=%A overwrite:=replace tr1.Unit:=2 tr1.Width:=2000' )
print( 'Graph is exported to: %s\Test.png .' %(imgPath) )
#Exit Origin
app.Exit()
del app
Sam
OriginLab Technical Services