2015-11-11 55 views
0

我想在python中創建類似IDL的陰謀。通過改變matplotlib目錄中的matplotlibrc文件中的一些細節,我已經接近完成了。以下是我已經改變了我matplotlibrc文件看起來像從標準matplotlibrc文件:更改陰謀中的數字標籤

 ### MATPLOTLIBRC FORMAT 

backend  : tkagg 

### LINES 
lines.linewidth : 1.1  # line width in points 
lines.color  : black # has no affect on plot(); see axes.color_cycle 

### FONT 
font.family   : sans-serif 
font.weight   : ultralight 
font.size   : 12.0 
font.sans-serif  : Avant Garde 

### TEXT 

### LaTeX customizations. See http://www.scipy.org/Wiki/Cookbook/Matplotlib/UsingTex 
text.usetex   : True # use latex for all text handling. The following fonts 
           # are supported through the usual rc parameter settings: 
           # new century schoolbook, bookman, times, palatino, 
           # zapf chancery, charter, serif, sans-serif, helvetica, 
           # avant garde, courier, monospace, computer modern roman, 
           # computer modern sans serif, computer modern typewriter 
           # If another font is desired which can loaded using the 
           # LaTeX \usepackage command, please inquire at the 
           # matplotlib mailing list 

mathtext.fontset : custom # Should be 'cm' (Computer Modern), 'stix', 
         # 'stixsans' or 'custom' 

### AXES 
axes.facecolor  : white # axes background color 

### TICKS 
xtick.major.size  : 6  # major tick size in points 
xtick.minor.size  : 3  # minor tick size in points 
xtick.major.width : 1 # major tick width in points 
xtick.minor.width : 1 # minor tick width in points 

ytick.major.size  : 6  # major tick size in points 
ytick.minor.size  : 3  # minor tick size in points 
ytick.major.width : 1 # major tick width in points 
ytick.minor.width : 1 # minor tick width in points 

### GRIDS 
legend.numpoints  : 1  # the number of points in the legend line 
legend.frameon  : False # whether or not to draw a frame around legend 

### FIGURE 
figure.figsize : 4, 4 # figure size in inches 
figure.dpi  : 100  # figure dots per inch 
figure.facecolor : none # figure facecolor; 0.75 is scalar gray 
figure.edgecolor : white # figure edgecolor 

### SAVING FIGURES 
savefig.dpi   : 1000  # figure dots per inch 
savefig.format  : ps  # png, ps, pdf, svg 
savefig.bbox  : tight # 'tight' or 'standard'. 

是從這些變化產生了情節的一個例子。請注意,輸出(即圖)用Avant Garde(如matplotlibrc中指定的)標記x和y軸,但數字不是Avatn Garde類型。我怎樣才能讓這些數字與劇情中的標籤具有相同類型的字體,這樣兩者都是Avant Garde?另外,有沒有辦法讓字體更窄(更薄),以便「初始速度」字樣非常薄(i.e., like Hershey vector fonts)?

回答

1

您需要包括行

text.latex.preamble : \usepackage{sfmath} 

.matplotlibrc文件。這告訴latex使用sans-serif字體作爲數學文本,這是它用於刻度標籤的原因。

+0

謝謝。我需要下載sfmath軟件包嗎?一旦下載,它應該放在哪裏? – inquiries

+0

它可能,如果你還沒有它。你可以從CTAN獲得[這裏](https://www.ctan.org/pkg/sfmath)。您可以將它放在您運行腳本的本地目錄中,或者以通常的方式將其安裝到您的'TeX'發行版中 – tom