On 11/14/2025 10:29 AM, Henning Hraban Ramm wrote:
Hi, did anyone succeed in using pgfplots within a CLD document?

While context.starttikzpicture() … context.stoptikzpicture() seems to work, everything inbetween is just output but not executed.

So I guess,

context.starttikzpicture()
context.startaxis{title="bla", xlabel="mm", ylabel="min"}
context.addplot(…)
context.stopaxis()
context.stoptikzpicture()

… is not the right way?

you have to get around catcode hell ... so best collect the picture in a string and then flush is, like:

\startluacode
buffers.assign("crap",[[
\string\starttikzpicture
\string\startaxis[title=bla,xlabel=mm,ylabel=min]
\string\addplot{exp(x)};
\string\stopaxis
\string\stoptikzpicture
]])
context.getbuffer { "crap" }
\stopluacode

here we need \string but in pure cld likely not

next time come with a proper mwe ... now i had to waste time to figure out that i had to load more than tikz (i'm not familiar with it so it's trial and error for me)

Hans

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : [email protected] / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

Reply via email to