MathGroup Archive 2010

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

Search the Archive

Re: Pass argument name to plot label

  • To: mathgroup at smc.vnet.net
  • Subject: [mg107824] [mg107824] Re: [mg107794] Pass argument name to plot label
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Sat, 27 Feb 2010 03:15:28 -0500 (EST)
  • Reply-to: hanlonr at cox.net

Give hplot the attribute HoldFirst or HoldAll

SetAttributes[hplot, HoldFirst]

hplot[list_] := Histogram[list,
  PlotLabel -> Row[{HoldForm[list],
     ", mean = ", Mean[list]}]]

things = {1, 2, 3};

hplot[things]


Bob Hanlon

---- Adam <juneappal at gmail.com> wrote: 

=============
I have 15 lists with semi-descriptive names.  I want to make a
function that builds a plot (histogram, actually) that has the
particular list name as a label.

Something like this:

hplot[list_] :=
 Histogram[list,   PlotLabel -> Row[{list, ", mean = ", Mean[list]}]]

When I run it, like so:
things = {1 , 2, 3};
hplot[things]

I want the Plot Label to be displayed as:
"things, mean = 2"

Is this possible?  I have tried SymbolName[things], HoldForm[things],
ut either way, my plot label displays as:
{1, 2, 3} , mean = 2



  • Prev by Date: Re: Re: Programmatically saving myself
  • Next by Date: CONDITION/DATA ANALYSIS/PLOTS
  • Previous by thread: Pass argument name to plot label
  • Next by thread: Re: Pass argument name to plot label