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

ggline with numeric x-axis #35

Closed
mdphan opened this issue Sep 20, 2017 · 2 comments
Closed

ggline with numeric x-axis #35

mdphan opened this issue Sep 20, 2017 · 2 comments

Comments

@mdphan
Copy link

mdphan commented Sep 20, 2017

Hi,

Thanks for this great package. I am trying to use ggline where x-axis is time (time <- c(0,1,3,6,24)) so I need the x-axis values to be treated as numeric, not categorical. However, ggline seems to by default convert x-axis to categorical values. Is there a way to stop it from converting numeric x-axis values to categorical?

Thanks.

@kassambara
Copy link
Owner

kassambara commented Sep 21, 2017

New argument numeric.x.axis added in ggline(). logical. If TRUE, x axis will be treated as numeric. Default is FALSE.

library(ggpubr)
df2 <- data.frame(supp=rep(c("VC", "OJ"), each=3),
                  dose=rep(c(0.5, 1, 2),2),
                  len=c(6.8, 15, 33, 4.2, 10, 29.5))

ggline(df2, x = "dose", y = "len",
       color = "supp", numeric.x.axis = TRUE)

rplot

@SchollJ
Copy link

SchollJ commented Jan 31, 2020

I'm trying to do something similar: I've got data of say 10 subjects and 5 average measurements of each person, arranged in long format (so columns are ID, measurement bin, measurement value in that bin). I want to plot the data from all subjects together, as well as the average.

I've tried to plot it with ggerrorplot like this:
ggerrorplot(data, x='measurement_bin', y='measurement_value',add='jitter')
And this works well, the only problem now is that the measurement bins are c(1,2,3,4,10) and they are plotted equally spaced on the x-axis, is there a way to plot them spaced according to their value?

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

3 participants