[NTG-context] Appearance of ticks and grids with ConTeXt metapost graph module

Jean-Philippe Rey jean-philippe.rey at centralesupelec.fr
Mon Jan 4 20:53:25 CET 2021


Dear list,

Thanks to Hans, I am now able to use the ConTeXt graph module with LMTX. However, I noticed that the tick/grid labels are drawn with the same parameters as the tick/grid marks.

For example

   grid.bot("@d", 1) withcolor red;

will draw the grid line AND "1" in red. The original metapost graph module doesn't apply drawing instructions to the label. That seems a better choice as you usually don't want to apply special effect on the labels. If you really want to draw the label with specific parameters you can write, for example,

   grid.bot(image(draw textext(1) withcolor blue;), 1) withcolor red;

and get red lines and blue labels. With the ConTeXt version, both line and label would be red! 

What do you think about reverting to the original metapost behavior? If I am right, here is a patch to do it:

--- mp-grap.mpiv	2021-01-04 18:29:15.000000000 +0100
+++ mp-grap-new.mpiv	2021-01-04 20:47:36.000000000 +0100
@@ -882,7 +882,7 @@
         if c : graph_xyscale fi
         shifted (((.5 + mfun_laboff@# dotprod (.5,.5)) * mfun_laboff@#) graph_xyscale) ;
     image(draw p w ;
-        label@#(if string f : format(f,u) else : f fi, point 0 of p) w)
+        label@#(if string f : format(f,u) else : f fi, point 0 of p))
   fi
 enddef ;


Thanks for reading this far.

-- 
Jean-Philippe Rey
jean-philippe.rey at centralesupelec.fr
91192 Gif-sur-Yvette Cedex - France
Empreinte PGP : 807A 5B2C 69E4 D4B5 783A 428A 1B5E E83E 261B BF51



More information about the ntg-context mailing list