Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document :latex functionality for axis attribute formatter #344

Open
ykh-1992 opened this issue Jun 24, 2023 · 1 comment
Open

Document :latex functionality for axis attribute formatter #344

ykh-1992 opened this issue Jun 24, 2023 · 1 comment
Labels
enhancement good_first_issue Good issue for new contributors

Comments

@ykh-1992
Copy link

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.

@BeastyBlacksmith BeastyBlacksmith added enhancement good_first_issue Good issue for new contributors labels Jun 24, 2023
@ykh-1992
Copy link
Author

I would like to add to this issue as it may help other who might come across it. I've discovered that I was approaching this incorrectly. As it turns out, Plots.jl supports the default LaTeX font by setting the following attribute,

fontfamily="Computer Modern"

In this manner, the font for the entire plotted is rendered in the default LaTeX font. Still, I think the documentation should mention the missing axis attributes for formatter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement good_first_issue Good issue for new contributors
Projects
None yet
Development

No branches or pull requests

2 participants