Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

Re: Is there any simplier way to plot in a specific style?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg92412] Re: Is there any simplier way to plot in a specific style?
  • From: "David Park" <djmpark at comcast.net>
  • Date: Tue, 30 Sep 2008 21:48:09 -0400 (EDT)
  • References: <gbt2rp$led$1@smc.vnet.net>

In general each plot is individual and you will have to specify the options 
to give the best appearance to the graphic. However, if you are making many 
plots of a similar type it is possible to write definitions that save you 
the effort of repeatedly entering the same options, and still allow for 
variation when it is necessary. The trick to to allow entry of options and 
then insert them BEFORE any built-in options you might define. That way you 
can enter new options or override built-in options.

Here's an example:

Plot2[function_, iterator_, opts : OptionsPattern[]] :=
 Plot[function, iterator, opts, Frame -> True,
  FrameLabel -> {"x", "y"}, PlotLabel -> function]

Plot2[x^2, {x, -2, 2}]

Plot2[3 y + y^2, {y, -2, 2}, PlotStyle -> Red,
 FrameLabel -> {"y", "f"}]


-- 
David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/


"Yiping Huang" <u930309 at oz.nthu.edu.tw> wrote in message 
news:gbt2rp$led$1 at smc.vnet.net...
> Every time I plot the figure, I need to give a lot of parameters to make 
> sure the plot can show with specific format. I feel it is not so 
> convenient for me.
>
> I try to create another plot function, the new definition looks like:
>
> Plott[data_]:=Plot[data,{specific format}]
>
> However, it is still not so convenient, because I need to change the axes 
> label for x,y axes. I don't know how to create a function with input 
> contain string. How to create a function defined as:
>
> Plott[data_,"label x","label y"]=Plot[data_,...]
>
> So that I can input string and the data I want to create the figure with 
> specific format.
>
> Is there any way can simplify the plot command? Or to have an systematic 
> way to create plots with specific format?
> 



  • Prev by Date: Re: mathematica newbie ?
  • Next by Date: Re: Plotting f = Function[x,expr] and f[x_] := expr
  • Previous by thread: Re: Is there any simplier way to plot in a specific style?
  • Next by thread: Font size in plot coordinates?