Examples

Examples

In the following, it is presented how the following matrix can be printed using this package:

julia> data = Any[ 1    false      1.0     0x01 ;
                   2     true      2.0     0x02 ;
                   3    false      3.0     0x03 ;
                   4     true      4.0     0x04 ;
                   5    false      5.0     0x05 ;
                   6     true      6.0     0x06 ;]

The following example indicates how highlighters can be used to highlight the lowest and highest element in the data considering the columns 1, 3, and 5:

Since this package has support to the API defined by Tables.jl, then many formats, e.g DataFrames.jl, can be pretty printed:

You can use hlines keyword to divide the table into interesting parts:

If you want to break lines inside the cells, then you can set the keyword linebreaks to true. Hence, the characters \n will cause a line break inside the cell.

The keyword noheader can be used to suppres the header, which leads to a very simplistic, compact format.

In the following, it is shown how the filters can be used to print only the even rows and columns:

By default, if the data is larger than the screen, then it will be cropped to fit it. This can be changed by using the keywords crop and screen_size.

If you want to save the printed table to a file, you can do:

julia> open("output.txt", "w") do f
            pretty_table(f,data)
       end