ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Appearance of ticks and grids with ConTeXt metapost graph module
@ 2021-01-04 19:53 Jean-Philippe Rey
  0 siblings, 0 replies; only message in thread
From: Jean-Philippe Rey @ 2021-01-04 19:53 UTC (permalink / raw)
  To: ntg-context

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@centralesupelec.fr
91192 Gif-sur-Yvette Cedex - France
Empreinte PGP : 807A 5B2C 69E4 D4B5 783A 428A 1B5E E83E 261B BF51

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-01-04 19:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-04 19:53 Appearance of ticks and grids with ConTeXt metapost graph module Jean-Philippe Rey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).