Tell me please! How can I change the color of the trend line equation? In one graph, I have two trend lines and I need to distinguish them somehow.
This code adds data to the excel file and plots variables with a power function. You can get data here: https://drive.google.com/file/d/1MmUK1og3cELJ1LBdkwYcQS4HVtJl5_Ft/view?usp=sharing
Thanks for any help!
import pandas as pd resData = pd.read_excel("resData.xlsx") writer = pd.ExcelWriter('result'+'.xlsx', engine='xlsxwriter') sheet_name = 'sheet1' resData.to_excel(writer, sheet_name=sheet_name, index=False) workbook = writer.book worksheet = writer.sheets[sheet_name] chart = workbook.add_chart({'type': 'scatter'}) max_row = len(resData) for i in range(len(resData.columns)-1): if i==0: trendcol="blue" else:trendcol="red" col = i + 1 chart.add_series({ 'name': [sheet_name, 0, col], 'categories': [sheet_name, 1, 0, max_row, 0], 'values': [sheet_name, 1, col, max_row, col], 'marker': {'type': 'diamond', 'size': 8}, 'trendline': {'type': 'power', 'display_equation':True,#display_equation задает уравнение линии тренда 'line': {'color': trendcol,'width': 2,}} }) chart.set_x_axis({'name': 'X'}) chart.set_y_axis({'name': 'Y'}) worksheet.insert_chart('E8', chart, {'x_scale': 1.5, 'y_scale': 2}) writer.save() 