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

prettify printing options #225

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

BeastyBlacksmith
Copy link
Contributor

Before:

julia> p = @pgf Axis(
           {
               view = (0, 90),
               colorbar,
               "colormap/jet", shader = "flat",
           },
           Plot3(
               {
                   surf,
                   "mesh/cols" = 2,
                   point_meta = "explicit",
               },
               Table({x_index = 0, y_index = 1, meta_index = 2}, [1, 2, 3, 4], [1, 2, 3, 4], [1, 3, 2, 3])
           )
       );

julia> print_tex(p)
\begin{axis}[view={0}{90}, colorbar, colormap/jet, shader={flat}]
    \addplot3[surf, mesh/cols={2}, point meta={explicit}]
        table[row sep={\\}, x index={0}, y index={1}, meta index={2}]
        {
            \\
            1  1  1  \\
            2  2  3  \\
            3  3  2  \\
            4  4  3  \\
        }
        ;
\end{axis}

After:

julia> print_tex(p)
\begin{axis}[
    view={0}{90},
    colorbar,
    colormap/jet,
    shader={flat}
    ]
    \addplot3[
        surf,
        mesh/cols={2},
        point meta={explicit}
        ]
        table[
            row sep={\\},
            x index={0},
            y index={1},
            meta index={2}
            ]
        {
            \\
            1  1  1  \\
            2  2  3  \\
            3  3  2  \\
            4  4  3  \\
        }
        ;
\end{axis}

@KristofferC
Copy link
Owner

Nice, I thought about this very thing a few days ago after making some hand adjustments to a tex file produced by PGFPlotsX

@BeastyBlacksmith
Copy link
Contributor Author

Yeah, the output of Plots plots is also hard to read otherwise.
How can I run the doctests locally?

@tpapp
Copy link
Collaborator

tpapp commented May 17, 2020

I think that building the docs locally should do it.

@BeastyBlacksmith
Copy link
Contributor Author

All lights green

@tpapp
Copy link
Collaborator

tpapp commented May 17, 2020

I am possibly an outlier here, but in most cases I prefer the compact output. I am fine with the pretty form being the default, but I am wondering if the old one could be preserved, eg via compact in IOContext.

Technically this would only require a branch in the code that was just changed, and preserving the old tests too in tests/, for the relevant input. (Again, I am fine with doctests etc including verbose output, and it being the default).

@fredrikekre
Copy link
Collaborator

Maybe just add some maximum column width instead of putting each option on its own line?

@BeastyBlacksmith
Copy link
Contributor Author

I am not going to change anything in the near future, but feel free to change or add anything as you see fit.

@BeastyBlacksmith
Copy link
Contributor Author

I added the option to get the compact output via IOContext. I can't see, why the docs fail to build though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants