簡體   English   中英

如何更改散點圖的字體和填充顏色?

[英]How do I change the font of, and color the fill of the scatterplot?

我想更改字體並填充散點圖中變量的背景。 我沒有成功。

crime <- read.csv('http://datasets.flowingdata.com/crimeRatesByState2005.csv',sep=",", header=TRUE)

crime2 <- crime[crime$state != "District of Columbia",]
crime2 <- crime2[crime2$state != "United States",]

windowsFonts(D=windowsFont("Georgia"))

pairs(crime2[,2:9]
      , panel=panel.smooth
      , col.smooth = "blue"
      , col="gray"
      , pch=16 #dot fill
      , labels=c("Murder","Forcible Rape","Robbery","Aggrevated \n Assault","Burglary","Larceny/Theft","Motor Vehicle \n Theft","Population")
      , font.labels=1 #normal
      , font.main=3 #italics
      , cex.labels=1.5 #size
      , las=1 #horizontal
      #, font.family="D"
      #, labels.family="D"
      #, cex.family="D"
      ) 
mtext("Rates per 100,000 population \n  \n ", side=3, adj=0, line=1.2, cex=1, font=3, family="D")

嘗試一些效果plot(1:10, pch=21, col="black", bg="lightblue") 您必須使用可以具有背景顏色(21 到 25,請參閱?points )的pch值,並使用col指定外部顏色,使用bg指定內部顏色(請參閱?par和/或?points )。

至於字體,您可能指的是par()family參數。 這些可以是特定於圖形設備的(並且不同的操作系統使用不同的默認圖形設備;例如, par(family="Times")在 Mac 上提供 Time New Roman,但在 PC 上不提供),但某些字體如“serif”、“sans” ,和“單聲道”跨平台工作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM