MathGroup Archive 2008

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

Search the Archive

Re: BarChart Question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg84695] Re: BarChart Question
  • From: "D. Grady" <D.C.Grady at gmail.com>
  • Date: Thu, 10 Jan 2008 02:26:47 -0500 (EST)
  • References: <fm21oh$8ts$1@smc.vnet.net>

The expression that the error message refers to is the Graphics
expression generated by BarChart.  Take a look at the documentation
for Cell; you'll see that formatted expressions, including graphics
generated by Mathematica, need to be expressed in terms of BoxData
before they can be passed directly to Cell.  This can be done with the
ToBoxes function, like so:

Needs["BarCharts`"]

CellPrint[Cell[
  BoxData[ToBoxes[
    BarChart[{{1/3, 1/3, 1/3}, {1/3, 1/3, 1/3}},
     AspectRatio -> 1, BarStyle -> {Red, Green}]]],
  "Output"]]

The GraphicsData function you use in your example appears to be used
only for imported graphics, like if you were including a jpeg file or
something.  Graphics generated by Mathematica don't need it.

Also, this seems like a complicated solution.  Why can't you just type

BarChart[{{1/3, 1/3, 1/3}, {1/3, 1/3, 1/3}},
 AspectRatio -> 1, BarStyle -> {Red, Green}]

and be done with it?

-Daniel

John wrote:
> I am trying to write a notebook for a course. The Students will see
> the evaluation of the notebook, but they will not see the notebook.
>
> I want to insert a cell in my notebook, which prints a bar chart that
> the students will see when they view the evaluation of my notebook.
>
> A book suggests that the cell,
>
> Cell[GraphicsData[BarChart[{{1/3,1/3,1/3},{1/3,1/3,1/3}}],
>                                          BarStyle->{Red,Green},
>                                          AspectRatio->1,"Output"]]
>
> will do the job, but it doesn't.
>
> Error Message: An unknown box name (Graphics) was sent as the BoxForm
> for the expression. Check the format rules for the expression.
>
> What is the expression mentioned in the error message?
>
> I would appreciate the advice of anyone who knows how to do it.
>
> John


  • Prev by Date: Selecting dynamically from a list
  • Next by Date: Re: How to ParametricPlot3D a plane given Normal and Distance
  • Previous by thread: BarChart Question
  • Next by thread: 3D Picking again