English 中文(简体)
调整 Matlab 的绘图大小, 使图形不会被绘图窗口的边缘截断
原标题:Adjusting size of plot in Matlab so that graph does not get cut off by edge of plot window

我在Matlab创建了一个地块,但不幸的是,地块的侧面被绘图窗口切断。这是我用来创建地块的代码:

% create a plot with dots and with bold sides
point = num(:, 1);
depth = num(:, 2);
hfig = plot(point, depth,  -s ,  Color ,  k ,  MarkerFaceColor ,  k ,  MarkerEdgeColor ,  k ,  MarkerSize , 10);

% make the outside of the graph bold
set(gca,  LineWidth , axis_size);
set(gca, FontSize , ticksize,  FontName , fontname);
set(gca,  Position , [0.2 0.2 0.8 0.4])
xlabel( Point Number )
ylabel( Depth (cm) )

以下是输出 :

"https://i.sstatic.net/cg28i.png" alt="Cutoff 图像"/ >

请注意图案的侧面是如何被切断的。 或者,这里是一张图片,显示我想要实现的目标:

""https://i.sstatic.net/yJutt.png" alt="我想要实现的东西"/"

我只是在没有调用 set( gca, position, [0. 2 0. 0. 0. 0. 0. 4]) < /code > 的情况下创建了这个图, 然后通过调整窗口大小来调整图的大小 。

但我如何在代码中做到这一点? 我还想确保我能够将这个图保存为具有相同维度的 PNG 文件 。 我玩弄了各种组合 < code> set () 函数, 我无法达到我想要的目标 。

最佳回答

以下文件(这里 是相关的数学工作帮助页面。

Andrey 拥有最简单的答案, 但是, 或者( 并且从长远看) 您可以去文件交换和下载 subplot 的 subaxis.m, 以替换 subplot, 并且即使是单轴块也具有超级性( 您可以定义属性, 如左边边框和右边边框以及 PaddingTop 和 PaddingBottom ) 。

http://www.mathworks.com/matlabcentral/filechange/3696-subaxis-subplot" rel=“nofollow'>http://www.mathworks.com/matlabcentral/fileschange/3696-subaxis-subplot





相关问题
How to start to create an application GUI using C#?

HI! I am new to C# and plan to use it for my application GUI. I am trying to make my GUI similar to SPSS:http://www.spss.com/images/08/statistics_screens/ez_rfm-big.jpg Is this easy in C#? Is there ...

Automatic height of edit box

My shoes application has three items stacked on top of each other (with a stack, of course), in order: A banner An edit box Two buttons in a flow What I want to do is have the banner stay at it s ...

Search by using the keyboard in a list/grid - algorithm

I need to implement a custom search in a grid and I would like to find some user interface guidelines that explain the standard way to implement it. I mean this kind of search that is initiated by ...

UI And TcpClient Issue in vb.net

I m having some problems with a small ircbot i m writing. Basically I connect to the server using a tcpclient in a seperate class, which also runs on its own thread. I want to display the server text ...

UI Convention: Shortcut key for application exit? [closed]

Is there a convention for the shortcut keys for application exit? Some applications uses Alt+X some others use Ctrl+ X and Ctrl+Q. Applications like FF and IE doesnot assign a shortcut at all. So is ...

热门标签