Re: graphics question
- To: mathgroup@smc.vnet.net
- Subject: [mg12403] Re: graphics question
- From: "Allan Hayes" <hay@haystack.demon.cc.uk>
- Date: Thu, 14 May 1998 11:15:12 -0400
- References: <6j5sv8$i6g$15@dragonfly.wolfram.com>
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