[metapost] graph: no spline in log-log plot

Sanjoy Mahajan sanjoy at mrao.cam.ac.uk
Mon Jan 16 03:40:01 CET 2006


I cannot graph smooth curves if I use log-log coordinates.  Below I've
included the simplest example file that shows the problem.  

With dolog set to 0, it makes a linear-linear plot; the .. in the path
correctly produces a spline.  

With dolog 1, it produces a log-log plot at the same absolute locations
as the linear plot (by construction).  However, the curve comes out
polygonal rather than as a spline.  Is this behavior a bug?  Perhaps
when graph.mp converts the coordinates to linear-linear axes, it forgets
the .. connectors?

[MetaPost, Version 0.641 (Web2C 7.5.4), linux i386, tetex 3.0]

  input graph;

  beginfig(1)			% log-log graph of cd vs Re
    path p;
    dolog := 1;
    draw begingraph (2.3in,1.5in);
      if dolog > 0:
	setcoords(log,log);
	p := (0.1,10)..(1,0.1)..(10,0.1);
      else:
	p := (-1,1)..(0,-1)..(1,-1);
      fi
      gdraw p;
      for i=0 upto 2:
	gdotlabel (btex etex, point i of p);
      endfor
    endgraph;
  endfig;

  end

-Sanjoy

`A society of sheep must in time beget a government of wolves.'
   - Bertrand de Jouvenal



More information about the metapost mailing list