我知道library(grid)
library(gridExtra)
library(gtable)
# Build table
tabla_fin <- rbind(
c("","2015\nabril","2016\nabril","2017\nmarzo","2017\nabril"),
c("Pedidos",-23.3,-13.8,-26,-39),
c("Existencias",7.6,1.2,5.3,10.5),
c("Expectativas",30.7,32.7,28.7,24),
c("ICI",-0.1,5.9,-0.9,-8.5),
c("ICI Desest*",0.4,5.7,-3.2,-6.9))
colnames(tabla_fin) <- tabla_fin[1,]
tabla_fin <- tabla_fin[-1,]
rownames(tabla_fin) <- tabla_fin[,1]
tabla_fin <- tabla_fin[,-1]
print(tabla_fin)
# 2015\nabril 2016\nabril 2017\nmarzo 2017\nabril
# Pedidos "-23.3" "-13.8" "-26" "-39"
# Existencias "7.6" "1.2" "5.3" "10.5"
# Expectativas "30.7" "32.7" "28.7" "24"
# ICI "-0.1" "5.9" "-0.9" "-8.5"
# ICI Desest* "0.4" "5.7" "-3.2" "-6.9"
# Install Calibri font using the extrafont package
# read the help of font_install()
library(extrafont)
loadfonts(device="win")
# font_install()
# Theme for text tables
t1 <- ttheme_default(
core=list(
fg_params=list(fontface=rep("plain", 6), fontfamily="Calibri",
x=1, hjust=1),
bg_params = list(
fill=c(rep("white",3),"grey80","grey90"),
col=c("white","white","white","grey80","grey90"),
alpha = rep(1,5))
),
rowhead=list(
fg_params=list(x=0, hjust=0, fontface="plain", fontfamily="Calibri"),
bg_params = list(
fill=c("white",rep("white",3),"grey80","grey90"),
col=c("white","white","white","white","grey80","grey90"),
alpha = rep(1,5))
),
colhead=list(
fg_params=list(fontface="plain",fontfamily="Calibri"),
bg_params = list(
fill="grey70",
col="grey70",
alpha = rep(1,5))
)
)
# Create gtable containing text grobs
t <- tableGrob(tabla_fin, theme=t1)
# Add horizontal and vertical lines
t <- gtable_add_grob(t,
grobs = segmentsGrob( # line across the bottom
x0 = unit(0,"npc"),
y0 = unit(0,"npc"),
x1 = unit(1,"npc"),
y1 = unit(0,"npc"),
gp = gpar(lwd = 4.0)),
t = 1, b = 1, l = 1, r = ncol(t))
t <- gtable_add_grob(t,
grobs = segmentsGrob( # line across the bottom
x0 = unit(0,"npc"),
y0 = unit(0,"npc"),
x1 = unit(1,"npc"),
y1 = unit(0,"npc"),
gp = gpar(lwd = 4.0)),
t = 4, b = 4, l = 1, r = ncol(t))
t <- gtable_add_grob(t,
grobs = segmentsGrob( # line across the bottom
x0 = unit(0,"npc"),
y0 = unit(0,"npc"),
x1 = unit(0,"npc"),
y1 = unit(1,"npc"),
gp = gpar(lwd = 4.0)),
t = 1, b = nrow(t), l = 4, r =4)
# Draw table
grid.newpage()
grid.draw(t)
现在是M_PI
,但我不确定CGFloat.pi
会是什么。我试过M_PI_4
,但这不正确。
答案 0 :(得分:8)
Swift 3.1:
M_PI_4
现在是.pi / 4