Skip to content

Stacked axes #5473

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

Merged
merged 18 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
resolve merge conflict
Merge branch 'main' into stacked_axis

# Conflicts:
#	DESCRIPTION
#	NAMESPACE
#	_pkgdown.yml
#	man/ggplot2-ggproto.Rd
#	tests/testthat/test-guides.R
  • Loading branch information
teunbrand committed Nov 24, 2023
commit 7906dfdb65f13fade09cc3f6f8ccbc19f1c595c1
2 changes: 2 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ Collate:
'grouping.R'
'guide-.R'
'guide-axis.R'
'guide-axis-logticks.R'
'guide-axis-stack.R'
'guide-axis-theta.R'
'guide-legend.R'
'guide-bins.R'
'guide-colorbar.R'
Expand Down
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ export(GeomViolin)
export(GeomVline)
export(Guide)
export(GuideAxis)
export(GuideAxisLogticks)
export(GuideAxisStack)
export(GuideBins)
export(GuideColourbar)
Expand Down Expand Up @@ -421,7 +422,9 @@ export(ggproto_parent)
export(ggsave)
export(ggtitle)
export(guide_axis)
export(guide_axis_logticks)
export(guide_axis_stack)
export(guide_axis_theta)
export(guide_bins)
export(guide_colorbar)
export(guide_colorsteps)
Expand Down
2 changes: 2 additions & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ reference:
- guide_colourbar
- guide_legend
- guide_axis
- guide_axis_logticks
- guide_axis_stack
- guide_axis_theta
- guide_bins
- guide_coloursteps
- guide_none
Expand Down
33 changes: 17 additions & 16 deletions man/ggplot2-ggproto.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions tests/testthat/test-guides.R
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,41 @@ test_that("guide_axis_stack stacks axes", {
expect_doppelganger("stacked axes", p)
})

test_that("logticks look as they should", {

p <- ggplot(data.frame(x = c(-100, 100), y = c(10, 1000)), aes(x, y)) +
geom_point() +
scale_y_continuous(trans = compose_trans(log10_trans(), reverse_trans()),
expand = expansion(add = 0.5)) +
scale_x_continuous(
breaks = c(-100, -10, -1, 0, 1, 10, 100)
) +
coord_trans(x = pseudo_log_trans()) +
theme_test() +
theme(axis.line = element_line(colour = "black"),
panel.border = element_blank(),
axis.ticks.length.x.top = unit(-2.75, "pt")) +
guides(
x = guide_axis_logticks(
title = "Pseudo-logticks with 1 as smallest tick",
negative_small = 1
),
y = guide_axis_logticks(
title = "Inverted logticks with swapped tick lengths",
long = 0.75, short = 2.25
),
x.sec = guide_axis_logticks(
negative_small = 0.1,
title = "Negative length pseudo-logticks with 0.1 as smallest tick"
),
y.sec = guide_axis_logticks(
expanded = FALSE, cap = "both",
title = "Capped and not-expanded inverted logticks"
)
)
expect_doppelganger("logtick axes with customisation", p)
})

test_that("guides are positioned correctly", {
df <- data_frame(x = 1, y = 1, z = factor("a"))

Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.