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
 Why colourmap for the second group not work

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
leoxiong Posted - 11/25/2025 : 8:55:27 PM
I used Python to plot two sets of data. Both underwent grouping operations followed by colormap application. However, only the first set's colors take effect. Regardless of which set is placed first, the second set's colors consistently appear black.
When opening Origin's plot properties under the Group tab, the symbol edge color fails to display correctly. The “Increment” setting is set to “Individual,” with the default being “None.” Why is this happening?

https://my.originlab.com/ftp/forum_and_kbase/Images/err_data.zip

----------------------------------------------
import os
import pandas as pd
import originpro as op


def plot_excel_sheets(excel_path):
book_name = os.path.splitext(os.path.basename(excel_path))[0]
wb = op.new_book('w', book_name)

xls = pd.ExcelFile(excel_path)
for s_name in xls.sheet_names:
df = xls.parse(s_name)
if df.empty:
continue

X = df.iloc[:, 0]
y_cols = df.iloc[:, 1:]
n_y = y_cols.shape[1]
if n_y == 0:
continue
headers = y_cols.columns.tolist()

wks = wb.add_sheet(s_name)
wks.from_list(0, X, lname='pd')
for i, h in enumerate(headers, 1):
wks.from_list(i, y_cols.iloc[:, i-1], lname=h)

graph = op.new_graph(lname=book_name+"_"+s_name)
gl = graph[0]

half = n_y // 2
# line
if half:
line_rng = f'[{book_name}]{s_name}!(A,B:{half+1})'
plot = gl.add_plot(line_rng, type='l')
gl.group(True, 0, half-1)
plot.set_cmd('-w 1500')
plot.colormap = 'Color4Line'

# scatter
if n_y > half:
scat_rng = f'[{book_name}]{s_name}!(A,{half+2}:{n_y+1})'
plot = gl.add_plot(scat_rng, type='s')
gl.group(True, half, n_y-1)
plot.set_cmd('-z 9')
#plot.set_cmd('-z 9','-csem Color4Line')
plot.colormap = 'Color4Line'

gl.rescale()


if __name__ == '__main__':
EXCEL_FILE = r'C:\Users\DELL\Desktop\example.xlsx'
plot_excel_sheets(EXCEL_FILE)
1   L A T E S T    R E P L I E S    (Newest First)
ChaoC Posted - 11/26/2025 : 1:41:43 PM
Hello,

You can take the graph you created with this code, open the Plot Details tab, and go to the 'Group' tab for the second group. For 'Symbol Edge Color', set the increment to "By One".
Right-click the graph title bar and select 'Save Template As', give it a name, and save it.

Then change your code to use the template for the graph:

graph = op.new_graph(lname=book_name+"_"+s_name, template=r'C:\your\filepath\templatename.otpu')

Rerun the code. It should now follow the colormap you've used.

Best,
Chao

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