推荐用saveas eps,再用eps2pdf转成pdf。这样可以之间pdflatex编译。

if result.savepic
saveas(gcf,[ pwd '/picture/right_' num2str(problem.numsamples) '_' num2str(problem.Ttest) problem.name '.fig']);
saveas(gcf,[ pwd '/picture/right_' num2str(problem.numsamples) '_' num2str(problem.Ttest) problem.name '.eps'],'epsc'); %带彩色
eps2pdf([pwd '/picture/right_' num2str(problem.numsamples) '_' num2str(problem.Ttest) problem.name '.eps']);
end

%template
result.linspec = {'r.-','b*-','go-','rs-','b^-','gd-'};
load pgsd
figure
for j=:
tmp1=[];
index=[];
for i=:length(a(,:))
if a(j,i)~=
tmp1=[tmp1 a(j,i)];
index=[index a(,i)];
end
end
plot(index,tmp1,result.linspec{j});hold on;
end
grid on
legend('SGD','SGD+AdaGrad','pSGD+AdaGrad','pSGD','Location','SouthEast')
xlabel('Training Time (min) ')
ylabel('Accuracy (%) ') figure_FontSize=;
set(get(gca,'XLabel'),'FontSize',figure_FontSize,'Vertical','top');
set(get(gca,'YLabel'),'FontSize',figure_FontSize,'Vertical','middle');
set(findobj('FontSize',),'FontSize',figure_FontSize);
set(findobj(get(gca,'Children'),'LineWidth',0.5),'LineWidth',2.3);
%set(findobj(get(gca,'Children'),'MakerSize',),'MakerSize',);
set(gca,'FontSize',figure_FontSize)
saveas(gcf,[ pwd '/map5_boldfi' '.fig']);
saveas(gcf,[ pwd '/map5_boldfi' '.eps'],'epsc');
eps2pdf( [pwd '/map5_boldfi' '.eps']); % Place second set of axes on same plot
%
% handaxes2 = axes('position', [0.2 0.5 0.4 0.3]);
%
% set(handaxes2, 'box', 'off');
%
% semilogx(cumsum(parametertmp),cputimetmp./gputimetmp);
% % Adjust XY label font
% xlabel('Parameter number');
% ylabel('Speed gain ratio');
% grid on % set(get(handaxes2, 'xlabel'), 'fontname', 'times')
% set(get(handaxes2, 'ylabel'), 'fontname', 'times')
%
%title('Comparision of LSTM Efficiency with CPU and GPU ')

多个插图并排,互不相关。

