Skip to content

Could a top legend and top colourbar align better? #411

Open
@davidhodge931

Description

@davidhodge931

Hi, awesome package! I was wondering if a top legend and top colourbar could align a bit better?

library(tidyverse)
library(palmerpenguins)
library(patchwork)
#> Warning: package 'patchwork' was built under R version 4.4.1
  
p1 <- penguins |> 
  ggplot() +
  geom_histogram(aes(x = flipper_length_mm, 
                     fill = species)) +
  theme(legend.position = "top") +
  theme(legend.title.position = "top")


p2 <- penguins |> 
  ggplot() +
  geom_point(aes(x = flipper_length_mm, 
                 y = body_mass_g,
                 colour = bill_length_mm)) +
  theme(legend.position = "top") +
  theme(legend.title.position = "top")

p1 + p2
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
#> Warning: Removed 2 rows containing non-finite outside the scale range
#> (`stat_bin()`).
#> Warning: Removed 2 rows containing missing values or values outside the scale range
#> (`geom_point()`).

Created on 2024-11-20 with reprex v2.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions