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 ...
随机推荐
- prometheus的agent 二次开发代码参考
import com.codahale.metrics.MetricRegistry;import io.prometheus.client.CollectorRegistry;import io.p ...
- 在nodejs中的集成虹软人脸识别
==虹软官网地址==http://www.arcsoft.com.cn 在官网注册账号,并且申请人脸识别激活码, 选择SDK版本和运行系统(windows/linux/android/ios) ,我们 ...
- Unity --- 纹理压缩基本知识点
1.Unity支持的压缩格式的分类,这里主要指Android平台和IOS平台: DXT格式 --- Nvidia Tegra(图睿)提供ETC --- 安卓原生支持的,OPNEGL2.0都支持,ET ...
- 雷林鹏分享:jQuery EasyUI 树形菜单 - 树形网格动态加载
jQuery EasyUI 树形菜单 - 树形网格动态加载 动态加载树形网格有助于从服务器上加载部分的行数据,避免加载大型数据的长时间等待.本教程将向您展示如何创建带有动态加载特性的树形网格(Tree ...
- 20190118_xlVBA多表合并
Public Sub simple() Set wb = ActiveWorkbook Set sht = ActiveSheet msg = MsgBox("程序准备清除活动工作表内容?按 ...
- RMQ 解决区间查询问题
线段树写法不管,比较灵活.这里主要讨论DP实现. 其实单纯说RMQ解决的是区间最值查询是不准确的,只要满足一个区间的信息可以从它的覆盖区间获得(即[L,R]<=[L,r],[l,R] (l< ...
- 第二阶段——个人工作总结DAY07
1.昨天做了什么:昨天了解了一下时间抽也是一种ListView,然后就此学习了一下如何来修改. 2.今天打算做什么:今天在网上搜一些例子,找比较好看的界面,并实现代码. 3.遇到的困难:不知道最后连接 ...
- stl常用的查找算法
#include<iostream> using namespace std; #include"vector" #include"algorithm&quo ...
- WDA基础十:OVS搜索帮助的使用
对于WDA来说,常用的搜索帮助有OVS,标准SH,Interface view等.今天来说说两种常用的OVS的使用: 一:普通字段,表字段的搜索帮助(在创建节点的时候指定搜索帮助OVS,或者后面加上去 ...
- 函数使用八:BP_EVENT_RAISE
此函数是关联触发一个已经定义的事件,这个事件可以放到SM36里设置JOB,这样就做成了一个事件触发JOB的东西. Import EVENTID 事件ID ,对应S ...