-
Notifications
You must be signed in to change notification settings - Fork 40
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
Separate out the data from the table, allow inline tables and row seps. #72
Conversation
Now TableData can be used as just the tabular data without options etc, allowing inline tables in `[]` options. Using `\\` for row separators is possible. This also makes the code cleaner, as `TableData` takes the place of `table_fields`; `TableFile` is also removed as now `Table` can contain a `TableData` or a string (filename). Closes #65, added example for patch plots. Printing inline tables in options required some printing code changes, which resulted in some incidental changes: - Printing `0:1` as "0:1" was a fluke (cf `1.2:3.5`). Fixed this in the examples. - Added space before `[]` (options), this is the dominant usage in the manual. Misc other whitespace changes. - Removed indentation from some `print_tex` methods, as it was unnecessary (but innocuous). - `print_tex` vectors as `{ ... }` lists (was not used for anything anyway). - `print_indent` was adding an extra newline at the end, fixed.
Note that doctests are broken (again), but this does not break tests. I plan to handle them in #73. |
Codecov Report
@@ Coverage Diff @@
## master #72 +/- ##
==========================================
+ Coverage 81.49% 81.87% +0.37%
==========================================
Files 9 9
Lines 481 480 -1
==========================================
+ Hits 392 393 +1
+ Misses 89 87 -2
Continue to review full report at Codecov.
|
@KristofferC : friendly ping. I realize you may be busy on other fronts and not have time for a review, should I wait or OK if I merge? I would get started on #73 and #59. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for slow review, some comments.
docs/src/man/structs.md
Outdated
@@ -138,7 +138,7 @@ Example: | |||
julia> p = @pgf Plot(Table("plotdata/invcum.dat"), { blue }; incremental = false); | |||
|
|||
julia> print_tex(p) | |||
\addplot[blue] | |||
\addplot [blue] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why add this space? That doesn't seem like the convention used in e.g. http://pgfplots.sourceforge.net/gallery.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, will remove.
src/PGFPlotsX.jl
Outdated
print(io, str) | ||
end | ||
end | ||
print_tex(io::IO, str::AbstractString) = print(io, str) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These will now not respect the indentation at all e.g printed completely to left aligned? What's the gain of changing this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this used anywhere? It is my impression that it was used to print "inline" representations, not preceded by newlines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would assume that this is used when there is a string
in an Axis
for example. And then that string would have the correct indentation.
src/PGFPlotsX.jl
Outdated
$SIGNATURES | ||
|
||
Print vectors as comma-delimited lists between `{}`s. Useful for eg | ||
`/pgfplots/xtick`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to use this in the options you should overload print_opt
? And for vector it is defined to pint a comma-delimited list:
Line 114 in c4c7145
print_opt(io::IO, v::Vector) = print(io, join(v, ",")) |
@@ -296,7 +296,7 @@ savefigs("spline-quadratic", ans) # hide | |||
mesh, | |||
scatter, | |||
samples = 10, | |||
domain = 0:1 | |||
domain = "0:1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wish we could fix this to work in general, could be done later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made a reminder in #74.
It is not used outside options. Fix examples which call `Axis` with vectors. Document `print_options`. Add tests for AbstractVector in options.
Working on fixing printing, let's not merge yet (even if tests pass). |
Partial fix for #73. Make containers indent their contents, all print as if at top level. This simplifies `print_tex` methods considerably, and leads to nicer output. Factor out `add_indent`, making it testable. Coordinates and table lines are indented. Allow space instead of newlines for options, use this for single-line expressions (Legend, Graphics, etc). Minor fix: order of arguments of `Graphics` was inconsistent with other `OptionType`s. Unit test a bare minimum of emitted strings; this verges on overtesting but is much nicer to debug than failures in doctests.
Sorry for the mess, with f3f32f5 this is now a very large PR which should have been 2-3 PRs, but was easier to go forward than backward. Now everything (incl printing) is fixed and doctests run without any problems. |
Looks good, nice job :) |
Now TableData can be used as just the tabular data without options etc, allowing inline tables in
[]
options. Using\\
for row separators is possible.This also makes the code cleaner, as
TableData
takes the place oftable_fields
;TableFile
is also removed as nowTable
can contain aTableData
or a string (filename).Closes #65, added example for patch plots.
Printing inline tables in options required some printing code changes, which resulted in some incidental changes:
Printing
0:1
as "0:1" was a fluke (cf1.2:3.5
). Fixed this in the examples.Added space before
[]
(options), this is the dominant usage in the manual. Misc other whitespace changes.Removed indentation from some
print_tex
methods, as it was unnecessary (but innocuous).print_tex
vectors as{ ... }
lists (was not used for anything anyway).print_indent
was adding an extra newline at the end, fixed.