Module dcg_sci_tool.plot.plot_scatter_color
Functions
def plot_scatter_color(input_csv_file: str,
max_threshold=None,
min_threshold=None,
special_point_list=None,
x_label: str = 'PCA 1',
y_label: str = 'PCA 2',
colorbar_label: str = 'Energy (eV/atom)')-
绘制带颜色映射的散点图,可自定义阈值范围,高于或低于阈值的点将使用统一颜色。 采用viridis(翠绿色)颜色映射方案,适合色盲友好型视觉效果。 入参文件格式要求:CSV文件,前两列为点的X Y坐标,第三列为用于颜色映射的Z值。
Args
input_csv_file- 输入CSV文件路径,文件前两列是点的X Y坐标,第三列是用于颜色映射的Z值
max_threshold- 最大阈值,可选,默认为Z数据的最大值,如果不设,则没有色阶最大值截断
min_threshold- 最小阈值,可选,默认为Z数据的最小值,如果不设,则没有色阶最小值截断
special_point_list- 可选,包含特定点坐标和标签的字典列表,格式为 [{'coords': (x, y), 'label': '点标签'}, …]
x_label- X轴标签
y_label- Y轴标签
colorbar_label- Colorbar标签
示例用法:
调用函数 plot_scatter_color( input_csv_file='111.csv', max_threshold=-2, min_threshold=-6, x_label='PCA 1', y_label='PCA 2', colorbar_label='Energy (eV/atom)' )