Http://blog.sina.com.cn/s/blog_59cf672601015qmm.html
Table of Contents: 1. The default text interpreter for the graphics window is latex2. graphics window maximized 3. Double coordinate 4. Time 5. Local magnification sub-image 6.Figure scaling font 7.legend marker,line properties operation (multi-legend, Curve reduction marker) 8.eps pictures in lat Not shown in ex 9. The axis is obscured, saved, and disappears 10. Use all or a class of file 11 under a directory. [The original]eps picture uses the implied information to do callout 12. Generate high-quality transparent vectors Figure 13. The processing of Nan in Imagesc 14. Save true Vector EPS Figure 15 when the data volume is large. The axes are maximized in the graph by 16. EPS Chart embedding fonts
1. Make the default text interpreter for the current graphics window latex:
Set (GCF, ' defaulttextinterpreter ', ' latex ')
The same can be generalized: set (0, ' defaulttextinterpreter ', ' latex ') but legend's interpreter doesn't seem to be affected by this setting? (You can use ' interpreter ', ' latex ' to set it up, but it doesn't feel right.) 2. Maximize the Graphics window: set (GCF, ' outerposition ', get (0, ' screensize ')) 3. Double coordinates [HAX,HL1,HL2]=PLOTYY ([x1,y1,x2,y2],[ X3,Y3]); This will draw two curves (x1,y1) and (X2,y2) on the left axis, and a right axis (x3,y3) for some settings of the axis can be manipulated by the return value set (GCF, ' currentaxes ', Hax (1))// Adjust the current axis to the left axis set (GCA, ' ylabel ', ' xxxx ')//Then you can operate the axis normally, or you can use hold on to increase the curve 4. Timing T0 = CPUTime; procedure; time=cputime-t0;tic; program; toc;t0 = clock; Time = ETime (clock, t0); 5. Local amplification sub-map has a mmzoom extension, you can use the mouse to select the area to enlarge, it is also very good, but not conducive to precise control. In fact, it is not difficult to draw your own sub-map: Myzoom ([0.18,0.18,0.4,0.3],[x0,x1,y0,y1]) through the author's own simple function of writing to achieve amplification: function Myzoom (Position,axiscale) ha= Get (GCF, ' currentaxes '); Ha1=copyobj (GCA,GCF); set (HA1, ' position ', position) set (GCF, ' currentaxes ', HA1) axis ( Axiscale) Xlabel (") Ylabel (") Set (GCF, ' currentaxes ', ha) where position is the relative position and size of the word graph in the current diagram, [x0,x1,y0,y1] is the coordinate range you want to enlarge. 6. Figure scaling Font Problems Let the font vary with the scale of the figure as you set it: Hf=figure;fp=get (HF, ' position '); times=2.0; % Custom Zoom multiplier, set (HF, ' position ', [0 0 TIMES*FP (3:4)])%figure scaling set (GCA, ' FontSize ', Times*get (GCA, ' FontSize '))%gca the various font scaling xlabel (' X ')%label written after GCA FontSize settings, There is no need to set its font ylabel (' Y ') hc=colorbar;set (hc, ' FontSize ', Times*get (hc, ' FontSize '))%, assuming there is colorbar, which is actually another axes, Also set its font reference:http://blog.csdn.net/benjmzhu/article/details/7246870 see this here to know the output format can also be set in the export setup, The Set (FindAll (GCF, '-property ', ' FontSize '), ' FontSize ', 12) can change the font size of all objects to number 12th! 7.legend Marker,line, such as the operation of such a situation, too many curves, with a linetype to express is not enough, can only be used marker, color combination of line to do. The General magazine also has the request, is does not have the color to be able to explain each curve the meaning, thus can only use marker to combine the linetype to do. But if the cup is your data points too much, resulting in marker too much, the whole picture of the words are not clear at all. The simplest way to solve this problem is to: ... Haha, directly call out-of-the-box function (the author made a little revision on the basis of the original author, so that it can be used when the difference between the horizontal and the ordinate range is large, we can also consider the problem of log coordinates), when using legend after the use of this function, will not affect legend: " NUMMARKERS.M " http://pan.baidu.com/share/link?shareid=1072992811&uk=151290240 before the method of their own in fact, the principle is consistent, Also use the line to draw different colors of the curve, and then each curve less with a point marker again, so that involves legend how to show, is to legend the line, color to customize. X=0:0.0001:2*pi;y1=sin (x); Y2=cos (x); Figurehold onbox Onn=1000;hl (1) =plot (x (1:n:end), Y1 (1:n:end), ' Rd '); HL (2) =plot (x (1:n:end), y2 (1:n:end), ' GO '); lstr={' sin (x) ', ' cos (x) '};p Lot (x,y1, ' R ') plot (X,y2, ' G ') [Hleg chleg hplot hlabel]=legend (hl,lstr, ' location ', ' Southwest ');%hplot,hlabel in r2013a can be used instead of set (Chleg, ' LineStyle ', '-') It is more puzzling that the objects contained in Chleg are manipulated individually: set (Chleg (1 ), ' LineStyle ', '.-'), this operation with Get (Chleg (1)) is normal, but the picture does not respond!!! Reference: http://www.mathworks.com/matlabcentral/newsreader/view_thread/96754http://www.mathworks.com/ MATLABCENTRAL/ANSWERS/49027 also has a more ingenious method: http://blog.sciencenet.cn/blog-43412-45936.html
8.eps images are not fully displayed in Latex.
The performance of EPS image is inserted with Latex, it will show incomplete, the picture that appears in the PDF is a part of the case that is truncated.
The reason is that the EPS picture papersize is set too small, the picture exceeds the paper range.
(The author also does not quite understand bounding box and papersize each is what, in MATLAB also has paperposition setting, this and bounding box is corresponding? PaperSize set into A0, but the printed figure is compact, size is not this papersize Ah! )。
Here's a solution for the author to use the command:
Set (GCF, ' papertype ', ' A0 ')
Set (GCF, ' Paperpositionmode ', ' auto ')
Print (' filename ', '-DEPSC ');
Depending on the MATLAB help file, it is best to set paperunit before setting Papertyper. Of course papersize can be set by itself (Papertype gives a few default settings: Http://en.wikipedia.org/wiki/Paper_size#C_series).
Set (GCF, ' paperunits ', ' inches ');
Set (GCF, ' PaperSize ', [5 7]);
Reference:
Http://blog.sciencenet.cn/blog-533656-428329.html
http://blog.renren.com/share/236157660/13151799720
Http://nibot-lab./73290.htmlhttp://blog.sciencenet.cn/blog-471076-381288.html
Http://blog.sina.com.cn/s/blog_618af1950100jipf.html 9. The axis is obscured, saved and disappeared set (GCA, ' Layer ', ' top ') The% axis is masked set (GCA, ' LineWidth ', 2)% saved to PNG image after the axis disappeared, may be due to the axis too thin (troubled me for a long time, such as the use of patch set transparent after the axis disappears, with Pcolor after the axis disappears) 10. Use all or a class of files in the directory Files=dir (' *.txt '); for i=1:length (Files) a=load (Files (i). Name); end note that Linux directly with the dir command will get all the files and directories (files.isdir=1), the directory will also contain the current directory "." and the parent directory "...". Write your own words, Linux can consider using the system command to combine RegExp (str, ' \t+\s+ ', ' split '), or quite troublesome, rather than directly with the convenience of Dir. 11. [Original]eps image using implicit information annotation because there are some information about the EPS picture that describe the file name, title, creator, etc., we can put some information that does not need to be displayed in the graph but need to put in the EPS file in the implied comment information. (This information is not easily changed with file name changes.) Does this make you think of the exon and intron in the gene sequence? Maybe the human gene contains a note or a backdoor that the creator implanted, haha ... So how do you put it in? In fact, EPS is based on text, and it can be edited when the text document is opened! So in Matlab, how to do it? Put the information you want to write into a string, and then replace or add some of the comment information in the EPS file! I am not familiar with the string substitution operation of Matlab, so at present I only put a Linux system with the system SED command to add information example: info= ' Hello, world! '; Eval_r (['!sed-i ' s/\ (\%\%title.*\)/\%\% ', info, '/g ' ' test.eps ']) so, when you open the Picture Viewer and look at the document's "Properties," you can see its title as "Hello, World! ". 12. Generate transparent high-quality vectors (not fully tested) how to set the data containing Nan into white and ensure the quality of the output graph in the 12.1 color map. Http://www.mathworks.com/matlabcentral/newsreader/view_thread/140607 This 3rd is the best way, although a bit more complex, but to ensure that the data display is correct, and the output of the image volume is small and good quality. The method of Pcolor or set (H, ' Alphadata ', ~isnan (C)) will cause the generated EPS picture to be large and poor quality because it is set transparent: The axis is missing, the text is jagged. 12.2 three-dimensional figure http://www.mathworks.com/matlabcentral/newsreader/view_thread/158841print-depsc2 -paintersTest3.eps can solve the problem of low output quality of some three-dimensional graphs, but there is a problem when outputting a graph with transparent data. 12.3 Transparent Figure http://www.myoutsourcedbrain.com/2009/07/produce-print-quality-figures-from.html 13 Imagesc the processing of Nan (free to consider the perfect solution) why is MATLAB not in the IMAGESC direct default color is white? Pcolor is like this, imagesc but not the same, how to consider? Don't understand! 13.1 Ready-to-use m files, set to any color: https://gist.github.com/zertrin/5553630 13.2 The simplest sentence (if you save an EPS picture, you may find it a tragedy): H=imagesc (C) Set (H, ' Alphadata ', ~isnan (C)) 13.3 make your own color label and convert nan: http://www.mathworks.com/matlabcentral/newsreader/view_thread/ 33744 14 Large data volume when saving true vector EPS graph Matlab encountered a relatively large amount of data, even if you want to save as an EPS vector graph, the actual given is a pseudo-vector diagram, first as a bitmap to do a conversion, and then output as an EPS graph. This saves the EPS picture, one is poor quality, and the second is that the text inserted into the latex can not be edited. There is no problem with saving using the following method: Print (GCA, '-depsc2 ', ' painters ', filename) reference: http://stackoverflow.com/questions/8280971/ Matlab-and-high-quality-eps-figures (here also has a extension export_fig file and Savesvg file, seemingly very powerful, no attempt)
15. Axes are maximized in the graph
Tightinset = Get (GCA, ' tightinset ');
Position (1) = Tightinset (1);
Position (2) = Tightinset (2);
Position (3) = 1-tightinset (1)-tightinset (3);
Position (4) = 1-tightinset (2)-tightinset (4);
Set (GCA, ' Position ', Position);
SaveAs (H, ' withoutmargins.pdf ');
Source Address: http://stackoverflow.com/questions/5150802/ How-to-save-a-plot-into-a-pdf-file-without-a-large-margin-around 16. EPS graph embedding font export_fig file is useful to solve the problem of EPS font embedding: http://btstream.is-programmer.com/posts/24988.html Other Solutions:/HTTP// Blog.sina.com.cn/s/blog_a3b1929c0100zh5b.html
Matlab Handy Gadget