Skip to content

LinearTicks seems to alter the formatting for timeseries data #232

@icweaver

Description

@icweaver

Hi, thanks for such a cool package! I am copying this discussion from the slack here regarding formatting ticklabels from timeseries data:


@icweaver said: I have some timeseries data that I was hoping to plot with AoG. The problem I am having is with the label formatting for something like this:

using AlgebraOfGraphics, CairoMakie, Dates, DataFrames
df = DataFrame(
	:t => DateTime("2021-01-01T00:00:00"):Hour(1):DateTime("2021-01-02T00:00:00"),
	:f => sort(rand(25))
)
plt = data(df) * mapping(:t=>"time", :f=>"flux")
draw(plt)

which seems to crowd the tick labels
8f5ec461-c353-490f-a069-7021a043b7a6

I see that I can rotate things by passing draw(plt, axis=(xticklabelrotation=π/8,)) so I was wondering if there was also a similar way to modify the date formatting with some combination of xticks and xtickformat with Dates.format?


@ericphanson mentioned that it might have been possible to reduce the number of tickmarks in the past with xticks=LinearTicks(N), but that seems to also alter the original formatting of the ticklabels:
132e9b85-6145-4bec-bcdb-66b7c11de533

Is there another approach that we should be following to apply the desired formatting?

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