Skip to content

Order Plot Axis by Factor? #133

Description

@neellab-umd

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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