siat 3.0.3__py3-none-any.whl → 3.0.10__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- siat/allin.py +2 -1
- siat/beta_adjustment.py +7 -0
- siat/beta_adjustment_china.py +4 -0
- siat/bond.py +14 -0
- siat/bond_base.py +2 -1
- siat/capm_beta.py +4 -0
- siat/common.py +17 -2
- siat/cryptocurrency.py +4 -0
- siat/fama_french.py +20 -2
- siat/financials.py +2 -0
- siat/financials2.py +2 -0
- siat/financials_china.py +2 -0
- siat/grafix.py +23 -1
- siat/holding_risk.py +2 -0
- siat/markowitz.py +47 -20
- siat/markowitz2.py +2422 -0
- siat/option_china.py +3 -0
- siat/option_pricing.py +2 -0
- siat/risk_adjusted_return.py +7 -0
- siat/risk_adjusted_return2.py +34 -24
- siat/risk_evaluation.py +11 -1
- siat/sector_china.py +2 -0
- siat/stock.py +5 -2
- siat/stock_profile.py +25 -1
- siat/stock_technical.py +35 -10
- {siat-3.0.3.dist-info → siat-3.0.10.dist-info}/METADATA +1 -1
- {siat-3.0.3.dist-info → siat-3.0.10.dist-info}/RECORD +29 -28
- {siat-3.0.3.dist-info → siat-3.0.10.dist-info}/WHEEL +0 -0
- {siat-3.0.3.dist-info → siat-3.0.10.dist-info}/top_level.txt +0 -0
siat/allin.py
CHANGED
siat/beta_adjustment.py
CHANGED
@@ -224,6 +224,8 @@ def draw2_betas(model,scope,ticker,betas):
|
|
224
224
|
plt.ylabel("贝塔系数",fontsize=12,fontweight='bold')
|
225
225
|
|
226
226
|
plt.gcf().autofmt_xdate() # 优化标注(自动倾斜)
|
227
|
+
plt.gca().set_facecolor('whitesmoke')
|
228
|
+
|
227
229
|
#plt.xticks(rotation=30)
|
228
230
|
plt.legend(loc='best')
|
229
231
|
|
@@ -701,6 +703,8 @@ def get_beta_hamada(stkcd,mktidx,yearlist,printout=True,graph=True):
|
|
701
703
|
#样式:bmh(好),classic,ggplot(好,图大),tableau-colorblind10,
|
702
704
|
#样式:seaborn-bright,seaborn-poster,seaborn-whitegrid
|
703
705
|
plt.style.use('bmh')
|
706
|
+
|
707
|
+
plt.gca().set_facecolor('whitesmoke')
|
704
708
|
plt.show()
|
705
709
|
|
706
710
|
return betas
|
@@ -744,6 +748,8 @@ def draw_hamada_factors(stkcd,mktidx,betas):
|
|
744
748
|
"\n(Benchmark on Market Index "+mktidx+")"
|
745
749
|
plt.title(title1,fontsize=12,fontweight='bold')
|
746
750
|
plt.style.use('ggplot')
|
751
|
+
|
752
|
+
plt.gca().set_facecolor('whitesmoke')
|
747
753
|
plt.show()
|
748
754
|
|
749
755
|
return
|
@@ -863,6 +869,7 @@ def get_beta_hamada2(stkcd,mktidx,printout=True,graph=True):
|
|
863
869
|
#样式:seaborn-bright,seaborn-poster,seaborn-whitegrid
|
864
870
|
plt.style.use('bmh')
|
865
871
|
plt.gcf().autofmt_xdate() # 优化标注(自动倾斜)
|
872
|
+
plt.gca().set_facecolor('whitesmoke')
|
866
873
|
plt.legend(loc='best')
|
867
874
|
plt.show(); plt.close()
|
868
875
|
|
siat/beta_adjustment_china.py
CHANGED
@@ -325,6 +325,8 @@ def get_beta_hamada_china_v0(stkcd,mktidx,start,end,printout=True,graph=True):
|
|
325
325
|
plt.style.use('bmh')
|
326
326
|
plt.legend(loc='best')
|
327
327
|
plt.gcf().autofmt_xdate() # 优化标注(自动倾斜)
|
328
|
+
plt.gca().set_facecolor('whitesmoke')
|
329
|
+
|
328
330
|
#plt.xticks(rotation=30)
|
329
331
|
plt.show()
|
330
332
|
|
@@ -364,6 +366,8 @@ def draw_hamada_factors_china(stkcd,mktidx,betas):
|
|
364
366
|
"\n(基于"+ticker_name(mktidx)+")"
|
365
367
|
plt.title(title1,fontsize=12,fontweight='bold')
|
366
368
|
plt.style.use('ggplot')
|
369
|
+
|
370
|
+
plt.gca().set_facecolor('whitesmoke')
|
367
371
|
plt.show()
|
368
372
|
|
369
373
|
return
|
siat/bond.py
CHANGED
@@ -1140,6 +1140,7 @@ def bond_malkiel1(aytm,yper,c,fv=100,mterm=1, \
|
|
1140
1140
|
#plt.gcf().autofmt_xdate() # 优化标注(自动倾斜)
|
1141
1141
|
plt.xticks(rotation=30)
|
1142
1142
|
|
1143
|
+
plt.gca().set_facecolor('whitesmoke')
|
1143
1144
|
plt.show(); plt.close()
|
1144
1145
|
|
1145
1146
|
return
|
@@ -1238,6 +1239,7 @@ def bond_malkiel2(aytm,yper,c,fv=100,mterm=1, \
|
|
1238
1239
|
#plt.tick_params(labelsize=11)
|
1239
1240
|
plt.xticks(rotation=30)
|
1240
1241
|
|
1242
|
+
plt.gca().set_facecolor('whitesmoke')
|
1241
1243
|
plt.show(); plt.close()
|
1242
1244
|
|
1243
1245
|
return
|
@@ -1333,6 +1335,8 @@ def bond_malkiel3(aytm,yper,c,fv=100,mterm=1):
|
|
1333
1335
|
titletxt="Malkiel\'s Law 3: Relationship btw Time to Maturity & Bond Price Change Speed"
|
1334
1336
|
|
1335
1337
|
plt.title(titletxt, fontsize=title_txt_size,fontweight='bold')
|
1338
|
+
|
1339
|
+
plt.gca().set_facecolor('whitesmoke')
|
1336
1340
|
plt.show(); plt.close()
|
1337
1341
|
|
1338
1342
|
return
|
@@ -1446,6 +1450,8 @@ def bond_malkiel4(aytm,yper,c,fv=100,mterm=1, \
|
|
1446
1450
|
#plt.tick_params(labelsize=11)
|
1447
1451
|
plt.xticks(rotation=30)
|
1448
1452
|
plt.title(titletxt,fontsize=title_txt_size,fontweight='bold')
|
1453
|
+
|
1454
|
+
plt.gca().set_facecolor('whitesmoke')
|
1449
1455
|
plt.show(); plt.close()
|
1450
1456
|
|
1451
1457
|
return
|
@@ -1542,6 +1548,8 @@ def bond_malkiel5(aytm,yper,c,fv=100,mterm=1, \
|
|
1542
1548
|
#plt.tick_params(labelsize=11)
|
1543
1549
|
plt.xticks(rotation=30)
|
1544
1550
|
plt.title(titletxt,fontsize=title_txt_size,fontweight='bold')
|
1551
|
+
|
1552
|
+
plt.gca().set_facecolor('whitesmoke')
|
1545
1553
|
plt.show(); plt.close()
|
1546
1554
|
|
1547
1555
|
return
|
@@ -2177,6 +2185,8 @@ def kpmg_rnpm1_cr(k1,theta,i1, \
|
|
2177
2185
|
plt.title(titletxt,fontsize=title_txt_size,fontweight='bold')
|
2178
2186
|
|
2179
2187
|
plt.xticks(rotation=30)
|
2188
|
+
|
2189
|
+
plt.gca().set_facecolor('whitesmoke')
|
2180
2190
|
plt.show(); plt.close()
|
2181
2191
|
|
2182
2192
|
return df
|
@@ -2280,6 +2290,8 @@ def kpmg_rnpm1_rf(k1,theta,i1, \
|
|
2280
2290
|
plt.title(titletxt,fontsize=title_txt_size,fontweight='bold')
|
2281
2291
|
|
2282
2292
|
plt.xticks(rotation=30)
|
2293
|
+
|
2294
|
+
plt.gca().set_facecolor('whitesmoke')
|
2283
2295
|
plt.show(); plt.close()
|
2284
2296
|
|
2285
2297
|
return df
|
@@ -2372,6 +2384,8 @@ def kpmg_rnpm1_rrd(k1,theta,i1, \
|
|
2372
2384
|
plt.title(titletxt,fontsize=title_txt_size,fontweight='bold')
|
2373
2385
|
|
2374
2386
|
plt.xticks(rotation=30)
|
2387
|
+
|
2388
|
+
plt.gca().set_facecolor('whitesmoke')
|
2375
2389
|
plt.show(); plt.close()
|
2376
2390
|
|
2377
2391
|
return df
|
siat/bond_base.py
CHANGED
@@ -976,7 +976,8 @@ def macaulay_theorem(
|
|
976
976
|
plt.title(titletxt,fontsize=title_txt_size,fontweight='bold')
|
977
977
|
plt.xlabel(footnote,fontsize=xlabel_txt_size)
|
978
978
|
plt.xticks(rotation=30)
|
979
|
-
|
979
|
+
|
980
|
+
plt.gca().set_facecolor('whitesmoke')
|
980
981
|
plt.show(); plt.close()
|
981
982
|
|
982
983
|
return df
|
siat/capm_beta.py
CHANGED
@@ -250,6 +250,8 @@ def plot_trend(titletxt,footnotetxt,df,power=1,axhline_value=1,axhline_label='')
|
|
250
250
|
plt.legend(loc='best')
|
251
251
|
plt.title(titletxt)
|
252
252
|
plt.xlabel(footnotetxt)
|
253
|
+
|
254
|
+
plt.gca().set_facecolor('whitesmoke')
|
253
255
|
plt.show()
|
254
256
|
|
255
257
|
return
|
@@ -739,6 +741,8 @@ def compare2_betas_yearly(ticker1,ticker2,mktidx,yearlist):
|
|
739
741
|
|
740
742
|
import datetime; today = datetime.date.today()
|
741
743
|
plt.xlabel("数据来源:新浪/stooq/fred,基于"+ticker_name(mktidx)+','+str(today))
|
744
|
+
|
745
|
+
plt.gca().set_facecolor('whitesmoke')
|
742
746
|
plt.show()
|
743
747
|
|
744
748
|
return betas1,betas2
|
siat/common.py
CHANGED
@@ -466,7 +466,8 @@ def portfolio_name(portfolio):
|
|
466
466
|
try:
|
467
467
|
name=portfolio[keylist[0]][2]
|
468
468
|
except:
|
469
|
-
name="PF1"
|
469
|
+
#name="PF1"
|
470
|
+
e=text_lang("投资组合","Investment Portfolio")
|
470
471
|
|
471
472
|
return name
|
472
473
|
|
@@ -1758,6 +1759,8 @@ def df_corr(df,fontsize=20):
|
|
1758
1759
|
footnote2="统计日期:"+str(stoday)
|
1759
1760
|
#plt.xlabel(footnote1+footnote2)
|
1760
1761
|
#plt.xticks(rotation=30); plt.yticks(rotation=0)
|
1762
|
+
|
1763
|
+
plt.gca().set_facecolor('whitesmoke')
|
1761
1764
|
plt.show()
|
1762
1765
|
|
1763
1766
|
return
|
@@ -2382,12 +2385,24 @@ def descriptive_statistics2(df,titletxt,footnote,decimals=4,sortby='tpw_mean', \
|
|
2382
2385
|
print("\n"+footnote)
|
2383
2386
|
|
2384
2387
|
else: #style打印
|
2388
|
+
"""
|
2385
2389
|
print("\n"+titletxt)
|
2386
2390
|
dst6sd= dst6.style.set_properties(**{'text-align': 'center'})
|
2387
2391
|
from IPython.display import display
|
2388
2392
|
display(dst6sd)
|
2389
2393
|
print(footnote+"\n")
|
2390
|
-
|
2394
|
+
"""
|
2395
|
+
# 处理表格标题
|
2396
|
+
dst6sd1=dst6.style.set_caption(titletxt).set_table_styles(
|
2397
|
+
[{'selector':'caption',
|
2398
|
+
'props':[('color','black'),('font-size','16px'),('font-weight','bold')]}])
|
2399
|
+
# 列居中
|
2400
|
+
dst6sd2=dst6sd1.set_properties(**{'text-align':'center'})
|
2401
|
+
|
2402
|
+
from IPython.display import display
|
2403
|
+
display(dst6sd2)
|
2404
|
+
print(footnote+"\n")
|
2405
|
+
|
2391
2406
|
return dst5
|
2392
2407
|
|
2393
2408
|
|
siat/cryptocurrency.py
CHANGED
@@ -200,6 +200,8 @@ def compCrypto_Price(product1,product2,days=30):
|
|
200
200
|
plt.ylabel("收盘价")
|
201
201
|
plt.xticks(rotation=30)
|
202
202
|
plt.legend(loc='best')
|
203
|
+
|
204
|
+
plt.gca().set_facecolor('whitesmoke')
|
203
205
|
plt.show()
|
204
206
|
|
205
207
|
return
|
@@ -249,6 +251,8 @@ def compCrypto_Return(product1,product2,days=30):
|
|
249
251
|
plt.ylabel("资本利得%")
|
250
252
|
plt.xticks(rotation=30)
|
251
253
|
plt.legend(loc='best')
|
254
|
+
|
255
|
+
plt.gca().set_facecolor('whitesmoke')
|
252
256
|
plt.show()
|
253
257
|
|
254
258
|
return
|
siat/fama_french.py
CHANGED
@@ -274,6 +274,8 @@ if __name__=='__main__':
|
|
274
274
|
scope='US'
|
275
275
|
rate_period='1Y'
|
276
276
|
rate_type='shibor'
|
277
|
+
|
278
|
+
rfd=get_rf_daily(start,end)
|
277
279
|
|
278
280
|
def get_rf_daily(start,end,scope='US',rate_period='1Y',rate_type='shibor'):
|
279
281
|
"""
|
@@ -487,7 +489,9 @@ def draw1_ff_factors(model,scope,factors,factor_type):
|
|
487
489
|
plt.title(title1,fontsize=12,fontweight='bold')
|
488
490
|
plt.ylabel('Mkt-RF',fontsize=12,fontweight='bold')
|
489
491
|
plt.xticks(factors.index,fontsize=8,rotation=30)
|
490
|
-
plt.legend(loc='best')
|
492
|
+
plt.legend(loc='best')
|
493
|
+
|
494
|
+
plt.gca().set_facecolor('whitesmoke')
|
491
495
|
plt.show()
|
492
496
|
|
493
497
|
if factor_type in ['SMB']:
|
@@ -504,6 +508,8 @@ def draw1_ff_factors(model,scope,factors,factor_type):
|
|
504
508
|
plt.ylabel('SMB',fontsize=12,fontweight='bold')
|
505
509
|
plt.xticks(factors.index,fontsize=8,rotation=30)
|
506
510
|
plt.legend(loc='best')
|
511
|
+
|
512
|
+
plt.gca().set_facecolor('whitesmoke')
|
507
513
|
plt.show()
|
508
514
|
|
509
515
|
if factor_type in ['HML']:
|
@@ -520,6 +526,8 @@ def draw1_ff_factors(model,scope,factors,factor_type):
|
|
520
526
|
plt.ylabel('HML',fontsize=12,fontweight='bold')
|
521
527
|
plt.xticks(factors.index,fontsize=8,rotation=30)
|
522
528
|
plt.legend(loc='best')
|
529
|
+
|
530
|
+
plt.gca().set_facecolor('whitesmoke')
|
523
531
|
plt.show()
|
524
532
|
|
525
533
|
if factor_type in ['RF']:
|
@@ -535,6 +543,8 @@ def draw1_ff_factors(model,scope,factors,factor_type):
|
|
535
543
|
plt.ylabel('RF %',fontsize=12,fontweight='bold')
|
536
544
|
plt.xticks(factors.index,fontsize=8,rotation=30)
|
537
545
|
plt.legend(loc='best')
|
546
|
+
|
547
|
+
plt.gca().set_facecolor('whitesmoke')
|
538
548
|
plt.show()
|
539
549
|
|
540
550
|
if factor_type in ['MOM']:
|
@@ -551,6 +561,8 @@ def draw1_ff_factors(model,scope,factors,factor_type):
|
|
551
561
|
plt.ylabel('Mom',fontsize=12,fontweight='bold')
|
552
562
|
plt.xticks(factors.index,fontsize=8)
|
553
563
|
plt.legend(loc='best')
|
564
|
+
|
565
|
+
plt.gca().set_facecolor('whitesmoke')
|
554
566
|
plt.show()
|
555
567
|
|
556
568
|
|
@@ -568,6 +580,8 @@ def draw1_ff_factors(model,scope,factors,factor_type):
|
|
568
580
|
plt.ylabel('RMW',fontsize=12,fontweight='bold')
|
569
581
|
plt.xticks(factors.index,fontsize=8)
|
570
582
|
plt.legend(loc='best')
|
583
|
+
|
584
|
+
plt.gca().set_facecolor('whitesmoke')
|
571
585
|
plt.show()
|
572
586
|
|
573
587
|
if factor_type in ['CMA']:
|
@@ -584,6 +598,8 @@ def draw1_ff_factors(model,scope,factors,factor_type):
|
|
584
598
|
plt.ylabel('CMA',fontsize=12,fontweight='bold')
|
585
599
|
plt.xticks(factors.index,fontsize=8)
|
586
600
|
plt.legend(loc='best')
|
601
|
+
|
602
|
+
plt.gca().set_facecolor('whitesmoke')
|
587
603
|
plt.show()
|
588
604
|
|
589
605
|
return
|
@@ -635,7 +651,9 @@ def draw2_ff_factors(model,scope1,scope2,factors1,factors2,factor_type):
|
|
635
651
|
title1="\n"+model+": "+scope1+" vs. "+scope2+", "+" Factor "+factor_type
|
636
652
|
plt.title(title1,fontsize=12,fontweight='bold')
|
637
653
|
plt.ylabel(factor_type,fontsize=12,fontweight='bold')
|
638
|
-
plt.legend(loc='best')
|
654
|
+
plt.legend(loc='best')
|
655
|
+
|
656
|
+
plt.gca().set_facecolor('whitesmoke')
|
639
657
|
plt.show()
|
640
658
|
|
641
659
|
return
|
siat/financials.py
CHANGED
@@ -1990,6 +1990,8 @@ def compare_dupont(tickerlist,fsdate='latest',scale1 = 10,scale2 = 10,hatchlist=
|
|
1990
1990
|
else:
|
1991
1991
|
plt.title(texttranslate("杜邦分析对比图"),fontsize=title_txt_size,fontweight='bold')
|
1992
1992
|
plt.xlim([min(tick_pos)-w,max(tick_pos)+w])
|
1993
|
+
|
1994
|
+
plt.gca().set_facecolor('whitesmoke')
|
1993
1995
|
plt.show()
|
1994
1996
|
|
1995
1997
|
#设置打印对齐
|
siat/financials2.py
CHANGED
@@ -909,6 +909,8 @@ def fs_analysis(tickers,fsdates=[],analysis_type='balance sheet', \
|
|
909
909
|
plt.legend(loc='best',fontsize=10)
|
910
910
|
plt.title("Dupont Identity Analysis")
|
911
911
|
plt.xlim([min(tick_pos)-w,max(tick_pos)+w])
|
912
|
+
|
913
|
+
plt.gca().set_facecolor('whitesmoke')
|
912
914
|
plt.show()
|
913
915
|
|
914
916
|
if printout:
|
siat/financials_china.py
CHANGED
@@ -764,6 +764,8 @@ def compare_dupont_china(tickerlist,fsdate='latest',scale1 = 10,scale2 = 10, \
|
|
764
764
|
plt.legend(loc='best')
|
765
765
|
plt.title("杜邦分析对比图")
|
766
766
|
plt.xlim([min(tick_pos)-w,max(tick_pos)+w])
|
767
|
+
|
768
|
+
plt.gca().set_facecolor('whitesmoke')
|
767
769
|
plt.show()
|
768
770
|
|
769
771
|
if printout:
|
siat/grafix.py
CHANGED
@@ -30,6 +30,11 @@ plt.rcParams['font.size'] = 13
|
|
30
30
|
plt.rcParams['xtick.labelsize']=11 #横轴字体大小
|
31
31
|
plt.rcParams['ytick.labelsize']=11 #纵轴字体大小
|
32
32
|
|
33
|
+
plt.rcParams['figure.facecolor']='whitesmoke' #背景颜色
|
34
|
+
#plt.rcParams['axes.facecolor']='whitesmoke' #背景颜色
|
35
|
+
#plt.figure(facecolor='whitesmoke')
|
36
|
+
|
37
|
+
|
33
38
|
title_txt_size=16
|
34
39
|
ylabel_txt_size=12
|
35
40
|
xlabel_txt_size=12
|
@@ -41,7 +46,7 @@ plt.rcParams['axes.grid']=False
|
|
41
46
|
#plt.rcParams['grid.color']='steelblue'
|
42
47
|
#plt.rcParams['grid.linestyle']='dashed'
|
43
48
|
#plt.rcParams['grid.linewidth']=0.5
|
44
|
-
|
49
|
+
|
45
50
|
|
46
51
|
#设置刻度线风格:in,out,inout
|
47
52
|
plt.rcParams['xtick.direction'] = 'in' # 将x轴的刻度线方向设置向内
|
@@ -262,6 +267,7 @@ def plot_line(df0,colname,collabel,ylabeltxt,titletxt,footnote,datatag=False, \
|
|
262
267
|
plt.legend(loc=loc,fontsize=legend_txt_size)
|
263
268
|
|
264
269
|
plt.gcf().autofmt_xdate() # 优化标注(自动倾斜)
|
270
|
+
plt.gca().set_facecolor('whitesmoke')
|
265
271
|
|
266
272
|
if '基金' in titletxt and '收盘价' in ylabeltxt:
|
267
273
|
ylabeltxt=ylabeltxt.replace('收盘价','单位净值')
|
@@ -520,6 +526,7 @@ def plot_line2_coaxial(df01,ticker1,colname1,label1, \
|
|
520
526
|
# 同轴绘图时,loc1/loc2未用上!
|
521
527
|
plt.legend(loc=loc1,fontsize=legend_txt_size)
|
522
528
|
plt.gcf().autofmt_xdate() # 优化标注(自动倾斜)
|
529
|
+
plt.gca().set_facecolor('whitesmoke')
|
523
530
|
|
524
531
|
plt.ylabel(ylabeltxt,fontsize=ylabel_txt_size)
|
525
532
|
plt.xlabel(footnote,fontsize=xlabel_txt_size)
|
@@ -703,6 +710,7 @@ def plot_line2_coaxial2(df01,ticker1,colname1,label1, \
|
|
703
710
|
# 同轴绘图时,loc1/loc2未用上!
|
704
711
|
plt.legend(loc=loc1,fontsize=legend_txt_size)
|
705
712
|
plt.gcf().autofmt_xdate() # 优化标注(自动倾斜)
|
713
|
+
plt.gca().set_facecolor('whitesmoke')
|
706
714
|
|
707
715
|
plt.ylabel(ylabeltxt,fontsize=ylabel_txt_size)
|
708
716
|
plt.xlabel(footnote,fontsize=xlabel_txt_size)
|
@@ -851,6 +859,7 @@ def plot_line2_twinx(df01,ticker1,colname1,label1, \
|
|
851
859
|
|
852
860
|
#自动优化x轴标签
|
853
861
|
plt.gcf().autofmt_xdate() # 优化标注(自动倾斜)
|
862
|
+
plt.gca().set_facecolor('whitesmoke')
|
854
863
|
|
855
864
|
plt.title(titletxt,fontweight='bold',fontsize=title_txt_size)
|
856
865
|
plt.show()
|
@@ -1040,6 +1049,7 @@ def plot_line2_twinx2(df01,ticker1,colname1,label1, \
|
|
1040
1049
|
#格式化时间轴标注
|
1041
1050
|
#plt.gca().xaxis.set_major_formatter(mdate.DateFormatter('%y-%m-%d'))
|
1042
1051
|
plt.gcf().autofmt_xdate() # 优化标注(自动倾斜)
|
1052
|
+
plt.gca().set_facecolor('whitesmoke')
|
1043
1053
|
|
1044
1054
|
plt.title(titletxt,fontweight='bold',fontsize=title_txt_size)
|
1045
1055
|
plt.show()
|
@@ -1244,6 +1254,7 @@ def draw_lines(df0,y_label,x_label,axhline_value,axhline_label,title_txt, \
|
|
1244
1254
|
#图示标题
|
1245
1255
|
plt.title(title_txt,fontweight='bold',fontsize=title_txt_size)
|
1246
1256
|
plt.gcf().autofmt_xdate() # 优化标注(自动倾斜)
|
1257
|
+
plt.gca().set_facecolor('whitesmoke')
|
1247
1258
|
|
1248
1259
|
# 若不绘制annotate,则绘制图例
|
1249
1260
|
if not annotate:
|
@@ -1436,6 +1447,7 @@ def draw_lines2(df0,y_label,x_label,axhline_value,axhline_label,title_txt, \
|
|
1436
1447
|
#图示标题
|
1437
1448
|
plt.title(title_txt,fontweight='bold',fontsize=title_txt_size)
|
1438
1449
|
plt.gcf().autofmt_xdate() # 优化标注(自动倾斜)
|
1450
|
+
plt.gca().set_facecolor('whitesmoke')
|
1439
1451
|
|
1440
1452
|
if not annotate:
|
1441
1453
|
plt.legend(loc=loc,fontsize=legend_txt_size)
|
@@ -1505,6 +1517,7 @@ def plot_barh(df,colname,titletxt,footnote,datatag=True, \
|
|
1505
1517
|
yticknames=list(df.index)
|
1506
1518
|
plt.yticks(df.index,yticknames)
|
1507
1519
|
|
1520
|
+
plt.gca().set_facecolor('whitesmoke')
|
1508
1521
|
plt.show(); plt.close()
|
1509
1522
|
|
1510
1523
|
return
|
@@ -1658,7 +1671,9 @@ def plot_2lines(df01,colname1,label1, \
|
|
1658
1671
|
plt.ylabel(ylabeltxt,fontsize=ylabel_txt_size)
|
1659
1672
|
plt.xlabel(footnote,fontsize=xlabel_txt_size)
|
1660
1673
|
plt.legend(loc='best',fontsize=legend_txt_size)
|
1674
|
+
|
1661
1675
|
plt.gcf().autofmt_xdate() # 优化标注(自动倾斜)
|
1676
|
+
plt.gca().set_facecolor('whitesmoke')
|
1662
1677
|
|
1663
1678
|
plt.show()
|
1664
1679
|
|
@@ -1898,6 +1913,9 @@ def plot_norm(mu,sd,graph='pdf',obs_num=100):
|
|
1898
1913
|
plt.tight_layout()
|
1899
1914
|
#plt.grid() #网格
|
1900
1915
|
plt.legend(loc='best',fontsize=legend_txt_size)
|
1916
|
+
|
1917
|
+
plt.gca().set_facecolor('whitesmoke')
|
1918
|
+
|
1901
1919
|
plt.show() #显示图形
|
1902
1920
|
|
1903
1921
|
return
|
@@ -2012,6 +2030,8 @@ def pandas2plttable(df,titletxt,firstColSpecial=True,colWidth=0.1,tabScale=2,cel
|
|
2012
2030
|
else:
|
2013
2031
|
plt.title(titletxt,fontweight='bold',fontsize=title_txt_size,x=title_x)
|
2014
2032
|
|
2033
|
+
plt.gca().set_facecolor('whitesmoke')
|
2034
|
+
|
2015
2035
|
plt.show()
|
2016
2036
|
|
2017
2037
|
return
|
@@ -2087,6 +2107,8 @@ def pandas2plttable2(df,titletxt,firstColSpecial=True,cellLoc='right'):
|
|
2087
2107
|
|
2088
2108
|
plt.title(titletxt)
|
2089
2109
|
|
2110
|
+
plt.gca().set_facecolor('whitesmoke')
|
2111
|
+
|
2090
2112
|
plt.show()
|
2091
2113
|
|
2092
2114
|
return
|
siat/holding_risk.py
CHANGED