Skip to content

type_errorbar does not respect order of x-axis labels but type_points does. #702

Description

@NeuKon

EDIT: After lots wondering and head-scratchin, I found the solution after all. I used the argument "xlevels" to specify them specifically. I am not sure why I did not see this before. Sorry for posting this (non) issue. This can be closed now.

Hi, and thank you for this amazing package. I started using tinyplot more frequently recently and came across an unexpected issue (stable CRAN version as well as development version).

I can change the order of axis-labels, or breakpoints in a factor by specifying the order. This works well with plots of type "p" but surprisingly not with with type "errorbar". A reproducible example is below. Is this intended behaviour, and if so - is there a way to specify the order of breaks on the x-axis for errorbar plots?

library(tinyplot)
df <- data.frame(x = c("a", "b", "c"), y = 1:3)

# default order as expected for points and errobar plots
plt(y ~ x, data = df, type = "p")

plt(y ~ x, data = df, type = "errorbar", ymin = y - .2, ymax = y + .2
)


# points plot respects custom order, errobar plot does not
df$x2 <- factor(df$x, levels = c("c", "a", "b"))
plt(y ~ x2, data = df, type = "p")
plt(y ~ x2, data = df, type = "errorbar",  ymin = y - .2, ymax = y + .2)

Thank you very much in advance.

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