MathGroup Archive 1994

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

Search the Archive

Re: plots in reverse order

  • To: mathgroup at christensen.cybernetics.net
  • Subject: Re: plots in reverse order
  • From: Allan Hayes <hay at haystack.demon.co.uk>
  • Date: Sun, 16 Oct 94 22:07:43 +0100

John Pender (tuk at Natazhat.uafphys.alaska.edu (John Pender)) writes:

> on rare occasions i like to make plots for which the value of a 

> point on the x axis decreases as you go from left to right, as 

> opposed to increases.  i realize that >99.99% of the time you want 

> the values to increase as you go from left to right, but every so 

> often i want to duplicate the format of a plot in the (mostly 

> older) literature.  i haven't found an obvious solution (meaning an
> option that i can set for one or another of the various plotting 

> commands). does anyone out there have a clean solution?
> john pender

Is this any  use?

Needs["Utilities`FilterOptions`"]

ReverseXPlot[f_,{x_,a_,b_},opts___?OptionQ] :=
	Show[
	FullGraphics[
		Plot[(f/.x->(b -(x-a)))//Evaluate, {x,a,b}, opts,
				DisplayFunction -> Identity
			]
	]/.Graphics[
		{lines_,{xaxis_, yaxis_,xticks_,r___}},z___] :> 

			Graphics[
				{
				lines,
				{	xaxis,
					yaxis,
											
				xticks/.Text[n_?NumberQ,w___]:> 

				Text[(b -(n-a)),w],
					r
				}
				},
				z
				],
		DisplayFunction -> $DisplayFunction,
		PlotRange-> All,
		FilterOptions[Graphics, opts]		
	]
	
(*example*)
	
ReverseXPlot[{x,x^2,x^3}, {x,1,0}]

(*
	Allan Hayes
	hay at haystack.demon.co.uk (NEXTMAIL welcome)
*)





  • Prev by Date: Mathematica Training
  • Next by Date: [no subject]
  • Previous by thread: Mathematica Training
  • Next by thread: Re: plots in reverse order