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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
| import pandas as pd import plotly.graph_objects as go
coal_rate_data = pd.read_excel('data/coal_rate.xlsx', header=None, sheet_name='Sheet1', skiprows=1, names=['Load', 'Design_CR', 'Test_CR'])
layout = go.Layout( title=dict( text='实际煤耗与设计煤耗对比', x=0.5, y=0.9, xanchor='center', yanchor='top', font=dict( size=20, color='black' ), ), paper_bgcolor='rgba(255, 255, 255, 100)', plot_bgcolor='rgba(255, 255, 255, 100)',
xaxis=dict( title='负荷率', titlefont_size=16, tickfont_size=14, showline=True, showgrid=False, gridcolor='rgb(200, 200, 200)', linecolor='rgb(200, 200, 200)', linewidth=2, showticklabels=True, tickangle=0, tickmode='linear', dtick=50, tick0 = 0, ticks='outside', minor_ticks='inside', minor=dict( ticklen=4, tickwidth=1, tickcolor='rgb(200, 200, 200)', tickmode='auto', ), ), yaxis=dict( title='煤耗', titlefont_size=16, tickfont_size=14, showline=True, showgrid=False, gridcolor='rgb(200, 200, 200)', linecolor='rgb(200, 200, 200)', linewidth=2, showticklabels=True, tickangle=0, tickmode='linear', dtick=20, ticks='outside', minor_ticks='inside', minor=dict( ticklen=4, tickwidth=1, tickcolor='rgb(200, 200, 200)', tickmode='auto', ), ), legend=dict( x=0, y=0, bgcolor='rgba(255, 255, 255, 100)', bordercolor='rgba(255, 255, 255, 100)' ), )
fig = go.Figure(layout=layout) fig.add_trace( go.Scatter(x=coal_rate_data['Load'], y=coal_rate_data['Design_CR'], name='设计发电煤耗', mode='lines+markers')) fig.add_trace( go.Scatter(x=coal_rate_data['Load'], y=coal_rate_data['Test_CR'], name='测试发电煤耗', mode='lines+markers')) fig.show(config={"displayModeBar": True, "showTips": True})
|