-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite Plot and axis-like types. (#67)
* Rewrite Plot and axis-like types. This is a step towards fixing #44 (almost there!). 1. New user-facing plot/plot3 constructor is ```julia Plot([incrementa], [options], data, trailing...) ``` and similarly for `Plot3`. `incremental` defaults to `false`, as this seems to be the most common use case. Some validation is done on `data` (checking for type). This removes the `label` kwarg, and allows us to close #16. Examples now recommend an explicit `\addlegendentry`. Docstrings are added for everything, and examples are rewritten accordingly. 2. Axis-like code cleaned up a bit with macros. Variations on log axes added. Explicitly document that strings are emitted as is. 3. GroupPlot rewritten, allow multiple plots and empty \nextgroupplot, two examples added, one from the manual and one for multiple plots. 4. Replaced random examples with deterministic ones, perhaps stick to this and close #63? Minor indentation issues fixed. 5. Minor fixes for testing framework. * Separate incremental plot constructors, add LegendEntry. The `incremental` flag was removed from `Plot*` constructors in the API, replaced by `PlotInc` and `Plot3Inc`. A LegendEntry type was added. Minor fixes: - remove the INCREMENTAL constant, as it is now unnecessary - clarify docstrings - disabled docstring checks, as they lead to infinite loops for some reason * Trivial docstring fix.
- Loading branch information
1 parent
f0589a7
commit 362f58d
Showing
11 changed files
with
380 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Axis-like objects | ||
|
||
```@setup pgf | ||
using PGFPlotsX | ||
savefigs = (figname, obj) -> begin | ||
PGFPlotsX.save(figname * ".pdf", obj) | ||
run(`pdf2svg $(figname * ".pdf") $(figname * ".svg")`) | ||
PGFPlotsX.save(figname * ".tex", obj); | ||
return nothing | ||
end | ||
``` | ||
------------------------ | ||
|
||
```@example pgf | ||
x = linspace(0, 2*pi, 100) | ||
@pgf GroupPlot( | ||
{ | ||
group_style = | ||
{ | ||
group_size="2 by 1", | ||
xticklabels_at="edge bottom", | ||
yticklabels_at="edge left" | ||
}, | ||
no_markers | ||
}, | ||
{}, | ||
PlotInc(Table(x, sin.(x))), | ||
PlotInc(Table(x, sin.(x .+ 0.5))), | ||
{}, | ||
PlotInc(Table(x, cos.(x))), | ||
PlotInc(Table(x, cos.(x .+ 0.5)))) | ||
savefigs("groupplot-multiple", ans) # hide | ||
``` | ||
|
||
[\[.pdf\]](groupplot-multiple.pdf), [\[generated .tex\]](groupplot-multiple.tex) | ||
|
||
![](groupplot-multiple.svg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.