更改格子图中条上的文本 [英] Change text on strips in lattice plots

查看:55
本文介绍了更改格子图中条上的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何更改显示在格子图中的文本? 例子: 假设我有一个由3列组成的数据帧测试

how do I change the text displayed in the strips of lattice plots? example: suppose I have a data frame test consisting of 3 columns

x
 [1]  1  2  3  4  5  6  7  8  9 10

y
 [1] "A" "A" "A" "A" "A" "B" "B" "B" "B" "B"

a
 [1] -1.9952066 -1.7292978 -0.8789127 -0.1322849 -0.1046782  0.4872866
 [7]  0.5199228  0.5626998  0.6392686  1.6604549

对晶格图的正常调用

xyplot(a~x | y,data=test)

将在条上给出带有文本"A"和"B"的情节

will give the plot with the Text 'A' and 'B' on the strips

我如何在试条上写出不同的文字?

How can I get different texts written on the strips?

另一个字符向量的人

z
 [1] "a" "a" "a" "a" "a" "b" "b" "b" "b" "b"

和对strip.custom()

xyplot(a~x | y,data=test,strip=strip.custom(var.name=z))

没有给出期望的结果.

实际上这是一个国际化问题.

In reality it is an internationalization problem.

推荐答案

我认为可以通过以下方式获得想要的东西:

I think what you want can be obtained by:

z <-c( "a" , "b" ) # Same number of values as there are panels
xyplot(a~x | y,data=test,strip=strip.custom(factor.levels=z))

这篇关于更改格子图中条上的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