You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, I am only able to pick a shape in add_data_points(), however, it is sometimes useful to vary the point shapes by a variable. I tried passing in the shape argument in tidyplot assuming it would pass on to ggplot2::aes() (as I inferred from the function description).
Reprex
Provide the data and code to reproduce the bug. (I am sorry, reprex is having issues uploading images to imgur for some reason)
# install.packages("ggplot2")
# install.packages("tidyplots")
# install.packages("palmerpenguins")
library(ggplot2)
library(tidyplots)
library(palmerpenguins)
# Reference Plot in ggplot2 ----
ggplot2::ggplot(
data = palmerpenguins::penguins,
mapping = aes(
x = bill_depth_mm,
y = bill_length_mm
)
) +
geom_point(
aes(
color = species,
shape = species
),
size = 3,
alpha = 0.8
) +
geom_smooth(method = lm, se = FALSE, aes(color = species))
# Closest I could get using tidyplots ----
palmerpenguins::penguins |>
tidyplot(
x = bill_depth_mm,
y = bill_length_mm,
color = species,
# shape = species, # shape argument could go here or within the add_data_points() function
width = 133,
height = 100
) |>
add_data_points(size = 3, alpha = 0.8) |>
add_curve_fit(linewidth = 0.75, method = "lm", alpha = 0)
Versions
Share your versions of tidyplots and ggplot2.
To check your versions, run sessionInfo() in the R console.
other attached packages:
[1] shiny_1.10.0 palmerpenguins_0.1.1 tidyplots_0.2.0 ggplot2_3.5.1
The text was updated successfully, but these errors were encountered:
you are right! Currently, tidyplots only supports x, y, and color as the three main aesthetics. By the way, in tidyplots there is only one aesthetic for color that is propagated to both color and fill.
This was an active decision to take out complexity. However, I understand that ggplot2 users might feel constrained or limited. I will for sure not implement all ggplot2 aesthetics. But I see the value especially in shape, size.
I have to think this through a little bit more, but an idea would be to implement this a a new add_data_shapes(), while leaving add_data_points() untouched.
I agree. shape and size are the aesthetics I frequently use with geom_point(). It would also be cool to implement linewidth and linetype for geom_lines() or other line geometries. However, there is a chance I might be becoming greedy here since at this point maybe just using add(ggplot2::geom_point(aes(shape = x))) would be easier.
Description
Currently, I am only able to pick a shape in add_data_points(), however, it is sometimes useful to vary the point shapes by a variable. I tried passing in the shape argument in
tidyplot
assuming it would pass on to ggplot2::aes() (as I inferred from the function description).Reprex
Provide the data and code to reproduce the bug. (I am sorry,
reprex
is having issues uploading images to imgur for some reason)Versions
Share your versions of
tidyplots
andggplot2
.To check your versions, run
sessionInfo()
in the R console.The text was updated successfully, but these errors were encountered: