matlab作图 latex插图
推荐用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插图的更多相关文章
- 【转】Matlab作图语句小结
之前用Matlab作图,从网上找了些别人的例子,然后慢慢调参数.其实对很多命令,特别是对句柄不是很了解,今天简单总结了一下.下面用几个例子来说明: ]); 首先,gcf是当前figure对象 ...
- 小论文matlab作图技巧
小论文matlab作图技巧 编辑->复制选项 编辑->图形属性 图中右击->字型 编辑->复制图片,即可. 效果: 宽:5.9高: 7.91
- MATLAB作图方法与技巧(二)
作为MATLAB作图方法与技巧(一)的补充 1.绘制二维散点图 ① scatter函数 scatter(x,y,s,c)函数绘制向量x和y的散点图,其中s代表点的大小,c代表点的形状,s和c缺省时为默 ...
- MATLAB作图方法与技巧(一)
下面从折线图.曲面图和图形说明与定制三个方面说明MATLAB作图的一些方法与技巧,注意,文中出现的单引号在MATLAB中实际运行的时候,需要改为MATLAB认可的单引号. 一. 作折线图 1.plot ...
- Latex技巧:LaTex插图命令includegraphics参数详解
Latex插图的命令是\includegraphics[选项]{文件} 这里的选项在表 7.1, 7.2, 7.3 中列出. 因为 \includegraphics 不会结束 当前段落,所以它能够在文 ...
- LaTeX技巧012:LaTeX 插图加载宏包
LaTeX 插图加载宏包.支持 LaTeX - DVIPDFMx; pdfLaTeX; XeLaTeX 三种编译方式,支持 eps/pdf/jpg/png 等图片格式. % Put this snip ...
- Matlab: 作图
控制图的大小 figure('position',[x0,y0,dx,dy]); figure(fig number); 显示图例 legend('leg1','leg2') depend on ho ...
- latex插图续
LaTeX中一般只直接支持插入eps(Encapsulated PostScript)格式的图形文件, 因此在图片插入latex文档之前应先设法得到图片的eps格式的文件. UNIX下的各种应用软件 ...
- [LaTex]插图
1.不错的Latex参考网站 http://www.ctex.org/documents/latex/graphics/node120.html http://www.ctex.org/documen ...
随机推荐
- App.Config自定义配置节点
配置文件: <?xml version="1.0" encoding="utf-8"?> <configuration> <con ...
- swfupload上传图片
项目结构 以及插件需要的文件如图所示 前端代码: <!DOCTYPE html> <html> <head> <title>SWFUpload</ ...
- Rancher与OpenLDAP对接
简要说明: Rancher官网文档中,关于访问控制,有与OpenLDAP对接的介绍,但只是简要一笔带过,Rancher与OpenLDAP对接页面中的几个参数如何填写,并没有详细的说明. 本文通过Ope ...
- 虚拟机安装---vm12+ubuntukylin16.04
虚拟机安装及部分问题解决方案: https://blog.csdn.net/qq_35208390/article/details/78271743 安装vmware tools后,需设置共享文件夹才 ...
- GreenDao3使用完全解析
1,gradle配置(官网样例地址https://github.com/greenrobot/greenDAO/blob/master/examples/RxDaoExample/build.grad ...
- Java se基础(类的属性及关键字)
public:说明该类的访问类型是公有的,它生成的对象能被其他的对象调用! abstract:用来声明抽象类! final;如果一个类被声明成final类型,那么就不能再由它派生出子类. 可以简单的看 ...
- java重新开始学习
1.从菜鸟网站开始学习.http://www.runoob.com/java/java-tutorial.html 2. String args[] 与 String[] args 还有一个就是Str ...
- Run keyword if
Wait For Page Ready ${a} Run Keyword And Return Status Page Should Contain 新建 log ${a} Run Keyword I ...
- (转)C# 构造函数与析构函数
(1)构造函数<1>除非是static,否则编译器将会给每一个没有构造函数的类指定一个默认的构造函数<2>构造函数private时候,类不能被实例化<3>派生类可以 ...
- 雷林鹏分享:jQuery EasyUI 窗口 - 自定义窗口工具栏
jQuery EasyUI 窗口 - 自定义窗口工具栏 默认情况下,窗口(window)有四个工具:collapsible.minimizable.maximizable 和 closable.比如我 ...