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:
Only the poster of this message, and the Moderator can edit the message.
Screensize:
640 x 480
800 x 600
1024 x 768
1280 x 1024
UserName:
Password:
Anti-Spam Code:
Format Mode:
Basic
Help
Prompt
Format:
Font
Andale Mono
Arial
Arial Black
Book Antiqua
Century Gothic
Comic Sans MS
Courier New
Georgia
Impact
Lucida Console
Script MT Bold
Stencil
Tahoma
Times New Roman
Trebuchet MS
Verdana
Size
1
2
3
4
5
6
Color
Black
Red
Yellow
Pink
Green
Orange
Purple
Blue
Beige
Brown
Teal
Navy
Maroon
LimeGreen
Forum:
Forum for Python
Subject:
Message:
* HTML is OFF
*
Forum Code
is ON
Smilies
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? [url]https://my.originlab.com/ftp/forum_and_kbase/Images/err_data.zip[/url] ---------------------------------------------- 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)
Check here to subscribe to this topic.
The Origin Forum
© 2020 Originlab Corporation
Snitz Forums 2000