调skill_metrics库画泰勒图Debug三小时.....

起因是要画一张包含9个数据点的泰勒图,理想效果如下:结果在颜色设置上一直报错:

ValueError                                Traceback (most recent call last)
Cell In[70], line 1
----> 1 ty5=sm.taylor_diagram(sdev,da,ccoef, markerLabel = label, markerLabelColor = 'black',
2                   markerLegend = 'on',
3                   styleOBS = '--', colOBS = 'y', markerobs = 'o',
4                   markerSize = 6, tickRMS = [0.0, 0.25, 0.5, 0.75, 1.0],axismax = 2.0,
5                   tickRMSangle = 145.0, showlabelsRMS = 'on',widthRMS = 1.0,
6                   showlabelsSTD = 'off',titleRMS = 'off', #titleOBS = 'GroundTruth',
7                   checkstats = 'off')
8 # plt.title("(e)Taylor plot of DA",fontdict=text_font,pad=35)
9 plt.tight_layout()


File ~\Desktop\路径A\路径B\skill_metrics\taylor_diagram.py:388, in taylor_diagram(*args, **kwargs)
386 lowcase = options['markerdisplayed'].lower()
387 if lowcase == 'marker':
--> 388     plot_pattern_diagram_markers(ax, X, Y, options)
389 elif lowcase == 'colorbar':
390     nZdata = len(options['cmapzdata'])


File ~\Desktop\路径A\路径B\Visulazation\skill_metrics\plot_pattern_diagram_markers.py:108, in plot_pattern_diagram_markers(ax, X, Y, option, markerColors)
106 for i, xval in enumerate(X):
107     if abs(X[i]) <= limit and abs(Y[i]) <= limit:
--> 108         h = ax.plot(X[i],Y[i],marker[i], markersize = markerSize,
109              markerfacecolor = markercolor[i],
110              markeredgecolor = markercolor[i][0:3] + (1.0,),
111              markeredgewidth = 2)
112         hp += tuple(h)
113         labelcolor.append(option['markerlabelcolor'])


File D:\anaconda\lib\site-packages\matplotlib\axes_axes.py:1688, in Axes.plot(self, scalex, scaley, data, *args, **kwargs)
1445 """
1446 Plot y versus x as lines and/or markers.
1447
(...)
1685 ('green') or hex strings ('#008000').
1686 """
1687 kwargs = cbook.normalize_kwargs(kwargs, mlines.Line2D)
-> 1688 lines = [*self._get_lines(*args, data=data, **kwargs)]
1689 for line in lines:
1690     self.add_line(line)


File D:\anaconda\lib\site-packages\matplotlib\axes_base.py:311, in _process_plot_var_args.call(self, data, *args, **kwargs)
309     this += args[0],
310     args = args[1:]
--> 311 yield from self._plot_args(
312     this, kwargs, ambiguous_fmt_datakey=ambiguous_fmt_datakey)


File D:\anaconda\lib\site-packages\matplotlib\axes_base.py:454, in _process_plot_var_args._plot_args(self, tup, kwargs, return_kwargs, ambiguous_fmt_datakey)
451 if len(tup) > 1 and isinstance(tup[-1], str):
452     # xy is tup with fmt stripped (could still be (y,) only)
453     *xy, fmt = tup
--> 454     linestyle, marker, color = _process_plot_format(
455         fmt, ambiguous_fmt_datakey=ambiguous_fmt_datakey)
456 elif len(tup) == 3:
457     raise ValueError('third arg must be a format string')


File D:\anaconda\lib\site-packages\matplotlib\axes_base.py:190, in _process_plot_format(fmt, ambiguous_fmt_datakey)
188 elif c in mcolors.get_named_colors_mapping():
189     if color is not None:
--> 190         raise ValueError(errfmt.format(fmt, "two color symbols"))
191     color = c
192     i += 1


ValueError: 'pgray' is not a valid format string (two color symbols)

跑到get_default_markers.py子模块一看,发现'pgray'来自预定义列表的第8个形状和颜色:

 Define list of marker symbols and colros
  kind = ['+','o','x','s','d','^','v','p','h','*']

  colorm = ['r','b','g','c','m','y','k','gray']

单字母颜色字符串就那么几个,各种换颜色参数,十六进制,RGB元组都不行

最后改掉这1行才成功(大概45行左右):

只能说新库还不是很完善,Debug使人崩溃,,,,

  • 17
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
根据你提供的引用内容,可以看出你在尝试安装skill_metrics模块时遇到了一些问题。通过引用和引用可以得知,报错信息显示没有找到'skimage.metrics'这个模块,这可能是因为你安装的skimage版本过低导致的。为了解决这个问题,你可以尝试升级skimage模块的版本。 另外,在引用中提到了修改fontSize的代码,但与安装skill_metrics模块无直接关系。如果你有其他问题或需求,请提供更多信息,以便我能更好地帮助你。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [【python】ModuleNotFoundError: No module named ‘skimage.metrics](https://blog.csdn.net/zylooooooooong/article/details/120813007)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *3* [泰勒图(参数修改),记录下用skill_metrics图的窝心事儿。。。NND](https://blog.csdn.net/weixin_43388193/article/details/125240021)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值