Skip to content
Tolshao
Go back

Matlab设置

代码片段snippets

h = figure;
plot(1:10);
set(h,'Units','Inches');
pos = get(h,'Position');
set(h,'PaperPositionMode','Auto','PaperUnits','Inches','PaperSize',[pos(3), pos(4)])
print(h,'filename','-dpdf','-r0')
function f(arg1, arg2, arg3)
if ~exist('arg2', 'var')
    arg2 = arg2Default;
end
lgd1 = legend('第一条');
set(lgd1,'FontSize',12,'Location', 'SouthOutside','box','off','Fontname','times new roman');  
%注:将legend放在图外面时,Legend 1不能通过鼠标移动,只能通过代码调整位置 
% ============= Legend 2 :
ax2 = axes('position',get(gca,'position'),'visible','off');
lgd2 = legend(ax2, [p2 p3], '第二条', '第三条');
set(lgd2,'FontSize',12,'Location', 'SouthOutside','Orientation','horizontal','box','off','Fontname','times new roman');

Another way: legend({'cos(x)','cos(2x)','cos(3x)','cos(4x)'},'Location','northwest','NumColumns',2)

绘制等高线

contour(u, v, z, [-0.5, -0.5], 'LineWidth', 2)

区间是zlim


Share this post on:

Previous Post
Latex设置
Next Post
python-snippets