`geom_spoke`: add a parameter that controls the unit for the `radius`

Open
#1,282 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
kotlin, python

Research direction

Start at the geom_spoke entry point and review the two radius-unit behaviors described in this issue, then compare the scaling requirements with issue #1070. Done means a parameter can select axis-bound or independently scaled radius units, while the existing behavior remains available.

Written by the indexing model from the issue text.

Description

The radius of the spokes can be interpreted differently in different plots:

  1. The radius units are bound to the axis units.
    Example:

    wind_data = {
        'x': [0, 0, 0, 1, 1, 1, 2, 2, 2],
        'y': [0, 1, 2, 0, 1, 2, 0, 1, 2],
        'speed': [0.84, 0.89, 0.92, 0.89, 0.94, 0.97, 0.92, 0.97, 0.99],
        'direction': [0.78, 0.72, 0.69, 0.84, 0.78, 0.75, 0.87, 0.81, 0.78],
    }
    
    ggplot(wind_data) + \
        geom_spoke(aes('x', 'y', radius='speed', angle='direction'),
                   arrow=arrow(type='closed', angle=15))
    


    This is exactly how Lets-Plot works now.

  2. The radius has its own units.
    Example:

    volcano_data = {
        'lat': [13.60, 14.88],
        'lon': [41.80, 39.92],
        'eruptions_count': [3, 2],
    }
    
    ggplot(volcano_data, aes('lon', 'lat')) + \
        geom_livemap(zoom=8, location=[40.86, 14.24]) + \
        geom_point(size=5, color='red') + \
        geom_spoke(aes(radius='eruptions_count'), angle=0.79, color='red')
    


    Here we want to be able to change the length of the spokes arbitrarily using a scale (see also issue #1070).
    To do this, we need to be able to change the units of the radius.

Dominant language
Kotlin
Stars
1.8k
Forks
63
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from JetBrains/lets-plot

All issues in JetBrains/lets-plot

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.