# [NTG-context] Gnuplot should now work on MKIV

Hans Hagen pragma at wxs.nl
Wed Dec 3 19:58:04 CET 2008

```Mojca Miklavec wrote:
> On Wed, Dec 3, 2008 at 7:00 PM, Hans Hagen wrote:
>> Mojca Miklavec wrote:
>>> Hello,
>>>
>>> module to work with mkiv.
>>>
>>> There are still some parts for which I'm almost sure that they don't
>>> work (I didn't test, but at least an average gnuplot run should not
>>> need those features):
>>>
>>> 1.) colored labels
>>>
>>> .... Because withcolor doesn't work; but now that I intercept textext,
>>> maybe I can do some dirty tricks there.
>> why dirty ... i made you:
>>
>
> The main problem was that one had to intercept the string (the
> terminal gives the same output for all "marks"). The hint that you
> gave me an hour ago lead me to the following solution that seems to
> work OK:
>
> vardef textext@#(expr txt) =
> 	let,=@;
>
> 	save r, g, b;
> 	r = redpart   gp_color_current;
> 	g = greenpart gp_color_current;
> 	b = bluepart  gp_color_current;
>
> 	rawtextext("\colored[r=" & decimal(r) & ",g=" & decimal(g) & ",b=" &
> decimal(b) & "]{" & txt & "}")
> enddef ;
>
> Writing the string \colored[...] directly would need heavy
> modifications in the terminal. Now this hack works really nice.
>
>>> 3.) changing font with gnuplot commands
>>>     set title "Nice Title" font "iwona,20"
>
> But that requires modifications to terminal again & incompatibility
> with output between engines. I'll try to figure out how to do
> something similar as above. I would like to write this as
> \sometxt[gp][iwona,20pt]{The Title}. I "just" need to redefine the
> meaning of \sometxt somehow.

in any case ... you need to save and restore the meaning of textext
because we have one session of mp;

begingroup ;
save textext ;
vardef ... ;
plotting like a gnu ... ;
endgroup ;

alternatively we can use a dedicated mp instance; since you only use
textext that would be just the plain format plus mp-gnup.mp or something
like that; next time we meet we should sit down and do that

> I thought that was planned for 2068? (At least that was what Ton said,
> or rather sang.)

Well I met this woman, she was hard as nails ...

(Last Will and Testament, J.J. Cale/E. Clapton)

-----------------------------------------------------------------