Skip to content
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

Order Plot Axis by Factor? #133

Open
neellab-umd opened this issue Jul 26, 2024 · 0 comments
Open

Order Plot Axis by Factor? #133

neellab-umd opened this issue Jul 26, 2024 · 0 comments

Comments

@neellab-umd
Copy link

Hi There -

I am plotting my response variables by categorical treatments that are ordered low to high. When I plot in Flexplot, the axis is ordered from high values to low values of the response variable rather than by the factor levels as in this example with the iris data

library(forcats)
library(dplyr)
library(magrittr)
library(flexplot)

data(iris)

iris<-iris %>%
mutate(Species = forcats::fct_relevel(Species, c("versicolor", "setosa", "virginica")))

test = flexplot(Sepal.Length~Species, data = iris, method = "gamma", se = F, jitter = c(0.2,0))
test

I assume this is an intentional feature but it would help my brain process the patterns if the the treatment groups were in the order I specify in the factor levels. I tried to output the ggplot code with plot.string but was not successful at getting that code to work.

Is there a way to force flexplot() to use factor levels? I don't see it in the options for the function.

Thanks so much.

Maile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant