主要原因是matlab找不到applyhatch函数;

1.需要提供applyhatch.m文件,内容如下:

function applyhatch(h,patterns,colorlist)
%APPLYHATCH Apply hatched patterns to a figure
%  APPLYHATCH(H,PATTERNS) creates a new figure from the figure H by
%  replacing distinct colors in H with the black and white
%  patterns in PATTERNS. The format for PATTERNS can be
%    a string of the characters '/', '\', '|', '-', '+', 'x', '.'
%    a cell array of matrices of zeros (white) and ones (black)
%
%  APPLYHATCH(H,PATTERNS,COLORS) maps the colors in the n by 3
%  matrix COLORS to PATTERNS. Each row of COLORS specifies an RGB
%  color value.
%
%  Note this function makes a bitmap image of H and so is limited
%  to low-resolution, bitmap output.
%
%  Example 1:
%    bar(rand(3,4));
%    applyhatch(gcf,'\-x.');
%
%  Example 2:
%    colormap(cool(6));
%    pie(rand(6,1));
%    legend('Jan','Feb','Mar','Apr','May','Jun');
%    applyhatch(gcf,'|-+.\/',cool(6));
%
%  See also: MAKEHATCH%  Copyright 2002-2009 The MathWorks, Inc.oldppmode = get(h,'paperpositionmode');
oldunits = get(h,'units');
set(h,'paperpositionmode','auto');
set(h,'units','pixels');
figsize = get(h,'position');
if nargin == 2colorlist = [];
end
if verLessThan('matlab','8.4.0')bits = hardcopy(h,'-dzbuffer','-r0');
elsebits = print(h,'-RGBImage','-r0');
end
set(h,'paperpositionmode',oldppmode);bwidth = size(bits,2);
bheight = size(bits,1);
bsize = bwidth * bheight;
if ~isempty(colorlist)colorlist = uint8(255*colorlist);[colors,colori] = nextnonbw(0,colorlist,bits);
elsecolors = (bits(:,:,1) ~= bits(:,:,2)) | ...(bits(:,:,1) ~= bits(:,:,3));
end
pati = 1;
colorind = find(colors);
while ~isempty(colorind)colorval(1) = bits(colorind(1));colorval(2) = bits(colorind(1)+bsize);colorval(3) = bits(colorind(1)+2*bsize);if iscell(patterns)pattern = patterns{pati};elseif isa(patterns,'char')pattern = makehatch(patterns(pati));elsepattern = patterns;endpattern = uint8(255*(1-pattern));pheight = size(pattern,2);pwidth = size(pattern,1);ratioh = ceil(bheight/pheight);ratiow = ceil(bwidth/pwidth);bigpattern = repmat(pattern,[ratioh ratiow]);if ratioh*pheight > bheightbigpattern(bheight+1:end,:) = [];endif ratiow*pwidth > bwidthbigpattern(:,bwidth+1:end) = [];endbigpattern = repmat(bigpattern,[1 1 3]);color = (bits(:,:,1) == colorval(1)) & ...(bits(:,:,2) == colorval(2)) & ...(bits(:,:,3) == colorval(3));color = repmat(color,[1 1 3]);bits(color) = bigpattern(color);if ~isempty(colorlist)[colors,colori] = nextnonbw(colori,colorlist,bits);elsecolors = (bits(:,:,1) ~= bits(:,:,2)) | ...(bits(:,:,1) ~= bits(:,:,3));endcolorind = find(colors);pati = (pati + 1);if pati > length(patterns)pati = 1;end
endnewfig = figure('units','pixels','visible','off');
imaxes = axes('parent',newfig,'units','pixels');
im = image(bits,'parent',imaxes);
fpos = get(newfig,'position');
set(newfig,'position',[fpos(1:2) figsize(3) figsize(4)+1]);
set(imaxes,'position',[0 0 figsize(3) figsize(4)+1],'visible','off');
set(newfig,'visible','on');function [colors,out] = nextnonbw(ind,colorlist,bits)
out = ind+1;
colors = [];
while out <= size(colorlist,1)if isequal(colorlist(out,:),[255 255 255]) | ...isequal(colorlist(out,:),[0 0 0])out = out+1;elsecolors = (colorlist(out,1) == bits(:,:,1)) & ...(colorlist(out,2) == bits(:,:,2)) & ...(colorlist(out,3) == bits(:,:,3));returnend
end

2.需要提供makehatch.m文件,内容如下:

function A = makehatch(hatch)
%MAKEHATCH Predefined hatch patterns
%  MAKEHATCH(HATCH) returns a matrix with the hatch pattern for HATCH
%   according to the following table:
%      HATCH        pattern
%     -------      ---------
%        /          right-slanted lines
%        \          left-slanted lines
%        |          vertical lines
%        -          horizontal lines
%        +          crossing vertical and horizontal lines
%        x          criss-crossing lines
%        .          single dots
%
%  See also: APPLYHATCH%  Copyright 2002-2009 The MathWorks, Inc.n = 6;
A=zeros(n);
switch (hatch)case '/'A = fliplr(eye(n));case '\'A = eye(n);case '|'A(:,1) = 1;case '-'A(1,:) = 1;case '+'A(:,1) = 1;A(1,:) = 1;case 'x'A = eye(n) | fliplr(diag(ones(n-1,1),-1));case '.'A(1:2,1:2)=1;otherwiseerror(['Undefined hatch pattern "' hatch '".']);
end

3.新建是一个实例,新建shishi1.m文件,内容如下:

