見出し画像

Matlab Tricks

Matlab のメモまとめ.

1. カラーマップのfigureをpdfエクスポートした際に入る白い対角線のようなものを消す.

imagescを使用して,カラーマップを分割してプロットすれば白線は入らない.下記は分割を入れたimagescの自作関数.


function imagesc2(x,y,map,devide_vert,devide_hori)

gindex_hori = gapindex(x,devide_hori);
gindex_vert = gapindex(y,devide_vert);

for eg = 1:length(gindex_vert)-1;
for ie = 1:length(gindex_hori)-1;
   
    plots_hori = gindex_hori(ie):gindex_hori(ie+1);
    plots_vert = gindex_vert(eg):gindex_vert(eg+1);
    imagesc(x(plots_hori),y(plots_vert),map(plots_vert,plots_hori));
    hold on;
    
end
end
end


function gindex = gapindex(array,plots)

gindex = fix(linspace(1,length(array),plots));

end

devide_**にintを渡して分割してくれる.他の部分はただのimagesc.


2. subscript, superscriptの位置を変更する.

fontの設定をごちゃごちゃ描くと,良い感じの位置になる.お好みで変更してください.subscriptのsuperscriptのsubscriptの…みたいに微調整していくというアイデア.

function character = subscript(letter)

character=['_{\fontsize{10}{^{\fontsize{9.3}{',letter,'}}}}'];

end


function character = superscript(letter)

character=['^{\fontsize{9.3}{',letter,'}}'];

end

characterをlabelなどに渡す.


この記事が気に入ったらサポートをしてみませんか?