-
Notifications
You must be signed in to change notification settings - Fork 1
Fix broken coordinate/mark examples, dark themes, add missing marks, add padding_of() #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
ca8dc61
5bb5c03
e6e8286
c46688f
8ffb4db
869a92d
bffd9f1
da9b6f4
7f0c72a
4587114
9bbf6c1
ca0f631
2e90ee3
d1ba36c
069a0b6
0bd2a54
1259189
fd78572
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -86,6 +86,45 @@ g2(df, x = 'x', y = 'y', color = 'x') |> | |
| coordinate('radial', innerRadius = 0.3) | ||
| ``` | ||
|
|
||
| ## Parallel | ||
|
|
||
| Maps multiple numeric variables to parallel axes. Use a `position` | ||
| encoding (a character vector of column names) instead of `x`/`y`. | ||
|
|
||
| ```{r} | ||
| g2(iris, position = c('Sepal.Length', 'Sepal.Width', | ||
| 'Petal.Length', 'Petal.Width'), color = 'Species') |> | ||
| mark_line() |> | ||
| coordinate('parallel') | ||
| ``` | ||
|
|
||
| ## Radar | ||
|
|
||
| Displays data on radial axes emanating from a center point. Like | ||
| parallel coordinates, radar charts require a `position` encoding. | ||
|
|
||
| ```{r} | ||
| df_radar = data.frame( | ||
| item = c('A', 'B', 'C', 'D', 'E'), | ||
| score = c(3, 7, 2, 5, 4) | ||
| ) | ||
| g2(df_radar, position = c('item', 'score')) |> | ||
| mark_line(style = list(closed = TRUE)) |> | ||
| mark_point() |> | ||
| coordinate('radar') | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i only see a vertical axis line in the plot, and the plot is basically blank on the left and right
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in bffd9f1 — the single-series radar with 5 generic points was too sparse. Changed to multi-series data (2 teams × 5 descriptive items like 'Design', 'Dev', etc.) which produces a visible radar chart with two overlapping polygons.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there is still only a vertical axis in the plot; it's because you only have two elements for please learn the G2's official example: https://g2.antv.antgroup.com/manual/core/coordinate/overview#radar then come up with with a better example here
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in 7f0c72a — switched to wide-format data with multiple numeric position columns (Design, Dev, Marketing, Sales, Support) per the G2 official radar example. Each column becomes a radar axis, and the two teams form distinct closed polygons.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in 7f0c72a — switched to wide-format data with multiple numeric position columns (Design, Dev, Marketing, Sales, Support) per the G2 official radar example. Each column becomes a radar axis. |
||
| ``` | ||
|
|
||
| ## Helix | ||
|
|
||
| Arranges data along a helix spiral. | ||
|
|
||
| ```{r} | ||
| df_helix = data.frame(x = 1:50, y = sin(1:50 / 5)) | ||
| g2(df_helix, x = 'x', y = 'y') |> | ||
| mark_line() |> | ||
| coordinate('helix') | ||
| ``` | ||
|
|
||
| ## Transpose (coord_flip) | ||
|
|
||
| Swap x and y axes, equivalent to ggplot2's `coord_flip()`. This is a | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the legend at top left clashes with the main plot area; why is that? how can we leave more space between the legend and main plot?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in bffd9f1 — added
legend_of('color', position = 'bottom')to move the legend below the chart, avoiding overlap with the plot area.