T O P I C R E V I E W |
66de250 |
Posted - 06/14/2024 : 04:32:41 AM May I ask if there is a horizontal line on the title of my coordinate axis? How can I use labtalk to eliminate it? Thank you! |
5 L A T E S T R E P L I E S (Newest First) |
NicholasSupport |
Posted - 06/17/2024 : 3:46:04 PM Hello,
While working through your code, it came to light that the "overscore" (line above text) issue is something that appears in the Chinese version of Origin. However, it does not appear in the English version.
I will continue working through your code, but in the meantime could you try running your process in the English version?
To switch, simply open Origin, go to Help: Change Language...
 (This is unavailable on my computer but should be available for yours.)
Let me know if this solves the issue.
Best,
Nicholas G. nicholas@originlab.com OriginLab Technical Support Team |
66de250 |
Posted - 06/15/2024 : 02:50:58 AM Hello Nicholas, thank you very much for your reply! There is no /ab() in my code, and the corresponding option in the text settings window is also not checked, which is why I am very puzzled by the situation mentioned. I will describe in detail the steps and the scenario I used. I have three project files in the '.opju' format (numbered 1, 2, and 3), each containing several workbooks, with each workbook having three worksheets. I want to merge the contents of the three files using LabTalk commands, but directly merging them would cause conflicts in the long and short names of the workbooks in the project files (i.e., there are files with the same names). My needs is that the workbooks from the third file should be last, and the second in the middle. I am new to LabTalk and only know a few basic commands. My solution is: First, double-click to open the first project file and use LabTalk commands to save the number of workbooks to the first variable; Use the 'doc -o' command to open the second project file and count and save to the second variable; Use 'doc -o' to open the third project file, count, and save to the third variable; In the third project file, use the 'win -r' command and 'page.longname$=' to rename all the workbooks' short and long names. Use the 'doc -as' command to append the contents of the second project file directly to this file (third project file), then rename the appended workbooks' long and short names. The operation on the first project file is similar to the above steps. The final effect is to arrange the workbooks from the first file to the last workbook of the third project file in order, with each workbook having the same long and short names; Use commands to copy and merge the contents of the second column of the second worksheet of each workbook into a new workbook 'export' from the second to the Nth column, the content of the first column being unimportant; Then, in the second line after the last line of 'export', find and fill in the maximum value of the second to the Nth column, then copy the maximum values to a new worksheet 'draw', with the first column as the X-axis and the second column as the maximum values. Then, use the commands mentioned above to draw. All the above steps are completed using commands, and the final result graph showed the issue I asked about. Later, I opened another project file worksheet directly to plot using the commands, rather than the commands 'doc -o' and 'doc -as', and did not encounter the underlining problem. Below are all my command codes: string opj1$ = "1.opju"; //////////First project file string opj2$ = "2.opju"; //////////Second project file string opj3$ = "3.opju"; //////////Third project file int opj_num = 3; //////////How many project files are there?The maximum is three. int sign = 2; //////////How many pictures in a group? int step_num = 2; //////////The step size of the X-axis int model = 1; //////////Pattern of drawing
StringArray opj; opj.setsize(opj_num); for(int index=1; index<=opj.getsize(); index++){ opj.SetAtGrow(index, opj$(index)$); }
int total_workbook_1 = 0; int total_workbook_2 = 0; int total_workbook_3 = 0;
int total_workbook = 0; doc -e W{total_workbook_1++;total_workbook++;}; if(opj_num > 1){ doc -o %(opj.GetAt(2)$); doc -e W{total_workbook_2++;total_workbook++;}; if(opj_num == 2){ int temp = 1; doc -e W{ win -r %(page.name$) Defaul$(total_workbook_1+temp); page.longname$ = page.name$; temp++; } doc -as %(opj.GetAt(1)$); temp = 1; doc -e W{win -ch 1;}; for(int index=1; index<=total_workbook_1; index++){ win -a Defaul$(index); win -r %(page.name$) Defaul$(temp); page.longname$ = page.name$; temp++; } for(int index=1; index<=total_workbook; index++){ win -a Defaul$(index); } } }
if(opj_num == 3){ doc -o %(opj.GetAt(3)$); doc -e W{total_workbook_3++;total_workbook++;}; int temp = 1; doc -e W{ win -r %(page.name$) Defaul$(total_workbook_1+total_workbook_2+temp); page.longname$ = page.name$; temp++; } doc -as %(opj.GetAt(2)$); temp = 1; doc -e W{win -ch 1;}; for(int index=1; index<=total_workbook_2; index++){ win -a Defaul$(index); win -r %(page.name$) Defaul$(total_workbook_1+temp); page.longname$ = page.name$; temp++; } doc -as %(opj.GetAt(1)$); temp = 1; doc -e W{win -ch 1;}; for(int index=1; index<=total_workbook_1; index++){ win -a Defaul$(index); win -r %(page.name$) Defaul$(temp); page.longname$ = page.name$; temp++; } for(int index=1; index<=total_workbook; index++){ win -a Defaul$(index); } }
int data_lastrow=0; string Graph_name$ = "";
int flag = 0; doc -e W{ string wbname$ = page.name$; if(!flag){ colcopy irng:=[%(wbname$)]Data!1 orng:=[<new name:=export>]<new name:=Data>!<new name:=wavelength>; range export_col_1 = [export]Data!1; win -a export; data_lastrow = wks.maxrows; Graph_name$ = "Graph_"; wks.nrows += 2; export_col_1[data_lastrow+2]$ = "极大"; flag++; } if(flag <= total_workbook){ colcopy irng:=[%(wbname$)]Data!2 orng:=[export]!<new>; range op = [export]Data!$(flag+1); op[data_lastrow+2] = max(op); wcellcolor c:=color(orange) irng:=op[data_lastrow+2]; win -a export; sec -p 0.05; wks.col$(wks.ncols).width = 5; wks.col$(wks.ncols).lname$ = $(flag); wks.col$(wks.ncols).unit$ = ""; win -a %(wbname$); win -cwd %(wbname$); plotxy iy:=[export]Data!(1,$(flag+1))[1:$(data_lastrow)] plot:=200 ogl:=[<new name:=%(Graph_name$)$(flag)>]; } flag++; }
newbook name:="draw" option:=lsname; wks.NAME$ = "Data"; wks.ncols = 4; wks.nrows = total_workbook; wks.col$(3).type = 4; range temp1 = [draw]Data!1; range temp2 = [draw]Data!2; range temp3 = [draw]Data!3; range temp4 = [draw]Data!4; double step = 0.01*step_num;
for(int i=1, row1=0, row2=0; (i<=total_workbook); i++, row1+=1, row2+=2){ for(int j=1; j<=sign; j++){ if(row2 < total_workbook){ temp1[j+row2] = step*i; temp3[j+row2] = step*i; } if(row1 < total_workbook-1){ range op = [export]Data!$(row1+j+1); temp2[j+row1] = op[data_lastrow+2]; temp4[j+row1] = op[data_lastrow+2]; } } } plotxy iy:=[draw]Data!(1,2) plot:=201 ogl:=[<new name:=Result_Gain>]; if(model) label -xb \f:Times New Roman(\p120(\b(Pumped Region Length (cm)))); else label -xb \f:Times New Roman(\p120(\b(Unpumped Region Length (cm)))); label -yl \f:Times New Roman(\p120(\b(Output Intensity (a.u.))));
sec -p 0.1; layer.y.showlabel = 0; layer.y.thickness = 2; layer.y.ticks = 0; layer.showframe=1; set %c -c 2; layer.x.label.font = font(Times New Roman); layer.x.label.bold = 1; layer.x.ticks = 1; layer.x.thickness = 2; layer.x2.thickness = 2; set %C -k 20;
win -a export; win -a draw; win -a Result_Gain;
quote: Originally posted by NicholasSupport
Good morning,
Thank you for reaching out, Hang.
The issue appears to be that your axis titles have been formatted with a bar above the text. This occurs when text appears with this syntax:
\ab(Text with a bar above it)
If you can find where the "\ab" is coming from you an remove that and the overline bar.
Are you able to find the "\ab" in your code? I copied your code and did not get any overline bar so I suspect there may be a slight difference between the code you posted on the forum and the code that your Origin is running.
Correct me if I am wrong and we will discuss other possibilities.
Thank you.
Best,
Nicholas G. nicholas@originlab.com OriginLab Technical Support Team
|
NicholasSupport |
Posted - 06/14/2024 : 09:14:10 AM Good morning,
Thank you for reaching out, Hang.
The issue appears to be that your axis titles have been formatted with a bar above the text. This occurs when text appears with this syntax:
\ab(Text with a bar above it)
If you can find where the "\ab" is coming from you an remove that and the overline bar.
Are you able to find the "\ab" in your code? I copied your code and did not get any overline bar so I suspect there may be a slight difference between the code you posted on the forum and the code that your Origin is running.
Correct me if I am wrong and we will discuss other possibilities.
Thank you.
Best,
Nicholas G. nicholas@originlab.com OriginLab Technical Support Team |
66de250 |
Posted - 06/14/2024 : 06:11:27 AM Initially, I opened the first project file. To open the second project file in it, I used the command doc -o. Then, I opened the third project file in the second file using a command. In the third file, I used the command doc -as to add the contents of the first two project files to the third file. After processing the data, I used the above commands to plot. |
66de250 |
Posted - 06/14/2024 : 04:45:23 AM The labtalk commands I use are as follows: plotxy iy:=[draw]Data!(1,2) plot:=201 ogl:=[<new name:=Result_Gain>]; label -xb \f:Times New Roman(\p120(\b(Pumped Region Length (cm)))); label -yl \f:Times New Roman(\p120(\b(Output Intensity (a.u.))));
sec -p 0.1; layer.y.showlabel = 0; layer.y.thickness = 2; layer.y.ticks = 0; layer.showframe=1 set %c -c 2; layer.x.label.font = font(Times New Roman); layer.x.label.bold = 1; layer.x.ticks = 1; layer.x.thickness = 2; layer.x2.thickness = 2; set %C -k 20; |
|
|