Re: old vs new(V7) BarChart3D
- To: mathgroup at smc.vnet.net
- Subject: [mg104326] Re: old vs new(V7) BarChart3D
- From: Albert Retey <awnl at gmx-topmail.de>
- Date: Wed, 28 Oct 2009 04:05:03 -0500 (EST)
- References: <hc6g9p$5jt$1@smc.vnet.net>
mtnMan wrote:
> I've been using BarChart3D in pre-7 versions of Mathematica to produce
> density plots for discrete probability distributions. For example,
>
> BarChart3D[
> (binorm = {{4,15,24,15,4},{15,60,90,60,15},{24,90,144,90,24},
> {15,60,90,60,15},{4,15,24,15,4}})/Max[binorm],BarSpacing->.5,
> Boxed->False,Axes->{False,False,False},
> BaseStyle->{Medium,FontFamily->"Arial"},PlotLabel->"Field Study"]
>
> Pre V7, this generated nice, histogram-like bar bars. But now it
> generates what I would call a microsoft-like two-dimensional bar graph
> with a fake 3rd dimension that conveys no information. I want the old
> one back! I've discovered I can get the old one back by using
>
> Needs["BarCharts`"]
>
> but then I get all sorts of compatibility warnings. Is there
> something else I should be using instead of the new BarChart3D[] to
> generate something like the old style BarChart3D[]?
The closest I could come up is this:
ListPlot3D[(binorm = {{4, 15, 24, 15, 4}, {15, 60, 90, 60, 15}, {24,
90, 144, 90, 24}, {15, 60, 90, 60, 15}, {4, 15, 24, 15, 4}})/
Max[binorm],
InterpolationOrder -> 0, Mesh -> False, Filling -> Bottom,
FillingStyle -> Opacity[1],
Boxed -> False, Axes -> {False, False, False}, AspectRatio -> 1
]
Of course alteratively you can just create Cuboids from your data, which
will look exactly as your old BarChart, but will be some extra effort,
but probably not too much...
> It is not
> Histogram3D because I already have the probabilities or counts for
> each data point. Histogram3D wants raw data that it will bin for
> you. Any suggestions? Or should I just load the legacy version and
> ignore the warnings?
It depends on whether it is a problem for your other code that now some
other System` symbols are shadowed by their BarChart` versions, too...
Here is a trick that will avoid namespace conflicts and suppress the
warnings:
Block[{$ContextPath={"System`"}},Quiet[Needs["BarCharts`"]];]
Now you can use the BarCharts` version with explicit BarChart`-prefix:
BarCharts`BarChart3D[
(binorm={{4,15,24,15,4},{15,60,90,60,15},{24,90,144,90,24},
{15,60,90,60,15},{4,15,24,15,4}})/Max[binorm],
BarSpacing->.5,Boxed->False,Axes->{False,False,False},
BaseStyle->{Medium,FontFamily->"Arial"},PlotLabel->"Field Study"
]
and without these prefixes everything else will use the normal System`
versions. Note that you might need to use the BarChart`-Prefix for some
of the option names, too.
hth,
albert