在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
You can customize many features of your graphs (fonts, colors, axes, titles) through graphic options. One way is to specify these options in through the par( ) function. If you set parameter values here, the changes will be in effect for the rest of the session or until you change them again. The format is par(optionname=value, optionname=value, ...)
A second way to specify graphical parameters is by providing the optionname=value pairs directly to a high level plotting function. In this case, the options are only in effect for that specific graph.
See the help for a specific high level plotting function (e.g. plot, hist, boxplot) to determine which graphical parameters can be set this way. The remainder of this section describes some of the more important graphical parameters that you can set. Text and Symbol SizeThe following options can be used to control text and symbol size in graphs.
Plotting SymbolsUse the pch= option to specify symbols to use when plotting points. For symbols 21 through 25, specify border color (col=) and fill color (bg=).
LinesYou can change lines using the following options. This is particularly useful for reference lines, axes, and fit lines.
ColorsOptions that specify colors include the following.
You can specify colors in R by index, name, hexadecimal, or RGB. The following chart was produced with code developed by Earl F. Glynn. See his Color Chart for all the details you would ever need about using colors in R. You can also create a vector of n contiguous colors using the functions rainbow(n), heat.colors(n), terrain.colors(n), topo.colors(n), and cm.colors(n). colors() returns all available color names. FontsYou can easily set font size and style, but font family is a bit more complicated.
In windows, mono is mapped to "TT Courier New", serif is mapped to"TT Times New Roman", sans is mapped to "TT Arial", mono is mapped to "TT Courier New", and symbol is mapped to "TT Symbol" (TT=True Type). You can add your own mappings.
Margins and Graph SizeYou can control the margin size using the following parameters.
For complete information on margins, see Earl F. Glynn's margin tutorial. Going FurtherSee help(par) for more information on graphical parameters. The customization of plotting axes and text annotations are covered next section.
FROM: |
请发表评论