Skip to main content
100%

Simple Dot Plot

✓ Published1🌍 Public
WWilson Fong
Last edited Feb 3, 2025
Created on Feb 1, 2025
Forked from Simple Bar Chart

This dot plot visualizes average math GPAs for seven states using data loaded from a CSV file hosted as a GitHub gist. The p5.js sketch draws labeled axes, tick marks, and colored circles to map each state’s GPA value along a continuous scale from 2.5 to 4.0. The visualization uses `loadTable` in `preload()` for data loading, `createCanvas` for the drawing surface, and `map()` to position elements within a fixed margin and graph area.

AI-generated description

A blank slate starting point showing the "Hello World" for the VizHub V3 Runtime Environment, which supports continuous hot reloading with interactive widgets.

Full course playlist: YouTube: Constructing Visualization 2024.

VizHub Version 3: A New Era in Interactive Coding

The release of VizHub version 3 marks a significant milestone in the evolution of data visualization tools. This new version introduces a unique feature set designed to enhance the coding experience and make data visualization more interactive and intuitive.

Interactive Widgets: A Leap Forward in Real-Time Feedback

One of the standout features of VizHub version 3 is its support for interactive widgets, which enable continuous hot reloading. This means that developers can see the effects of their code changes in real-time, without the need for manual refreshes. By simply holding down the 'Alt' key and dragging a number in the editor, properties like font size can be adjusted on the fly, providing immediate visual feedback.

Simplifying the Entry Point: The Main Function

In a departure from traditional setups, VizHub version 3 does away with the need for an index.html file. Instead, the entry point is a main function exported from index.js. This function takes two arguments:

  • container: A DIV element that has measurable dimensions using clientWidth and clientHeight.
  • options: An object containing state and setState, where:
    • state is initialized as an empty object {} and stores the application's state.
    • setState is a function that can be called with a function to create a new state object using immutable update patterns.

This streamlined approach is designed to simplify the setup process and focus more on the creative aspects of coding.

A Blank Slate Starting Point: "Hello World" for VizHub V3

The "Hello World" example in VizHub version 3 serves as a blank slate starting point, showcasing the capabilities of the new runtime environment. This example demonstrates the simplicity and power of the VizHub V3 Runtime Environment, providing a foundation for developers to build upon.

Learning Through Interaction: The Mouse Follower Example

For an interactive example of the capabilities of VizHub version 3, the Mouse Follower demonstration provides a hands-on experience. This example illustrates how developers can create dynamic visualizations that respond to user input, further highlighting the platform's emphasis on interactivity and real-time feedback.

A Humble Yet Powerful Tool

VizHub version 3 represents a humble yet powerful step forward in the world of interactive coding and data visualization. Its focus on real-time feedback, simplified entry points, and interactive examples aims to enhance the coding experience and make learning more accessible. While there is still much to explore and improve, this new version is a testament to the ongoing efforts to make data visualization more dynamic and engaging.

MIT Licensed

Similar vizzes

Loading thumbnail…

A7 Multi-Line Chart D3

