ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Jean-Philippe Rey <jean-philippe.rey@centralesupelec.fr>
To: ntg-context <ntg-context@ntg.nl>
Subject: Appearance of ticks and grids with ConTeXt metapost graph module
Date: Mon, 4 Jan 2021 20:53:25 +0100	[thread overview]
Message-ID: <A2E6AD38-444C-4FFC-820B-403795AEF6BB@centralesupelec.fr> (raw)

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
___________________________________________________________________________________

                 reply	other threads:[~2021-01-04 19:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=A2E6AD38-444C-4FFC-820B-403795AEF6BB@centralesupelec.fr \
    --to=jean-philippe.rey@centralesupelec.fr \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).