Skip to content

Document :latex functionality for axis attribute formatter #344

@ykh-1992

Description

@ykh-1992

I'm working on a LaTeX document for my thesis, and I'm generating my plots using Julia's Plots.jl package.
As such, I'm using the LaTeXStrings.jl package to have the font consistent with my thesis.

Now, I've been changing the formatter attribute of the axes to follow the LaTeX font as follows,

formatter=x->@sprintf("\$0.0f\$", x)

To generate axes as such,

1

However, when it came to the scientific notation, as shown in the y-axis, I had a hard time. I tried to do it manually as with the x-axis, but couldn't. I dug through the source code for Plot.jl to see what I was doing wrong, and I was pleasantly surprised to find that it already has that functionality built-in, see line 194 of axes.jl in Plots.jl.

Using this as,

formatter=:latex

Now, I get the plot in the manner I need,

2

Unfortunately, this is not documented under the axis attributes of the docs. Furthermore, there are also the options for choosing :engineering and :none as well. The docs only show three options for the axis attribute formatter as :plain, :scientific, and :auto. It is missing the additional options for :latex, :engineering, and :none.

Can we document this for other users? This can save some headaches for future users.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions