You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何让R中lattice包的多面板Dotplot所有面板显示X轴值?

Solution for Showing X-Axis Labels on All Lattice Dotplot Panels

To display X-axis labels on every panel of your Dotplot while preserving Y-axis factor labels, adjust the scales parameter to target only the x-axis's alternating behavior. Avoid using the global alternating=FALSE argument, as it affects both axes and causes Y-axis labels to revert to numeric values.

Corrected Code

library(lattice)

Dotplot(percentile~Cbind(pm10,llim,ulim)|lag, 
        data=df3, 
        xlab="PM 10",
        scales=list(x=list(alternating=FALSE)))

Explanation

  • The scales=list(x=list(alternating=FALSE)) setting forces every panel to render X-axis ticks and labels.
  • The Y-axis retains its original factor labels because we didn't modify the Y-axis's alternating behavior (default is alternating=1, which shows labels only on leftmost panels).

If you also want Y-axis labels on all panels, extend the scales argument:

scales=list(x=list(alternating=FALSE), y=list(alternating=FALSE))

内容的提问来源于stack exchange,提问作者Ridhima

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.03 21:53:34