How to remove border from figure

28 ビュー (過去 30 日間)
Sourabh
Sourabh 2023 年 9 月 30 日
回答済み: Image Analyst 2023 年 10 月 1 日
How to remove inverted L shaped border from my matlab figure? It's along the bottom and right edge of the image of the plot.
  2 件のコメント
Dyuman Joshi
Dyuman Joshi 2023 年 9 月 30 日
It's more likely that that particular L-shaped border got created when you were you editing the document.
Still, how did you generate that figure? Can you share the MATLAB code used for that?
Sourabh
Sourabh 2023 年 9 月 30 日
編集済み: Sourabh 2023 年 9 月 30 日
here you go i have created a similar kind of figure which is causing the same isuue

サインインしてコメントする。

回答 (2 件)

Anton Kogios
Anton Kogios 2023 年 10 月 1 日
The way I go about this is first saving the figure as a PDF (so that it is vectorised):
f = figure(1); % OR f = gcf
exportgraphics(f,'testfig.pdf')
I can't get this to work with the figure you shared but it should work if you put it in your code when you make your figure. You can also save it as an image (PNG/JPG) if that's what you prefer.
Then, in Overleaf/LaTeX:
\includegraphics[width=.9\linewidth]{testfig.pdf}
If you're still getting that L shaped border, I would say it is likely something to do with LaTeX and/or the packages you are using.
  2 件のコメント
Sourabh
Sourabh 2023 年 10 月 1 日
it didnt worked but thanks.
when i directly edit the properties from scope instead of saving it as figure it doesnt comes.
it only comes when i save a file as .fig and i edit it later.
Dyuman Joshi
Dyuman Joshi 2023 年 10 月 1 日
@Sourabh Why not export the figure as a png file?

サインインしてコメントする。


Image Analyst
Image Analyst 2023 年 10 月 1 日
Use exportgraphics to save the current, or designated, axes as a PNG image file:
exportgraphics(gca, 'Figure 2.png');
If you open that in the default image viewer for your operating system, you should not see the extra lines along any border. Then you can simply import/insert it into your word processing program. If the image is not selected (i.e. your cursor is positioned somewhere else in the text) then you should not see any border. If you do, see if your word processing program is applying some border by default and turn it off.
Never save images with fine details, such as this, as JPG because you'll get lossy image compression artifacts, such as posterization and loss of fine lines. Use PNG image format instead so there will be no loss of change of information in the image.

カテゴリ

Help Center および File ExchangePrinting and Saving についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by