How to generate Publication quality( for conferences/Journals) figures in MATLAB?

13 次查看(过去 30 天)
Hello everyone. This is a general query. How can I generate 'high-res' figures in MATLAB that can be used for publication (Conferences/Journals)?
I previously found this package export_fig, but I am confused how to use this even after reading their README section. The instructions seemed vague to me.
If you have any idea how to use this package, please kindly answer with an example. Or if you know any other techniques to generate high-res figures in MATLAB, kindly share.
Thank you!
  4 个评论
John Doe
John Doe 2019-9-21
编辑:John Doe 2019-9-21
Thanks for the reply, everyone.
clc
clear
close all
t= linspace(-10,10,500);
x= sin(t);
plot(t,x);
Suppose I have this simple m file named as wave.m. As far as I know, functions can be called in command window. So in the command window I am typing as,
export_fig wave.m
But it's giving me an error:
export_fig wave.m
Undefined function or variable 'using_hg2'.
Error in export_fig>parse_args (line 1298)
options.aa_factor = 1 + 2 * (~(using_hg2(fig) && isAA) | (options.renderer == 3));
Error in export_fig (line 305)
[fig, options] = parse_args(nargout, fig, varargin{:});
I have seen the instruction to insert filename after export_fig. I did that, but what am I doing wrong? I know it must be silly, but it's eating away my brain.
PS: All the function files and wave.m file are in the same folder as per required to call a function.
dpb
dpb 2019-9-21
编辑:dpb 2019-9-22
Well, if it did work it would have overwritten your m-file. The filename expected is the output file you want created from the figure for the output of export_fig
As far as the error, try
clearvars
wave
export_fig 'wave.png'
which should create a PNG format output file.
If you still get an internal error of the above ilk it would appear something went wrong in the download/installation process that not all components got decompressed.
I infer export_fig creates the file output type from the file extension...it may have been the (unexpected I'm sure) .m extension that triggered the error. But, as noted, I don't have it installed here so I can't readily test.
ADDENDUM
Another thought what may have gone wrong. Did you run the function file wave to create the figure on the screen before calling export_fig? Not having done definitely wouldn't work; it (export_fig, that is) doesn't call the m-file to create the figure, your job is to have already done that part and have the figure on the screen. It just, as the name says, exports that figure to an external file in a specific format.

请先登录,再进行评论。

采纳的回答

Bjorn Gustavsson
Bjorn Gustavsson 2019-9-23
In the File menu go to print preview - from there you can set a number of different behaviours of matlab's print. Then print your figure with:
filename = goodone-01.eps
print('-depsc2','-painters',filename)
That should give you a decent eps-file where the plot is in a vector-graphics format, it works for most cases except where you use transparency.
HTH

更多回答(1 个)

Image Analyst
Image Analyst 2019-9-24

类别

Help CenterFile Exchange 中查找有关 Environment and Settings 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by