lets-plot
lets-plot copied to clipboard
`geom_spoke`: add a parameter that controls the unit for the `radius`
The radius of the spokes can be interpreted differently in different plots:
-
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.
-
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.