summaryrefslogtreecommitdiff
path: root/metapost
diff options
context:
space:
mode:
Diffstat (limited to 'metapost')
-rw-r--r--metapost/context/mp-grid.mp22
1 files changed, 18 insertions, 4 deletions
diff --git a/metapost/context/mp-grid.mp b/metapost/context/mp-grid.mp
index c684963d8..cfcc6bc15 100644
--- a/metapost/context/mp-grid.mp
+++ b/metapost/context/mp-grid.mp
@@ -32,13 +32,13 @@ def do_mformat = if fmt_pictures : Mformat else : Mformatstr fi enddef ;
def hlingrid (expr Min, Max, Step, Length, Width) text t =
image ( for i=Min step Step until Max :
- draw (origin--(Width,0)) shifted (0,i*Length/Max) t ;
+ draw (origin--(Width,0)) shifted (0,i*(Length/Max)) t ;
endfor ; ) ;
enddef ;
def vlingrid (expr Min, Max, Step, Length, Height) text t =
image ( for i=Min step Step until Max :
- draw (origin--(0,Height)) shifted (i*Length/Max,0) t ;
+ draw (origin--(0,Height)) shifted (i*(Length/Max),0) t ;
endfor ; ) ;
enddef ;
@@ -57,14 +57,14 @@ enddef ;
vardef hlintext@#(expr Min, Max, Step, Length, Format) text t =
image ( do_initialize_numbers ;
for i=Min step Step until Max :
- draw textext@#(do_format(Format,i)) shifted (0,i*Length/Max) t ;
+ draw textext@#(do_format(Format,i)) shifted (0,i*(Length/Max)) t ;
endfor ; )
enddef ;
vardef vlintext@#(expr Min, Max, Step, Length, Format) text t =
image ( do_initialize_numbers ;
for i=Min step Step until Max :
- draw textext@#(do_format(Format,i)) shifted (i*Length/Max,0) t ;
+ draw textext@#(do_format(Format,i)) shifted (i*(Length/Max),0) t ;
endfor ; )
enddef ;
@@ -82,6 +82,20 @@ vardef vlogtext@#(expr Min, Max, Step, Length, Format) text t =
endfor ; )
enddef ;
+vardef hlinlabel@#(expr Min, Max, Step, Length) text t =
+ image (
+ for i=Min step Step until Max :
+ draw thelabel@#(decimal i,(0,i*(Length/Max))) t ;
+ endfor ; )
+enddef ;
+
+vardef vlinlabel@#(expr Min, Max, Step, Length) text t =
+ image (
+ for i=Min step Step until Max :
+ draw thelabel@#(decimal i,(i*(Length/Max),0)) t ;
+ endfor ; )
+enddef ;
+
boolean numbers_initialized ; numbers_initialized := false ;
def do_initialize_numbers =