|
XP的论文里,有个comic的图.别人好像是 python,mathematica, latex都画了.matlab 里也有实现,
https://stackoverflow.com/questi ... le-graphs-in-matlab
我自己也玩了一下.效果,还不错.
正常效果的.
comic效果的.
- clear all
- clc
- close all
- %# define plot data
- x = 1:0.1:10;
- y1 = sin(x).*exp(-x/3) + 3;
- y2 = 3*exp(-(x-7).^2/2) + 1;
- sbp_width=0.7;
- sbp_heig=0.6;
- n_row = 1;
- n_col =1 ;
- [out_pos]=fun_mm_subplot_pos(n_row,n_col,sbp_width,sbp_heig);
-
- %# plot
- fh = figure('color','w');
- set(fh, 'Position', [100, 100, 600, 550]);
- ax=axes('position',out_pos(1,:));
- hold on
- plot(x,y1,'b','lineWidth',5);
- % plot(x,y2,'w','lineWidth',9);
- plot(x,y2,'r','lineWidth',4);
- xlim([0.95 10])
- ylim([-1 5])
- set(gca,'ytick',[-1:1:5])
- set(gca,'fontName','Comic Sans MS','fontSize',20,'lineWidth',3)
- %# add an annotation
- annotation(fh,'textarrow',[0.4 0.55],[0.7 0.6],...
- 'string',sprintf('text%shere',char(10)),'headStyle','none','lineWidth',1.5,...
- 'fontName','Comic Sans MS','fontSize',20,'verticalAlignment','middle','horizontalAlignment','left')
- title('I am title')
- xlabel(' I am xlabel')
- ylabel(' I am ylabel')
- legend({'line1','line2'},'location','southeast','box','off')
- grid on
- box on
- h=gcf;
- fi_na = './fig_normal'
- fun_work_li_035_myfig_out(h,fi_na,3);
复制代码
函数
- function [imt]=fun_mm_xkcd(fh);
- %# capture with export_fig
- im = export_fig('-nocrop',fh);
- % %# add a bit of border to avoid black edges
- im = padarray(im,[30 30 0],255);
- %# make distortion grid
- sfc = size(im);
- [yy,xx]=ndgrid(1:7:sfc(1),1:7:sfc(2));
- pts = [xx(:),yy(:)];
- tf = cp2tform(pts+1.2*randn(size(pts)),pts,'lwm',14);
- w = warning;
- warning off images:inv_lwm:cannotEvaluateTransfAtSomeOutputLocations
- imt = imtransform(im,tf);
- warning(w)
- %
- % %# remove padding
- imt = imt(16:end-15,16:end-15,:);
- %
- figure('color','w')
- imshow(imt)
复制代码
|
|