How can I save a plot with closed boxed area in MATLAB?

扶醉桌前 提交于 2019-12-01 23:17:25

问题


How can I close the plot area with black lines in the top and right side when I save a plot?

I don't have any idea how to make it or how to search, if anyone knows please tell me.

For example look at the plot shown below, where the lines are missing:


回答1:


Before you save your image, use the box command. This will enclose your plot to have the surrounding black box as you have specified in your example image. Simply call:

box on;

To turn it off, do:

box off;

Example:

%// Plot a line from 1 to 5 for x and y
x = 1:5;
y = 1:5;
plot(x,y);
box on;

This is what the plot looks like:

If you were to turn boxing off, this is what the plot looks like:

box off; is the default behaviour for plot, as you have seen in the example image you have shown. Simply call box on; after the plot is shown and before you save your image to get the desired effect.



来源:https://stackoverflow.com/questions/24701426/how-can-i-save-a-plot-with-closed-boxed-area-in-matlab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!