Pie chart: Poetic meters


Rig Veda is poetry. Its verses have a certain lilt, beat, rhythm ( meter ) that turn the words into charming lyrical music when recited aloud. This chart of the vedic meters is generated from the data returned by the /rv/v3/meters endpoint.

To see a larger image, click the image.

pie chart of meters in rig veda


On this page


What this chart shows

At first glance, the following things stand out immediately:

From this distribution, one might be inclined to think that Rigvedic poetry relied on a few highly stable rhythmic templates that were used more for structure than for ornamentation or experimentation.

What to explore next

Endpoint to use for this pie chart

/meters returns the following response:

{
  "meters": {
    "Abhisarini": 2,
    "Anushtup": 281,
    "Ashti": 6,
    "Atidhriti": 1,
    "Atyashti": 28,
    "Brihati": 91,
    "Dhriti": 4,
    "Gayatri": 469,
    "Jagati": 540,
    "Kakumanyamkushira": 1,
    "Kakup": 9,
    "Kriti": 1,
    "Nyangkusarini": 2,
    "Pankti": 108,
    "Pipilika Madhya": 1,
    "Pragath": 81,
    "Pratishtha": 1,
    "Purastajjyoti": 1,
    "Shakchari": 16,
    "Trishtup": 1230,
    "Uparishtajjyoti": 2,
    "Ushnik": 76,
    "Vardhamana": 2,
    "Virangarupa": 8,
    "Virat": 64
  }
}

Algorithm

Prerequisites

Steps

  1. Extract categories and values.
    1. Read the input dataset.
    2. Separate it into:
      • labels = list of category names.
      • values = list of corresponding counts.
  2. Group low-frequency categories so that the chart is not cluttered by numerous tiny slices.
    1. Initialise:
      • filtered_labels as empty.
      • filtered_values as empty.
      • other_total = 0.
    2. For each (label, value) pair:
      • If value < threshold, add value to other_total.
      • Else:
        • Append label to filtered_labels.
        • Append value to filtered_values.
    3. After processing all items:
      • If other_total > 0:
        • Append "Others" to filtered_labels.
        • Append other_total to filtered_values.
  3. Assign colours.
    1. Generate one colour for each resulting category.
    2. If the number of categories exceeds the palette size, reuse colours cyclically.
    3. If an "Others" category exists, override its colour with a neutral colour like grey.
  4. Create the chart canvas.
    1. Initialise a drawing surface with fixed dimensions and background colour.
    2. Reserve space for header, main chart area, and footer.
  5. Add the metadata. Place the header at the top and the footer at the bottom.
  6. Render the pie chart.
    1. Draw a pie chart where each slice corresponds to a category and the slice size is proportional to the category count.
    2. Display the category labels outside or near the slices, and the percentage labels inside the slices.
    3. Apply visual styling for start rotation angle, slice borders, label distances, and percentage text distances.
    4. Ensure that the chart uses an equal aspect ratio so that the pie remains circular.
    5. Draw a border frame around the full visualisation area, flush to the edges.
  7. Export the output. Save the rendered chart as an image file with high resolution and a tight bounding box.

Pseudocode

function generatePieChart(data, threshold):

    filtered = []
    other_total = 0

    for each (category, count) in data:
        if count < threshold:
            other_total += count
        else:
            filtered.append(category, count)

    if other_total > 0:
        filtered.append("Others", other_total)

    assign colors to filtered categories
    if "Others" exists:
        set its color to neutral

    create canvas
    add title
    add footer

    draw pie chart using filtered counts
    display labels
    display percentages

    enforce circular aspect ratio
    draw outer frame

    save image

Related