我正在使用来自NREL的Floris库来模拟风力涡轮机之后的风尾迹(请参阅https://github.com/NREL/floris)。在“入门”(参见floris.py)部分的示例1中,我正在绘制单个涡轮机的结果。这是输出:
但是,我想在右边添加边图例栏(见黑圈),如下所示:
我无法显示完整的代码,因为来自NREL的floris库有很多用户定义的函数(这就是我提供链接的原因)。我提到的示例的代码是:
import matplotlib.pyplot as plt
import floris.tools as wfct
# Initialize the FLORIS interface fi
# For basic usage, the florice interface provides a simplified interface to
# the underlying classes
file_dir = '...\example_input.json'
fi = wfct.floris_interface.FlorisInterface(file_dir)
# Calculate wake
fi.calculate_wake()
# Get horizontal plane at default height (hub-height)
hor_plane = fi.get_hor_plane()
# Plot and show
fig, ax = plt.subplots()
wfct.visualization.visualize_cut_plane(hor_plane, ax=ax)
plt.show()有人能帮我吗?
发布于 2021-06-21 12:43:39
NREL的团队已经解决了这个问题:
# Plot and show
fig, ax = plt.subplots()
im = wfct.visualization.visualize_cut_plane(hor_plane, ax=ax)
fig.colorbar(im, ax=ax)
plt.show()为了提高可视化效果,我增加了下一部分:
fig, ax = plt.subplots()
im = wfct.visualization.visualize_cut_plane(hor_plane,ax=ax)
cax = fig.add_axes([ax.get_position().x1+0.01,ax.get_position().y0,0.02,ax.get_position().height])
fig.colorbar(im, cax=cax, label='m/s') # alternativa: fig.colorbar(...)https://stackoverflow.com/questions/68067012
复制相似问题