-
-
Notifications
You must be signed in to change notification settings - Fork 76
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
Add PGplot, a method for generating graphs. #966
base: develop
Are you sure you want to change the base?
Conversation
Well looks like my method of splittings up in the |
6df78c9
to
f6081b1
Compare
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.
Here are some initial thoughts on this.
The PGplotmacros.pl
needs to be renamed to something that does not contain the word "macros".
I removed the I'm also noticing a difference in perltidy here and in the tests. In the failed perltidy test, the test wants to add an additional tab to the list of or statements I modified in |
Rebase onto develop now, and it will fix the perltidy issue. |
I still have some difference between my local perltidy and the test results. My guess is the older version, so I'll look into updating that. |
Make sure you specifically use Perl::Tidy version 20220613. Both newer and older versions will give different results. This is one of my annoyances with Perl::Tidy. When they release new versions, the break compatibility with older versions. |
That is strange, I am using 20220613. I did perltidy |
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 think this is a good start. I noted some code issues.
You have several examples in the tar file that you provided that reference a PGplotmacros.pl
macro which does not exist. I would like to see that actually work (but not with a PGplotmacros.pl
file). That should be the main goal of this. That is to make it so that the code in PGgraphmacros.pl
can be eventually replaced with calls to methods here and it will work for existing problems that use that macro. There is the issue of problems using GD
objects directly, but I am sure we can find a way to work around that.
I don't like the merge of the previous separate files all into this one file, making it almost 2000 lines long. Instead the PGplot
, PGplot::Tikz
, PGplot::GD
, and PGPlot::Axes
should be made actual modules (each a separate file). Then this macro should have just the basics need to instantiate the object (much like how the PGtikz.pl
and PGlateximage.pl
macros work with respect to the LaTeXImage
package). The documentation on how to use the macro should stay here for problem authors (again like the above mentioned macros). Modular code is much better than a single massive file.
@drgrice1 Thanks for the review. @pstaabp has been doing a bit of work on this and has split everything back out and moved this to |
I removed the I do agree it should be a goal that we can just have a drop in replacement and all current problems are updated to using something newer. |
be70a50
to
6e500f4
Compare
I updated this, I removed the change of putting everything in a single file, then added @pstaabp change to move everything to This move changed the package to just In updating this I did notice an issue with |
a5ee6fb
to
b8078d0
Compare
Add the very basics of JSXGraph and Plotly.js output support. Examples updated. |
98eb31e
to
6ccd490
Compare
Thinking about adding JSXGraph and Plotly.js output method a bit more, I think this approach is not the best. Plots is mostly designed around creating non dynamic graphs, so at best adding javascript output could do is allow some moving around/zooming in/out of the graph in some situations. I think a better approach would create a JSXGraph and Plotly.js plots object that is a subclass, built on the same |
JSXGraph does a great job of rendering static graphs. I use it for that purpose in problems via a local macro that I have. |
I was more thinking about also wanting to be able to also use it for dynamic graphs from the same macro. And unsure if adding the dynamic side of things should be done in Plots, or better to just have a separate macro for that. But so far it is working well with the setup I have here. |
Yeah, I think that this is really for static graphs (dynamically generated but not interactive). I mean you could have dynamic in the sense of pan and zoom I suppose (both Plotly and JSXGraph support that). |
Agreed, so my thought was Plotly and JSXGraph could be separate macros that build on top of this, so they can create static and dynamic graphs (as opposed to what I'm working on now which is just making it an optional output method). Though I guess they can split off later. |
PGplot is a new method for generating dynamic graphs and can be used as a replacement for WWPlot and PGgraphmacros.pl. PGplot is a method to create a plot object and store information about a plot in multiple data objects. Since PGplot just stores data about the plot, the data can then be used to create multiple different outputs. Currently only TikZ pgfplots and GD (for testing) are supported.
This renames the PGplot object to Plots, and moves all the code from macros/ to lib/. This adds a new macro plots.pl that loads the core Plots::Plot object via the Plot method.
Mostly unpacking function calls, blessing objects in a single line, fixing perl calls, along with other code cleanup suggestions.
Here is something I've been working on for a while, but probably best to start getting some feedback.
First, PGplot is a new method for generating dynamic graphs and is meant to be a replacement of WWPlot and PGgraphmacros.pl. The first main difference is PGplot is just an API to store data that can then be used to generate a graph using multiple outputs. Right now only TikZ pgfplots and GD (for testing mostly) is supported. I started trying to fully support both, but as I added more features, I focused only on TikZ pgfplots features (so GD only supports simple things and should probably be removed, but leaving it here for now).
In addition there is a new macro PGplotmacros.pl that is meant to be a drop in replacement of PGgraphmacros.pl. This works in most cases provided the problem doesn't call any GD features directly and doesn't use filling (since I couldn't figure out how to get the GD fill method to work with TikZ). My hope was this could just replace PGgraphmacros.pl, but there are a non trivial number of problems in the OPL that call GD features directly, that this only worked on most of the OPL problems I tested.
Here are a set of examples and testing problems I have been working with to try out. This contains the problems and a few set definition files you can import. PGplot-examples.tar.gz
I am starting this as a draft, as I suspect there are going to be lots of changes as we think about the PGplot API being used and what sort of features it should support.