【问题标题】:How to make matplotlib markers colorblind-friendly in a simple way?如何以简单的方式使 matplotlib 标记对色盲友好?
【发布时间】:2021-12-22 02:50:54
【问题描述】:

目前我正在使用命令

plt.errorbar(X,Y,yerr=myYerr, fmt="o", alpha=0.5,capsize=4)

我得到默认标记颜色:

但是我应该怎么做才能强制 matplotlib 对色盲更友好呢?

【问题讨论】:

    标签: python matplotlib plot colors accessibility


    【解决方案1】:

    根据此[1],您可以使用预定义的色盲样式。它应该很简单:

    import matplotlib.pyplot as plt
    plt.style.use('tableau-colorblind10')
    

    [1]https://matplotlib.org/stable/users/prev_whats_new/whats_new_2.2.html#new-style-colorblind-friendly-color-cycle

    也可以查看此链接中的最后一张图片:

    https://matplotlib.org/stable/gallery/style_sheets/style_sheets_reference.html

    【讨论】:

      猜你喜欢
      • 2021-03-08
      • 2016-08-26
      • 1970-01-01
      • 2011-09-16
      • 2023-04-03
      • 2015-03-21
      • 2019-05-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多