我正在进行财务数据分析,并且具有以下json数据
data = {
'result 1': {
'Function values': [-0.006227277397795026, 0.06383399272822152],
'Optimized weights': [('bonds', 1.4711817429946462e-15), ('forex', 5.550786381057787e-17), ('bitcoin', 0.9999999999999982), ('gold', 1.3183117655012245e-16), ('nyse', 9.697481555102928e-21), ('restate', 1.9775692500329443e-16)]},
'result 2': {
'Function values': [-0.005261601871866209, 0.0458160221997947]
'Optimized weights': [('bonds', 0.3615398862486454), ('forex', 4.466610459077055e-25), ('bitcoin', 0.612702265453708), ('gold', 2.427629820084969e-25), ('nyse', 6.605705692605664e-25), ('restate', 0.02575784829764666)]},
'result 3': {
'Function values': [-0.006227277397795026, 0.06383399272822152]
'Optimized weights': [('bonds', 1.4712010644711342e-15), ('forex', 5.55073975746577e-17), ('bitcoin', 0.9999999999999982), ('gold', 1.3183006923981202e-16), ('nyse', 1.1072819449579044e-20), ('restate', 1.977567049973079e-16)]},
'result 4': {
'Function values': [-0.0026994057255751948, 0.022810143209823008]
'Optimized weights': [('bonds', 0.1799574677817418), ('forex', 4.974066668895019e-25), ('bitcoin', 0.3047792953486622), ('gold', 0.0), ('nyse', 0.0), ('restate', 0.5152632368695961)]}
}
目标是制作以下类型的图形,其中Function values
绘制在散点图上,并标有特定颜色的点,下面的条形图中将使用相同的颜色表示其{{ 1}}值。
我知道如何使用matplotlib绘制简单的散点图和条形图
Optimized weights
但是在这里它们是分开的。有什么可以像我上图那样将它们组合起来的吗?谢谢