Skip to content

Wrong x-axis labels and ticks with type="numeric" #48

@bklingen

Description

@bklingen

The placement (and/or labels) of the x-axis ticks are somewhat off in this plot of a normal distribution with mean 0 and standard deviation 0.1:

x <- seq(-0.3, 0.3, 0.01)
df <- data.frame(x=x, y=dnorm(x, mean=0, sd=0.1))
apex(data=df, aes(x,y), type='spline') %>% 
  ax_xaxis(type='numeric', 
           max=0.3,
           range=0.6, 
           tickAmount=6, 
           labels=list(formatter=format_num(".2f"))
  )

image

I can't quite figure out what's wrong in the code. I expect the upper bound to be 0.3, and ticks at (-0.3, -0.2, -0.1, 0.0, 0.1, 0.2, 0.3), with the plot centered over 0.0. The funny thing is that the x-value in the hover information is correct.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions