Plot bar graph with patterns

Plot bar graph with patterns
61 Descargas
Actualizado 26 mar 2023

Ver licencia

% plot bar graph with patterns
% b1: output of original "bar" matlab function
% varargin <= input of original "bar" matlab function
% patterns: {'\','/','*','-','|','+', ' ', 's'} (solid filled)
% lcolor: line color {[R G B]} between 0-1
% lspacing: {1}: space between lines
% lwidth: {1}: line width of patterns
% * if the size of input not match with the data, using the first unit for all bars
% %Example 1:
% figure(1);clf;set(gcf,'color','w');
% dataBar=rand(3,5)-0.5;
% patterns={'\*+ s','\*+ s','\*+ s'};
% lcolor={lines(5),lines(5),lines(5)};
% lspacing={[1 1 1 1 1],[1 1 1 1 1],[1 1 1 1 1]};lwidth={[1 1 1 1 1],[1 1 1 1 1],[1 1 1 1 1]};
% b1=bar_pattern(patterns,lcolor,lspacing,lwidth,dataBar,'FaceColor',[1 1 1],'BarWidth',1);
% b1(5).FaceAlpha = 0.5;
%
% %Example 2:
% figure(2);set(gcf,'color','w')
% dataBar=rand(1,5)-0.5;
% patterns={'/-\ s'};lcolor={jet(5)};lspacing={[1 1 1 1 1]};lwidth={[1 1 1 1 1]};
% b1=bar_pattern(patterns,lcolor,lspacing,lwidth,dataBar,'FaceColor',[1 1 1]);
%
% %Example 3: Apply with bar
% figure(3);set(gcf,'color','w');
% dataBar=rand(3,5)-0.5;
% patterns={'/+\ x','/+\ x','/+\ s'};
% lcolor={lines(5),lines(5),lines(5)};
% lspacing={[1 1 1 1 1],[1 1 1 1 1],[1 1 1 1 1]};lwidth={[2 2 2 2 2],[2 2 2 2 2],[2 2 2 2 2]};
% b1=bar_pattern(patterns,lcolor,lspacing,lwidth,dataBar,'FaceColor',[1 1 1],'BarWidth',1,'LineWidth',2);
% b1=bar(dataBar,'FaceAlpha',0.2,'BarWidth',1,'LineWidth',2,'FaceColor','flat');hold on;
% set(gca,'FontWeight','bold','LineWidth',2,'FontSize',20,'xticklabel',{'A','B','C'})

Citar como

Chaohsiung Hsu (2025). Plot bar graph with patterns (https://www.mathworks.com/matlabcentral/fileexchange/126849-plot-bar-graph-with-patterns), MATLAB Central File Exchange. Recuperado .

Compatibilidad con la versión de MATLAB
Se creó con R2023a
Compatible con cualquier versión desde R2021b
Compatibilidad con las plataformas
Windows macOS Linux
Etiquetas Añadir etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Versión Publicado Notas de la versión
1.0.0