This multi-line chart compares the average math GPA across four U.S. states (California, Florida, Illinois, and New York) over time. It uses D3 v7 with SVG rendering, plotting each state’s data as a distinct colored line—steelblue, green, red, and purple—with corresponding circular markers. Hovering over a point changes its color to orange, and each circle includes a native `<title>` tooltip showing the exact year and average GPA value. The chart features a band-scale x-axis for years, a linear y-axis for GPA (2.8 to 3.7), and axis labels, with a fixed title at the top. Points are plotted using a band scale offset to align with the categorical year positions. The visualization is designed responsively using `window.innerWidth` and `window.innerHeight` for fullscreen viewing. Although the code includes an ordinal color scale definition, it is unused; line and point colors are assigned manually per state (steelblue, green, red, purple). Native SVG `<title>` elements provide tooltips on hover, and CSS hover styles change point colors to orange. The visualization is built with D3 v7 and rendered as SVG, with data parsed from the `satscores.csv` file.# A7 Multi-Line Chart D3 ## Overview This interactive multi-line chart visualizes the average mathematics GPA across four U.S. states—California, Florida, Illinois, and New York—over time. Each state is represented by a distinct colored line with corresponding data points, making temporal trends and state-to-state comparisons straightforward. ## Design The visualization uses a dual encoding of position and color to represent state-level data. Each state is assigned a unique color (California: steel blue, Florida: green, Illinois: red, New York: purple), and both the lines and their associated points share that color coding. The chart employs a band scale for the years on the x-axis and a linear scale for GPA values on the y-axis, creating a clean, readable layout. Data points are rendered as circles that enlarge or change color to orange on hover, providing interactive feedback to the user. Native SVG `<title>` elements supply basic tooltips showing the exact average GPA for each year when the user hovers over a data point. The chart includes a main title, axis labels, and a legend, making it self-explanatory. This visualization adheres to a minimalist design—there is no chart junk; it focuses on the data. It uses a responsive SVG layout that fills the full viewport. ## Data Details - Dataset: SAT scores from 2000–2010 (only Math GPA used here) - State subset: CA, FL, IL, NY ## References Original example by EricLYao on Observable. Adapted for the D3 Graph Gallery. d3-legend library not loaded due to issue. ## Footnotes Looking at this example, one could consider how this chart could be simplified or improved. For instance, color encoding is declared separately for each state, rather than using a single color scale mapped to state names. What would be the easiest way to refactor this so that the color assignments are data-driven and less repetitive?# A7 Multi-Line Chart D3 ## Overview This interactive multi-line chart visualizes average Mathematics GPA trends across four U.S. states—California, Florida, Illinois, and New York—over multiple years. The chart provides a comparative view of academic performance using distinct colored lines for each state, making it easy to identify trends and differences in math achievement across states over time. ## Key Features The visualization displays four overlaid line charts, one per state, with each state assigned a unique color: steel blue for California, green for Florida, red for Illinois, and purple for New York. Data points are represented as circular markers with hover effects that highlight them in orange, and native SVG tooltips display exact GPA values when hovered. ## Design & Implementation Details **Layout**: The visualization uses a responsive full-window design with a margin convention of 100px on all sides. The chart includes clear axis labels, with "Years" on the x-axis and "Average GPA" on the y-axis. A descriptive title, "Average Math GPA of States over the Years," sits at the top center. **Scales**: A band scale maps the categorical years to the x-axis, while a linear scale with a domain of [2.8, 3.7] maps the average math GPA to the y-axis. **Encoding**: Four states (California, Florida, Illinois, New York) are represented with distinct colors (steelblue, green, red, purple respectively). Points and lines are used to show trends over time, with hovering over points changing their color to orange for emphasis. Native tooltips show exact values. **Interactivity**: The visualization supports hovering over data points, which turns the points orange and shows a tooltip with the exact state, year, and GPA. **Key Features**: - Multi-line chart tracking Math GPA trends for California, Florida, Illinois, and New York - Clear visual separation using distinct colors for each state - Interactive tooltips on data points - Fullscreen responsive layout - SVG-based rendering for crisp display **Design Choices**: The visualization uses a band scale for the x-axis to represent the years and a linear scale for the y-axis with domain [2.8, 3.7] for the average GPA. The color scheme differentiates states: steel blue for California, green for Florida, red for Illinois, and purple for New York. Point markers with hover effects (orange on hover) enhance interactivity. Native title tooltips provide detailed information on hover. The chart includes labeled axes and a title. **Data processing**: The chart reads from a CSV file containing SAT score data by state and year. The code filters this data for California, Florida, Illinois, and New York, extracting each state's Mathematics Average GPA for each year. **Key visual encodings**: - **Mark type**: lines with points (circles) - **Channels**: position on common x-axis for year, y-axis for average mathematics GPA; color distinguishes state - **Legend**: none in SVG; colors are inferred from point/line colors **Visual encodings**: - **X-axis**: Year, using a band scale - **Y-axis**: Average GPA, linear scale from 2.8 to 3.7 - **Line color**: steelblue for California, green for Florida, red for Illinois, purple for New York - **Points**: small circles at each observation; hover turns them orange - **Tooltip**: native <title> showing "Average GPA in [year]: [gpa]" The chart uses an ordinal color scale but never renders a legend, making it hard to identify which line corresponds to which state. Title: A7 Multi-Line Chart D3 Description: This multi-line chart from the D3 graph gallery tracks the average math GPA across four US states (California, Florida, Illinois, and New York) over multiple years. The visualization was built using D3 v7 with an SVG rendering approach. While the code includes distinct colors for each state, the chart lacks a legend to map colors to states. Hovering over a data point displays a tooltip with the exact GPA for that state and year, and points highlight orange on mouseover. The visualization uses a band scale for the x-axis to show years, a linear scale for y-axis GPA values, and dashed line interpolation between points. Data comes from SAT scores across states, with separate lines and points for each state's average mathematics GPA. Need to write the description. What does the chart show? What is the context, what are the variables, any notable design choices? Describe in 3-5 concise paragraphs. Use plain text. Need to include "multi-line chart" in the description. What does the graph do? How does the data get encoded? Use words like "encode" and "choropleth" if relevant, but do not overdo the jargon. Write in complete sentences and paragraphs. Make clear and factual, avoid marketing language and hype. Make sure you do not reference (or do not rely heavily on) external sources. Include all pertinent information so your description can stand alone. Avoid markdown formatting, use plain text. Output only the description.This multi-line chart displays the average mathematics GPA for four U.S. states—California, Florida, Illinois, and New York—over a series of years. The data is sourced from a dataset of SAT scores, and the visualization is built with D3 v7 using an SVG rendering approach. Each state is represented by a distinct colored line and corresponding circular points: steelblue for California, green for Florida, red for Illinois, and purple for New York. The x-axis encodes the year, the y-axis encodes the average mathematics GPA (ranging from 2.8 to 3.7), and a title reads "Average Math GPA of States over the Years." The chart uses a band scale for the x-axis and a linear scale for the y-axis. Points are plotted for each state-year combination, with tooltips (via SVG `<title>`) that display the exact GPA on hover. All four lines are drawn as separate paths, one per state, and each point changes to orange on hover. No legend is present; instead, states are identified by point color. This is a fullscreen, D3 v7 SVG chart.

EEric Yao
74% match