-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_datafile_columns.py
More file actions
59 lines (42 loc) · 1.64 KB
/
plot_datafile_columns.py
File metadata and controls
59 lines (42 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
"""
Imports a text-based data file and plots multiple specified columns
into a single scatter graph in OriginPro.
This script performs the following steps:
1. Reads a tab-delimited text file into a pandas DataFrame.
2. Imports the DataFrame into a new worksheet in the current Origin project.
3. Creates a new graph using a 'scatter' template.
4. Iterates through a specified range of column indices, plotting each one
as a separate data series against the first column (index 0) on the X-axis.
5. Groups all the plots on the graph layer to apply uniform styling.
6. Customizes the grouped plots with a 'Candy' colormap, varied symbol
shapes, and a larger symbol size.
7. Adjusts the legend's font size, position, and removes its frame.
8. Finally, rescales the axes to fit all plotted data.
"""
import pandas as pd
import originpro as op
df=pd.read_table('C:/Users/ketan/OneDrive/Desktop/LTNO-MN-newCp.txt',)
wks = op.new_sheet()
wks=op.find_sheet()
wks.from_df(df)
graph = op.new_graph(template='scatter')
gl=graph[0]
# plot whole sheet as XY plot
ind=78
plot = gl.add_plot(wks,colx=0,coly=ind)
for ind in range(10,202,25):
plot = gl.add_plot(wks,colx=0,coly=ind)
#plot = gl.add_plot(f'{wks.lt_range()}!(?,1:end)')
# group the plots and control plots setting in group
gl.group()
plot.colormap = 'Candy'
plot.shapelist = [3, 2, 1]
plot.symbol_size=5
gl.rescale()
# Customize Legend
lgnd = gl.label('Legend')
lgnd.set_int('fsize',10 )
lgnd.set_int('left',105.51378)
lgnd.set_int('top',4.9533)
lgnd.set_int('showframe',0)
--------------------------------------------------------------------------------------------------------------------