\usepackage{floatrow}
\begin{figure}
\begin{floatrow}[2]
\ffigbox{ \caption{Various Sigmoid functions and their derivatives} \label{sigmoidfunction} }{\includegraphics[width=6.5cm]{picture//sigmoid} }
\ffigbox{ \caption{Experiments with different sigmoid functions (lbfgs)}
\label{newexcitation}}{\includegraphics[width=6.5cm]{picture//newexcitation} }
\end{floatrow}
\end{figure}

相关,用subfloat[caption]{\includegr...  \quad(换行)

For Pdftex the best vector format ist PDF. Many programs can output PDF. Inkscape for example has good PDF output. As for raster images PNG is the best as long as you don’t include photopraphs, then it’s good old JPEG.
In plain Latex you can only include EPS, but it depends on how the EPS was generated. EPS can contain both vector and raster images. It’s basically only a container format.

print 最常用

saveas 保存fig文件,图片大小按默认设置

saveas(gcf,'pictures\p.png')

saveas(gca,'myplot.eps','epsc');

Note the c in 'epsc'.

or

print-depsc myplot.eps
可以试一下set(gcf, 'PaperPositionMode','auto')
我曾经用这种方法在1280*960的分辨率下保存过650*1610的图,但是后来试一张800*2760的图仍然是变形,也试过调整纸张大小,都没有效果,一直很困扰,期待高手解答

imwrite 所见即所得,最快。

f=getframe(gcf);

imwrite(f.cdata,'p.ps');

Solution:

The best way to do this would be to export your figure into an Encapsulated PostScript (EPS) format file and then include the EPS file in the LaTeX document. You can export a figure into a EPS format using the PRINT command as follows:

plot(1:10)
print -deps epsFig

This will generate a file called epsFig.eps in your current working directory. You can then include this eps file in your LaTeX document.

One method to include an EPS figure in your LaTeX 2E document is as follows:

1. Include the following line before the \begin{document} statement

\usepackage{graphicx}

2. Use the following template code to include any figure:

\begin{figure}
\centering
\includegraphics{Figure name without .eps extension}
\caption{Insert caption}
\end{figure} 

\begin{equation} .... .... \label{eq:no1} \end{equation} ... One can see from Eq.~(\ref{eq:no1}) that ...

In a table or figure environment, the \label command should follow the \caption command (or be part of its argument) since it is the \caption command which generates the number.

http://en.wikibooks.org/wiki/LaTeX/Importing_Graphics#Raster_graphics_vs._vector_graphics

要对latex插图仔细研究,推荐Latex插图指南一文(一般CTEX安装目录下help文件夹graphics.pdf就是了),下边用双引号括起来的都引自此书。PS:本文中代码里的图片文件名在编译时请换成你的电脑里实际有的图片,这个大家应该都懂的。

、        我用惯word的结果是觉得Latex的图片浮动格式很不习惯,然后我听到这样一段话,觉得有醍醐之感:“

一、不要使用依赖于图形放置位置的文本。使用如“ 这幅图...” 或“ 下面的图形...” 等短语要求所指的图形需在固定位置。而像“ 图5...” 这样的短语则允许图形出现在任意位置。

二、放松。一些使用者在发现图形没有十分准确的出现在他们所想要的位置时,往往非常着急。这没有必要,图形的放置是LATEX 的工作,最好放松一些。”

为什么Latex不推荐我们让图形准确出现在放置的位置呢?“因为那会导致糟糕的分页,将大片的空白留在页面下方。为得到专家级的排版效果,作者不得不手工调整图形的位置。这种工作是非常乏味的,尤其是几乎每次修改文档都得这样做一次。”

Knuth同学当年做tex时,目的就是让我们将注意力集中在文章的内容,而不是排版上。尤其是在做长文章或书时,用word每次修改时插入新的文字都要重新调整图片,很不方便。(其实还好啦,我们的文章都短的像兔子尾巴就觉得word也挺好的)

、        浮动格式

一个典型的插图语句

\begin{figure}[htbp]

\centering

\includegraphics[width=.5cm]{graph.eps}

\caption{This is an inserted EPS graphic} \label{fig:graph}

\end{figure}

其中[htbp]就是浮动格式

!强制忽略latex默认

“h here 当前位置(default)。将图形放置在正文文本中给出该图形环境的地方。如果本页所剩的页面不够,这一参数将不起作用。

t top 顶部。将图形放置在页面的顶部。

b bottom 底部。将图形放置在页面的底部。

p  page ,special page for floating object(比如最后一页) 浮动页。将图形放置在一只允许有浮动对象的页面上。”

我一般使用[htb]这样的组合,只用[h]是没有用的(原因请读者思考)。这样组合的意思就是latex会尽量满足排在前面的浮动格式,就是h-t-b这个顺序,让排版的效果尽量好。反正记住,放轻松。

、        如果你就是要插在你想插的位置怎么办?

我会这样做:如果tex不让你插在你想插的位置,说明你的图片太大了,你可以试试调整[width=.5cm]中的大小,让它能够插得下,其实我们在word中也是这样做的。推荐使用\textwidth这个单位。但还是那句话,不要太勉强。

、        一些图片的并排

如果想要这样的效果,要两张图并列,或几张图排在一起。可以试试下面的模板,效果请自己运行

模板一

\begin{figure}[htbp]

  \centering

\subfigure[sin1]{\label{fig:fft:a}

\begin{minipage}[c]{0.5\textwidth}

\centering

  \includegraphics[width=.5cm]{sin1.eps}

\end{minipage}%

}%注意这个”%”绝对不能省,可以试试不打%的效果

\subfigure[sin2]{

\begin{minipage}[c]{0.5\textwidth}

\centering

  \includegraphics[width=.5cm]{sin2.eps}

\end{minipage}

}

\caption{fft}\label{fig:fft}

\end{figure}

模板二

\begin{figure}[htbp]

  \centering

\begin{minipage}[c]{0.5\textwidth}

\centering

  \includegraphics[width=.5cm]{sin1.eps}

\end{minipage}%

}%注意这个”%”绝对不能省,可以试试不打%的效果

\begin{minipage}[c]{0.5\textwidth}

\centering

  \includegraphics[width=.5cm]{sin2.eps}

\end{minipage}

}

\caption{fft}\label{fig:fft}

\end{figure}

、        其他细节可以详见开头说的那本书。还有关于图片的格式,如果用Latex编译的话只能用eps格式的图片,matlab就存为eps,其他用软件转吧,但是如果用Latex2pdf编译的话好像就能用jpg,eps反而不可以。但推荐使用eps,我试验下来matlab的图eps质量好,但好像不太支持中文,其实也有办法解决,我所知道的方法是用Psfrag宏包,详细方法还是参见那本书,但是我觉得用英文就行了嘛。

、        其实真正的高手latex画图是这样画的,下面一段代码引自Arnold的一篇论文,可以运行一下,看看什么效果。

\begin{picture}(,)

  \thicklines

  \put(,){\line(,){}}

  \put(,){\line(,-){}}

  \put(,){\circle*{0.2}}

  \put(,){\circle*{0.2}}

  \put(,){\circle*{0.2}}

  \thinlines

  \multiput(,)(,0.2){}{\line(,){0.1}}

  \multiput(,)(0.2,){}{\line(,){0.1}}

  \put(,5.2){\mbox{$A$}}

  \put(,0.5){\mbox{$C$}}

  \put(4.5,5.2){\mbox{$B$}}

\end{picture}

matlab作图 latex插图的更多相关文章

  1. 【转】Matlab作图语句小结

    之前用Matlab作图,从网上找了些别人的例子,然后慢慢调参数.其实对很多命令,特别是对句柄不是很了解,今天简单总结了一下.下面用几个例子来说明:     ]);  首先,gcf是当前figure对象 ...

  2. 小论文matlab作图技巧

    小论文matlab作图技巧 编辑->复制选项 编辑->图形属性 图中右击->字型 编辑->复制图片,即可. 效果: 宽:5.9高: 7.91

  3. MATLAB作图方法与技巧(二)

    作为MATLAB作图方法与技巧(一)的补充 1.绘制二维散点图 ① scatter函数 scatter(x,y,s,c)函数绘制向量x和y的散点图,其中s代表点的大小,c代表点的形状,s和c缺省时为默 ...

  4. MATLAB作图方法与技巧(一)

    下面从折线图.曲面图和图形说明与定制三个方面说明MATLAB作图的一些方法与技巧,注意,文中出现的单引号在MATLAB中实际运行的时候,需要改为MATLAB认可的单引号. 一. 作折线图 1.plot ...

  5. Latex技巧:LaTex插图命令includegraphics参数详解

    Latex插图的命令是\includegraphics[选项]{文件} 这里的选项在表 7.1, 7.2, 7.3 中列出. 因为 \includegraphics 不会结束 当前段落,所以它能够在文 ...

  6. LaTeX技巧012:LaTeX 插图加载宏包

    LaTeX 插图加载宏包.支持 LaTeX - DVIPDFMx; pdfLaTeX; XeLaTeX 三种编译方式,支持 eps/pdf/jpg/png 等图片格式. % Put this snip ...

  7. Matlab: 作图

    控制图的大小 figure('position',[x0,y0,dx,dy]); figure(fig number); 显示图例 legend('leg1','leg2') depend on ho ...

  8. latex插图续

    LaTeX中一般只直接支持插入eps(Encapsulated PostScript)格式的图形文件, 因此在图片插入latex文档之前应先设法得到图片的eps格式的文件.  UNIX下的各种应用软件 ...

  9. [LaTex]插图

    1.不错的Latex参考网站 http://www.ctex.org/documents/latex/graphics/node120.html http://www.ctex.org/documen ...

随机推荐

  1. Servlet快速入门

    servlet是运行在服务端的java小程序,用来处理客户端请求,响应给浏览器的动态资源 servlet规范:包含3个技术点 1.servlet技术 2.filter技术 3.listener技术 s ...

  2. java+selenium的helloworld

    在学校上测试课程,接触到自动化管理工具,在加上助教工作需要改作业,所以想着学下selenium这一强大的web自动化工具. 1.lenium官网:http://www.seleniumhq.org/  ...

  3. WebSocket前后台交互

    其实对于前后台交互有很多种方法(只列举我知道的,嘻嘻): 1:from 表单: 使用场景——小信息量提交给后台 2:ajax(跨域的话用jsonp): 可以进行多量的前后台信心传递: 但实时性不高,不 ...

  4. google搜索小技巧

    google搜索小技巧 一.总结 一句话总结:But most people may not be using Google search to its full potential.Want to ...

  5. HTML 第十二章总结

    HTML5 markup 前言 在这一章中,讲解了新的 HTML5 的一些 markup,并且对其中的<video>进行了很详细的讲解. New HTML5 elements 列表如下: ...

  6. 20165327 2017-2018-2 《Java程序设计》第7周学习总结

    20165327 2017-2018-2 <Java程序设计>第7周学习总结 教材内容总结 第十一章 (一)MySQL数据库服务器 下载安装MySQL服务器 启动MySQL数据库服务器 在 ...

  7. Channel L 自然拼读法 Teacher:Lamb

    # 今日学习的 bl fl pl cl gl br cr gr pr fr    tr   dr   # 上课内容 was he    <--- h在中间出现的情况连读   was he 这里的 ...

  8. You Don't Know JS: this & Object Prototypes (第6章 Behavior Delegation)附加的ES6 class未读

    本章深挖原型机制. [[Prototype]]比类更直接和简单! https://github.com/getify/You-Dont-Know-JS/blob/master/this%20%26%2 ...

  9. Vue.js示例:GitHub提交(watch数据,created钩子,filters过滤); 网格组件(功能:1.检索,2排序);

    GitHub提交 codePen:   https://codepen.io/chentianwei411/pen/wEVPZo 注意:频繁看案例,可能会被限制. 重点: 表单输入绑定, 单选按钮的使 ...

  10. 关于Android如何创建空文件夹,以及mkdir和mkdirs的区别

    File().mkdir 和File().mkdirs的区别 mkdir是只能建立一级目录 比如 /sdcard/test/pp 就只能建立test 而mkdirs 则可以全部建立