Stream: helpdesk (published)

Topic: ✔ Makie.jl axis ticks scientific notation


view this post on Zulip Adam non-jedi Beckmeyer (Nov 17 2021 at 15:29):

How do I adjust a plot so that axis tick labels are e.g. 10,000 instead of 1.0x10^4? My best guess is the ytickformat property of Axis, but the values you can set that paremeter to aren't documented afaict.

view this post on Zulip Adam non-jedi Beckmeyer (Nov 17 2021 at 15:32):

Of course, I can't actually tell for sure that there's not an example using it since the Franklin.jl search function is awful and turns up 0 results in a search for "tickformat" despite it clearly being listed as an attribute of Axis...

view this post on Zulip Michael Hatherly (Nov 17 2021 at 15:38):

ytickformat can be a function, which takes a single argument containing a vector of unformatted ticks, something like ytickformat = xs -> string.(xs) might enough for what you want

view this post on Zulip Felix Cremer (Nov 17 2021 at 15:38):

This is documented here: https://makie.juliaplots.org/v0.15.1/examples/layoutables/axis/index.html#modifying_ticks

view this post on Zulip Adam non-jedi Beckmeyer (Nov 17 2021 at 15:39):

Thanks! Actually had just figured this out by reading the source code in lineaxis.jl.

view this post on Zulip Adam non-jedi Beckmeyer (Nov 17 2021 at 15:40):

The lack of usable search in the Makie.jl docs is super aggravating.

view this post on Zulip Michael Hatherly (Nov 17 2021 at 15:41):

yeah, you'd think ytickformat as a search term would return some, doesn't seem to return anything

view this post on Zulip Adam non-jedi Beckmeyer (Nov 17 2021 at 15:46):

Michael Hatherly said:

ytickformat can be a function, which takes a single argument containing a vector of unformatted ticks, something like ytickformat = xs -> string.(xs) might enough for what you want

In my case, ytickformat = xs -> string.(round.(Int, xs)) was what I wanted.

I feel like there should be a single-argument currying form of map or broadcast to make this kind of thing neater...

view this post on Zulip Notification Bot (Nov 17 2021 at 15:47):

Adam non-jedi Beckmeyer has marked this topic as resolved.


Last updated: Oct 02 2023 at 04:34 UTC