From: Robert D. <rob...@gm...> - 2022-11-18 18:13:41
|
On Thu, Nov 17, 2022 at 7:09 PM Eduardo Ochs <edu...@gm...> wrote: > a few days ago I had to draw some level curves of > > F(x,y) := 2*x^2 - x*y - y^2; > > in TikZ. Gnuplot has an output terminal "tikz". You can tell Gnuplot to use tikz in Maxima: set_plot_option ([gnuplot_term, "tikz"]); and for good measure set_plot_option ([gnuplot_out_file, "path/to/myplot.tikz"]); and then plot2d output will go to that file. About capturing level curves for some analysis or exploration or something, it's not a bad idea. Maxima doesn't make it easy, but it looks like it's not too hard to intercept the level curves as determined in the plotting code by the function DRAW2D-IMPLICIT. Just to investigate the idea, try this: :lisp (let ((f (symbol-function 'draw2d-implicit))) (defun draw2d-implicit (&rest args) (let ((stuff (apply f args))) (displa stuff) stuff))) Looks like the stuff generated by DRAW2D-IMPLICIT comprises a list of curve segments -- not sure at the moment how to interpret it, although I don't think it's complicated. We can sort it out if you think it's useful. Getting a list of curves for a contour plot or implicit plot might be useful from time to time -- we could consider exposing DRAW2D-IMPLICIT so that it can be called directly (and returning an intelligible result). best, Robert |