%If you want to adjust the pattern to 6 bar such as " applyhatch(gcf,'.-+/|x');",
%try to type this "applyhatch(gcf,'.-++/||xx');" instedly.
%So you can avoid the duplicated pattern at least, even order problem is still not solved.
data=[345,359,209;155,161,99];%三列的柱状图,分为了两种,具体见图b=bar(data);%画柱状图text(0.73,345+12,'345');%设置柱状图上的数值大小
text(0.73+0.23,359+12,'359');
text(0.73+0.45,209+12,'209');text(0.73+1,155+12,'155');
text(0.73+1+0.23,161+12,'161');
text(0.73+1+0.46,99+12,'99');grid on;%添加网格线
%ch = get(b,'children');
title('实验2')
set(gca,'XTickLabel',{'LINEITEM','ORDERS'})%设置X轴显示%set(ch,'FaceVertexCData',[0 0 1;1 0 0;0 1 0])
legend('分区1','分区2','分区2');%设置
ylabel('时间(秒)');%设置y轴名字
applyhatch(gcf,'.+\');%对原图添加填充,这里有个bug就是xx需要输入两次

4.运行效果如下(运行时,这3个文件applyhatch.m, makehatch.m,shishi1.m需要放在同一个文件夹下):

applyhatch无法识别相关推荐

  1. 零基础入门--中文命名实体识别(BiLSTM+CRF模型,含代码)

    https://github.com/mali19064/LSTM-CRF-pytorch-faster 中文分词 说到命名实体抽取,先要了解一下基于字标注的中文分词. 比如一句话 "我爱北 ...

  2. 命名实体识别NER遗留问题----模型构建

    深度学习模型预测实质:训练保存的模型里面参数 整个只有一套参数 不仅保存了训练数据全部的正确信息,而且同字多义的情况下通过其同行的词来判断,虽然参数都是一套但是因为输入的值不同导致计算的结果不同 导致 ...

  3. 使用哈工大LTP进行文本命名实体识别并保存到txt

    版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog.csdn.net/broccoli2/article/de ...

  4. Pytorch: 命名实体识别: BertForTokenClassification/pytorch-crf

    文章目录 基本介绍 BertForTokenClassification pytorch-crf 实验项目 参考 基本介绍 命名实体识别:命名实体识别任务是NLP中的一个基础任务.主要是从一句话中识别 ...

  5. 基于BERT预训练的中文命名实体识别TensorFlow实现

    BERT-BiLSMT-CRF-NER Tensorflow solution of NER task Using BiLSTM-CRF model with Google BERT Fine-tun ...

  6. pytorch实现BiLSTM+CRF用于NER(命名实体识别)

    pytorch实现BiLSTM+CRF用于NER(命名实体识别) 在写这篇博客之前,我看了网上关于pytorch,BiLstm+CRF的实现,都是一个版本(对pytorch教程的翻译), 翻译得一点质 ...

  7. 命名实体识别入门教程(必看)

    关于开发自己的命名实体识别先期思路: 虽然网上有很多相关代码,但实际如何入门材料较少,故整理下: CRF:先期可以用人民日报语料库去做,步骤如下: https://blog.csdn.net/hude ...

  8. 基于javaGUI的文档识别工具制作

    基于javaGUI的文档识别工具制作 对于某些文本,其中富含了一些标志,需要去排除,以及去获得段落字数,以下是我个人写的一个比较简单的文档识别工具,含导入文件.导出文件以及一个简单的识别功能. 1.功 ...

  9. 活动识别API服务开发

    活动识别API服务开发 要使用华为活动识别服务API,需要确保设备已经下载并安装了HMS Core(APK),并将Location Kit的SDK集成到项目中. 指定应用权限 • 在Android Q ...

最新文章

  1. 人工智能这条小船何时才能变成航母?
  2. C++ dll 类型与 C#类型对应关系
  3. CTFshow 反序列化 web260
  4. Understanding JVM Internals---不得不转载呀
  5. 软考-信息系统项目管理师-信息系统综合测试与管理
  6. Oracle on Azure
  7. 2022年中国AI芯片行业深度研究
  8. 结构体内部申请空间_墙体的重要承重结构以及作用方向分类
  9. 蛮力法在求解最优解问题中的应用(JAVA)--旅行家问题、背包问题、分配问题
  10. 计算机三级网络技术上机题型,计算机三级网络技术上机操作的题型
  11. activiti的springboot模块
  12. Scrum 的每日例会 和 故事墙
  13. 采购入库单部分结算时是否自动暂估 参数 是的情况下
  14. k线必涨的20种形态图
  15. 从影片《点球成金》看大数据如何创造商业奇迹!
  16. 需求与商业模式创新-需求2-需求基础
  17. 通过Isilon和VMware部署Hadoop大数据分析(上)
  18. 网络安全风险与防范方法
  19. 64匹马8条跑道找最快的4匹马
  20. cordova js(javascript)读取本地文件(将本地的bin文件转成字节数组)

热门文章

  1. 直播回顾|走进元服务,携手小强停车探索鸿蒙新流量阵地
  2. nginx服务器使用tomcat——nginx的反向代理。
  3. UISlider-IOS开发
  4. java用字节流统计程序行数_java基础拾遗
  5. 想转行,却又不知道干什么?此文写给正在迷茫的你
  6. 看埃洛普如何在诺基亚向微软效忠
  7. 2022年起,大数据行业将会比房子更有“前途“
  8. 守望者的逃离 贪心 动态规划
  9. c语言编程武侠游戏,代码一遍过的程序猿出现 《太吾绘卷》为何凭武侠版捉蛐蛐大火?...
  10. 【NLP】第 1 章 : 语言模型简介