MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: graphics question



Tom <toad@planet.eon.net> points our that when using ListPlot, if the
axis origin is assigned by the AxesOrigin option, then the axes may be
only partially drawn - leaving gaps between them and the origin.

This is also a problem with other Graphics objects, for example those
produced by Plot.

Here is one suggestion.

Make original plot
lst = {{1,2},{2,1},{3,5}};
lp=ListPlot[lst, PlotStyle -> PointSize[.02],PlotJoined->True]

-Graphics-

Define a function to change the Graphics object and show the result

AxesAndOrigin[gr_, origin_]:=
	Show[gr,
	AxesOrigin ->origin, 
	PlotRange->
       (Through[{Min,Max}[#]]&/@
          Transpose[{FullOptions[gr, PlotRange],origin}]) ]

Test:

AxesAndOrigin[lp,{0,0}]

Maybe it is better to alter without showing

AxesAndOrigin2[gr_, origin_]:=
	(gr/.{
	(AxesOrigin ->_)->(AxesOrigin ->origin), 
	(PlotRange ->_) ->
	(PlotRange->
               (Through[{Min,Max}[#]]&/@
                  Transpose[{FullOptions[gr, PlotRange],origin}]))
						
})

Test:

AxesAndOrigin2[lp, {-1,-2}]

Show[%]

-- 
Allan Hayes
Mathematica Training and Consulting
Leicester UK
http://www.haystack.demon.co.uk
hay@haystack.demon.co.uk
voice: +44 (0)116 271 4198
fax: +44(0)116 271 8642








  
-- 
Allan Hayes
Mathematica Training and Consulting
Leicester UK
http://www.haystack.demon.co.uk
hay@haystack.demon.co.uk
voice: +44 (0)116 271 4198
fax: +44(0)116 271 8642




  • Prev by Date: Problem defining transformation rules
  • Next by Date: how to replace...?
  • Prev by thread: Re: graphics question
  • Next by thread: graphics question