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

使用SensoMineR的pmfa函数时R无法生成全部面板员图谱求助

Troubleshooting Missing Last Panelist Plot in SensoMineR's pmfa Function

Let’s work through this issue step by step. First, I spotted a small but critical error in your code that might be causing unexpected behavior, even if you didn’t get an explicit error message:

1. Fix the Mismatched Variables in Your Descriptor Data Frame

When creating data1.desc, you defined variables sweet, earthy, bitter, astringent, smokey but then tried to bind sweet, earthy, creamy, vanilla, smokey—creamy and vanilla don’t exist! This will throw an error, so let’s correct that first:

sweet <- c(1, 1, 2, 1)
earthy <- c(1, 1, 1, 2)
bitter <- c(1, 0, 0, 0)
astringent <- c(2, 0, 2, 1)
smokey <- c(2, 2, 0, 0)
# Use the variables you actually defined
data1.desc <- data.frame(cbind(sweet, earthy, bitter, astringent, smokey)) 
rownames(data1.desc) = c("Sample1" ,"Sample2" ,"Sample3" ,"Sample4")

2. Fix the Missing Last Panelist Plot

Since the official example works, the issue is likely related to how your system handles plotting windows, not the data structure. Try these fixes:

Option 1: Swap x11() for dev.new()

x11() can have compatibility issues on some systems (like macOS or headless environments). Using dev.new() creates a fresh, system-agnostic plotting window that should render all panels:

library(SensoMineR)
nappeplot(data1.coord, lim = c(650,433))
# Replace x11() with dev.new()
dev.new()
res1 <- pmfa(data1.coord, data1.desc)

Option 2: Force a Multi-Panel Layout

Manually set a plot layout to ensure all panelist maps are displayed in a single window, preventing any from being dropped:

# Set a 3-row, 1-column layout for your 3 panelists
par(mfrow = c(3, 1))
res1 <- pmfa(data1.coord, data1.desc)
# Reset layout to default after plotting
par(mfrow = c(1, 1))

Option 3: Verify the Analysis Results First

Double-check that pmfa is actually generating data for all panelists (the issue might only be with plotting, not the analysis itself):

# Check if all sample coordinates exist for each panelist
print(res1$ind$coord)
# Inspect panel-specific transformation parameters
print(res1$panels)

If you see data for all 3 panelists here, the problem is definitely in the rendering step, and the above fixes should resolve it.

3. Update SensoMineR (If Needed)

Outdated package versions can have bugs. Check your current version and update if necessary:

# Check installed version
packageVersion("SensoMineR")
# Update to the latest version
install.packages("SensoMineR")

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.06 13:32:49