Polarity Axis Analysis Visualization
Status: Proposed Date: 2025-11-30 Context: ADR-070 Web UI Enhancement
Problem Statement
The Polarity Axis Analysis produces rich multidimensional data that currently displays only as text statistics and lists. Users need to visually understand:
- How concepts distribute across the polarity axis
- The correlation between position and grounding strength
- Clustering patterns and outliers
- The overall "shape" of the semantic dimension
Research Findings
Established Visualization Patterns
- Semantic Differential Scales (Vizzlo, AYTM)
- Classic method for bipolar dimensions (since 1950s)
- Typically shows single dimension as profile chart
-
Our challenge: multiple concepts to display simultaneously
- Standard visualization for correlation analysis
- Shows relationship between two continuous variables
-
Best practice includes regression line, interactive tooltips
-
Bubble Charts for Multidimensional Data (Chartio, Storytelling with Data)
- Encode 3-4 dimensions: x-position, y-position, size, color
- Human cognition limit: ~4 visual dimensions (source)
-
Optimal match for our data structure
-
Interactive Features (R Psychologist, Number Analytics)
- Tooltips showing details on hover
- Zoom/pan for exploration
- Filtering and brushing
- Linked views between visualizations
Available Data Dimensions
From each analysis we have:
Per-Concept: - Position on axis: -1 (negative pole) to +1 (positive pole) - Grounding strength: continuous value (can be negative) - Direction label: positive, neutral, negative - Axis distance: how well concept fits the dimension - Concept label and ID
Aggregate Statistics: - Pearson r (correlation coefficient) - p-value (significance) - Mean position - Distribution by direction - Regression line parameters (can derive from r and data)
Proposed Visualization System
Primary: Bubble Chart Scatter Plot
Visual Encoding:
| Dimension | Encoding | Rationale |
|---|---|---|
| Position on axis | X-axis (-1 to +1) | Natural mapping to polarity dimension |
| Grounding strength | Y-axis | Primary variable of interest for correlation |
| Direction category | Color | Immediate visual grouping (blue/gray/orange) |
| Axis distance (fit) | Bubble size | Larger = better fit to dimension |
| Correlation trend | Regression line overlay | Shows correlation visually |
Layout:
┌─────────────────────────────────────────────────────────┐
│ Grounding │
│ Strength o ● O Regression Line │
│ ↑ ● O o ● / │
│ │ o ● o ● / │
│ │ O ● o O /● │
│ │ ● o O ● o/ │
│ │o ● O ● o/ │
│ └──────────────────────────→ │
│ -1 Neutral +1 │
│ Negative Pole Position Positive Pole │
│ │
│ Legend: │
│ ● Positive o Neutral ● Negative │
│ Size = Relevance to axis │
└─────────────────────────────────────────────────────────┘
Interactive Features: - Hover: Tooltip shows concept label, exact position, grounding, axis distance - Click: Highlight concept, dim others - Zoom/Pan: Explore dense regions - Filter: Toggle direction categories on/off
Secondary: Distribution Histogram
Shows concept distribution across the axis (below or beside scatter plot).
┌─────────────────────────────────────────────────────────┐
│ Count │
│ ↑ ┌──┐ │
│ │ │ │ ┌──┐ │
│ │┌──┤ │ ┌──┤ │ ┌──┐ │
│ ││ │ │ │ │ │ │ │ │
│ └──────────────────────────────→ │
│ -1 Neutral +1 │
│ │
│ Stacked by direction: │
│ ■ Positive □ Neutral ■ Negative │
└─────────────────────────────────────────────────────────┘
Tertiary: Statistics Summary Panel
Visual hierarchy of key metrics (could be beside or above chart):
┌──────────────────────────────────────┐
│ Correlation: r = 0.82 ●●●●○ │
│ p < 0.01 (confident) │
│ │
│ Balance: ──────●─────── │
│ -1 0.07 +1 │
│ (slightly positive-leaning) │
│ │
│ Concepts: 9 ■ 9 □ 0 ■ │
│ Pos Neu Neg │
└──────────────────────────────────────┘
Implementation Considerations
Reuse Existing Explorer Components
Important: Leverage existing patterns from /web/src/explorers/common/ for consistency:
Applicable Components: - NodeInfoBox.tsx → Show concept details when clicking bubbles - useGraphContextMenu.ts → Right-click context menu for concepts (e.g., "View in graph", "Copy ID") - Legend.tsx → Direction color legend (positive/neutral/negative) - StatsPanel.tsx → Statistics summary panel - PanelStack.tsx → Panel management for stacking info panels - styles.ts → Common visual themes and colors - labelStyles.ts → Consistent text styling
Benefits: - Familiar UX patterns across all explorers - Reduced code duplication - Consistent visual language - Maintained accessibility patterns
Technology Options
Recharts (Recommended for Phase 1): - Good React integration - Declarative API - Built-in responsive design - Supports bubble charts, tooltips, zoom - Trade-off: Less customization than D3 - Compatible with: Existing explorer component patterns
Victory: - More customizable - Better animation support - Steeper learning curve
D3.js: - Maximum flexibility - Full control over interactions - Requires more development time - Better for novel visualizations
Recommendation: Start with Recharts for rapid implementation, integrate with existing explorer components (NodeInfoBox, context menu), migrate to D3 if we need custom interactions later.
Color Palette
Using existing Polarity Explorer colors:
- Positive pole concepts: text-blue-500 (#3B82F6)
- Neutral concepts: text-muted-foreground (gray)
- Negative pole concepts: text-orange-500 (#F97316)
With opacity for overlapping bubbles: 0.6-0.8 alpha
Size Scaling
Axis distance ranges from 0 (perfect fit) to potentially >2 (unrelated).
Inverse mapping for bubble size: - Distance 0.0-0.5: Large bubbles (12-20px radius) - Distance 0.5-1.0: Medium bubbles (8-12px radius) - Distance >1.0: Small bubbles (4-8px radius)
Performance
With typical analysis of 10-50 concepts: - Scatter plot: No performance concerns - Histogram: Fast to compute and render - Interactive features: Debounce hover events
For future scaling to 100+ concepts: - Consider canvas rendering instead of SVG - Implement virtualization or clustering - Add overview+detail pattern
User Benefits
This visualization enables users to immediately answer:
- "Do concepts cluster or spread evenly?" → Visual density in scatter plot
- "Is the correlation strong?" → Slope of regression line, visual trend
- "Which side has better evidence?" → Y-axis distribution, regression direction
- "Are there interesting outliers?" → Bubbles far from regression line
- "How balanced is the axis?" → X-axis distribution, mean position marker
- "Which concepts are most relevant?" → Larger bubbles
Next Steps
- Create proof-of-concept scatter plot with mock data
- Integrate with actual analysis results
- Add interactive features (tooltips, filtering)
- User testing for clarity and insights
- Refine based on feedback
- Add distribution histogram
- Add statistics summary panel
Open Questions
- Should we show pole labels on the chart itself or rely on surrounding context?
- Do we need a "reference" or "baseline" visualization for comparison across queries?
- Should axis distance be encoded as size or as a secondary metric (e.g., border thickness)?
- How do we handle extreme outliers (grounding >> 1 or << -1)?
- Would users benefit from exporting the visualization as PNG/SVG?
References
- Semantic Differential Scale Maker - Established bipolar visualization
- Mastering Scatter Plots - Best practices
- Bubble Chart Complete Guide - Multidimensional encoding
- What is a Bubble Chart - Cognitive limits
- Interactive Scatter Charts - Modern examples
- Understanding Correlations - Interactive demo
- Data Visualization for Correlation - Analysis techniques