Tell us what works and what could be better. We read every submission.
@adelaide01·4 public vizzes
A small SVG canvas displays three abstract shapes: a darkblue circle, an orange square, and a crimson star, each positioned at different vertical offsets. The code defines a custom `shapemaker` function that appends the appropriate SVG element based on a `shape` property from a data array. It uses d3.v5’s selection and data binding, with `d3.symbol` and `d3.symbolStar` for the star path, and hardcoded fallback attributes for position and size when data values are missing.
This example demonstrates how to create and place basic geometric shapes—a circle, a square, and a star—on an SVG canvas using D3 v5’s data-join and custom append function. The code defines an array of shape objects, binds it with `svg.selectAll().data().enter()`, and then appends each element via a `shapemaker` function that returns the appropriate SVG node. The function uses D3 selections and the `d3.symbol` API with `d3.symbolStar` to generate the star’s path, while styling defaults like `steelblue`, `orange`, and `crimson` are applied conditionally. Rendering is static SVG, with no interaction or transitions.
This example visualizes a Python/Django script’s console output when scraping election data from the Seminole Supervisor of Elections fails. It shows a chain of cascading exception tracebacks, beginning with a `Race.DoesNotExist` error, followed by `Election.DoesNotExist` and `Candidate.DoesNotExist`, culminating in an `UnboundLocalError` for `race_obj`. The output includes log messages like `:red_siren: Error scraping` and timestamps. The code relies on Django’s ORM manager methods (`objects.get`), the `requests`-based scraping process, and JSON file writing, but does not employ any visualization libraries.
This example demonstrates a Python batch-processing script for the Abbyy FineReader OCR cloud service, enabling automated document recognition across entire folders. The code defines an `AbbyyOnlineSdk` class that handles image uploads via HTTP POST requests, polls task status until completion, and downloads recognized text results. Two scripts are included: `SimpleFolderProcess.py` processes all files in an input folder and saves `.txt` results to an output folder, while `process-for-folders.py` extends this with command-line arguments for specifying source/target files, language, and output format (txt, pdf, rtf, docx, or xml), along with environment-variable support for credentials and proxy settings. The visualization of interest is the batch workflow: a loop iterates over source files, submits each for OCR, polls the cloud service at intervals, and writes the recognized text to corresponding output files, demonstrating asynchronous cloud-based processing with status tracking and result downloading.