我使用下面的代码生成带有注释的简单图表:
require(ggplot2); data(mtcars)
ggplot(mtcars, aes(x = wt, y = mpg)) +
geom_point() +
annotate("text", x = 4, y = 25, label = "This should be bold\nand this not",
colour = "red") +
geom_vline(xintercept = 3.2, colour = "red")
在该图表上,我想将粗体字应用于文本注释中短语的第一部分:
这应该是粗体
但我希望文本的其余部分在字体和样式方面保持不变。
答案 0 :(得分:27)
如果您在两个注释中将其拆分没有问题,您可以这样做:
<?xml version="1.0" encoding="UTF-8"?>
<Data>
<Entry>
<CName>CCXXX</CName>
<CCH_Summary>Marketing</CCH_Summary>
<CCH_Rollup_1>Marketing Group</CCH_Rollup_2>
<CCH_Rollup_2>Marketing (COR)</CCH_Rollup_2>
<CCH_Rollup_3>Cost of Revenue</CCH_Rollup_3>
<CCH_Rollup_4>Total Cost Centre</CCH_Rollup_4>
</Entry>
<Entry>
<CName>CCXXX</CName>
<CCH_Summary>Finance</CCH_Summary>
<CCH_Rollup_1>Finance Ret</CCH_Rollup_2>
<CCH_Rollup_2>Finance Acct (COR)</CCH_Rollup_2>
<CCH_Rollup_3>Cost of Revenue</CCH_Rollup_3>
<CCH_Rollup_4>Total Cost Centre</CCH_Rollup_4>
</Entry>
</Data>
答案 1 :(得分:20)