如何使用table, tr, td {
border: 1px solid silver;
border-collapse: collapse;
width: 500px;
}
tr {
height:100%;
}
td {
padding: 0px;
word-wrap:none;
text-wrap:none;
font-size:20px;
line-height:20px;
height:100%;
width: 25%;
}
td input {
border:0px;
width:100%;
height:100%;
margin:0px;
padding: 0px;
line-height:18px;
font-size: 18px;
}
和格子<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table>
<tr>
<th>col 1</th>
<th>col 2</th>
<th>col 3</th>
<th>col 4</th>
</tr>
<tr>
<td data-field="r1v1">row 1 val 1</td>
<td data-field="r1v2">row 1 val 2</td>
<td data-field="r1v3">row 1 val 3</td>
<td data-field="r1v4">row 1 val 4</td>
</tr>
<tr>
<td data-field="r2v1">row 2 val 1</td>
<td data-field="r2v2">row 2 val 2</td>
<td data-field="r2v3">row 2 val 3</td>
<td data-field="r2v4">row 2 val 4</td>
</tr>
</table>
更改某些点的颜色?我可以使用ifelse
:
我也可以使用参数stripchart()
更改绘图的颜色,但我正在尝试做一些更复杂的事情,例如:stripchart(d, method="stack", offset=1, pch=19, at=1.0)
。 (在此示例中,小于或等于40的所有点都是黑色,40以上的所有点都是红色。)如何将col
应用于此图?
答案 0 :(得分:0)
也许最简单的方法是编写一个简单的脚本来进行数学运算并使用标准plot()函数绘制条形图
#generate some random numeric data
set.seed(100)
d <- sample(10:80, size = 150, replace = TRUE)
# count re-occurences of the same value (for plotting on the y-axis)
td <- do.call(rbind, lapply(1:length(d), (function(i){
c(d[i], 1+ sum(d[1:i] == d[i]))})))
# plot
plot(x= td[,1], y = td[,2],
pch=19, ylim = c(0, 20),
col = ifelse(td[,1]>49, "red", "blue"))