2D Functions
Function Plot
Parametric Plot
Multiple Parametric Plot
Filled Plot
Multiple Filled Plot
Logarithmic Plot
2D Data Plots
Data Plot
Data Error Plot
Data Logarithmic Plot
Data Labeled Plot
Contour & Density Plots
Contour Plot
Density Plot
Level Curves
3D Functions
3D Function Plot
3D Parametric Plot
3D Multiple Parametric Plot
3D Vector Field
3D Gradient Field
Shadow 3D Function
3D Data Plots
Contour 3D Data Plot
Density 3D Data Plot
Special Plots
Vector Field
Bar Charts
Pie Chart
Zonotope Show
Links
About This Site
Citation & Credits
Sci.Vis. Tutorials
web
C
omputing
Bar Charts
<%Mathlet MSPSetDefault[$$funcType, "fBarChart"] %>
>
Bar Chart
of
{ datalist1, datalist2, ...}
generate a bar chart of the data sets.
>
Generalized Bar Chart
of
{ datalist1, datalist2, ...}
generate a bar chart of the data sets, where the data specify position, height, and width of the bars.
>
Stacked Bar Chart
of
{ datalist1, datalist2, ...}
generate a stacked bar chart of the data sets.
>
Percentile Bar Chart
of
{ datalist1, datalist2, ...}
generate a stacked bar chart of the datasets, where the data for each group of bars are scaled so that the absolute values of the heights sum to one.
Enter the data
- list of lists (for GeneralizedBarChart - 3 dimensional list - list of lists of lists of three elements):
" >
<%Mathlet Needs["Graphics`Graphics`"]; %> <%Mathlet MSPBlock[ {$$list, $$funcType, $$frame, $$imageSize, $$plotLabel, $$fr1, $$fr2, $$fr3, $$fr4, $$xAxeLabel, $$yAxeLabel, $$rotateLabel, $$xAxeOrigin, $$yAxeOrigin, $$xAxe, $$yAxe, $$xTicks, $$yTicks, $$xGrids, $$yGrids, $$aspectRatio, $$rColor, $$gColor, $$bColor, $$rColorBackg, $$gColorBackg, $$bColorBackg, $$xRangeBeg, $$xRangeEnd, $$yRangeBeg, $$yRangeEnd, $$xBarOrientation, $$xBarLabels, $$xBarEdges, $$xBarValues, $$xBarSpacing, $$xBarGroupSpacing }, d = ReleaseHold[MapAt[ToString, MapAt[HoldForm, HoldForm[$$xBarLabels], Table[{1, i}, {i, Length[HoldForm[$$xBarLabels][[1]]]}] ], Table[{1, i}, {i, Length[ HoldForm[$$xBarLabels][[1]]]}] ] ]; For[i = 1, i <= Length[d], If[Part[d, i] === "Null", Part[d, i]= ""]; i++]; cc = Apply[Max[Length[#]]&,$$list]; If[Length[d] < cc, Do[d = Append[d, ""],{cc - Length[d]}]]; listvalid = Length[ $$list ] > 0; If[$$funcType === fGeneralizedBarChart, For[ i = 0, i < Length[ $$list ], i++; For[ j = 0, j< Length[ $$list[[i]] ], j++; If[Length[$$list[[i]][[j]]] =!= 3,listvalid = False] ]; ]; ]; If[ listvalid, par = First[ $$list ]; For[ i = 1, i < Length[ $$list ] , i++; par = Sequence[ par, $$list[[i]] ] ]; par = Sequence[ par, BarOrientation->If[$$xBarOrientation, Vertical, Horizontal], BarLabels->If[$$xBarLabelsFlag === "Specified", d, Automatic], BarEdges->$$xBarEdges, BarValues->$$xBarValues, BarSpacing-> If[$$xBarSpacingFlag === "Specified" , $$xBarSpacing, Automatic], BarGroupSpacing-> If[$$xBarGroupSpacingFlag === "Specified" , $$xBarGroupSpacing, Automatic], AspectRatio-> If[$$aspectRatioFlag === "Specified" , $$aspectRatio, 1/GoldenRatio], Axes->{$$xAxe,$$yAxe}, AxesLabel->{ If[$$xAxeLabel === Null, "", ToString[HoldForm[$$xAxeLabel]]], If[$$yAxeLabel === Null, "", ToString[HoldForm[$$yAxeLabel]]]}, AxesOrigin->If[$$axesOriginFlag === "Specified",{$$xAxeOrigin,$$yAxeOrigin}, Automatic], Background->If[{$$rColorBackg,$$gColorBackg,$$bColorBackg} =!= {"","",""}, RGBColor[$$rColorBackg,$$gColorBackg,$$bColorBackg], Automatic], DefaultColor->If[{$$rColor,$$gColor,$$bColor} =!= {"","",""}, RGBColor[$$rColor,$$gColor,$$bColor], Automatic], Frame->$$frame, FrameLabel->{If[$$fr1 === Null, "", ToString[HoldForm[$$fr1]]], If[$$fr2 === Null, "", ToString[HoldForm[$$fr2]]], If[$$fr3 === Null, "", ToString[HoldForm[$$fr3]]], If[$$fr4 === Null, "", ToString[HoldForm[$$fr4]]]}, GridLines->{If[$$xGridsFlag === "Specified", $$xGrids, MSPToExpression[$$xGridsFlag]], If[$$yGridsFlag === "Specified" , $$yGrids, MSPToExpression[$$yGridsFlag]]}, ImageSize->If[NumberQ[$$imageSize],$$imageSize,Automatic], PlotLabel-> If[$$plotLabel === Null, "", ToString[HoldForm[$$plotLabel]]], PlotRange->{If[$$xPlotRange === "Specified", {$$xRangeBeg,$$xRangeEnd}, MSPToExpression[$$xPlotRange]], If[$$yPlotRange === "Specified",{$$yRangeBeg,$$yRangeEnd}, MSPToExpression[$$yPlotRange]]}, RotateLabel->$$rotateLabel, Ticks->{If[$$xTicksFlag === "Specified" , $$xTicks, MSPToExpression[$$xTicksFlag]], If[$$yTicksFlag === "Specified" , $$yTicks, MSPToExpression[$$yTicksFlag]]} ]; Switch[ $$funcType, fBarChart, result = BarChart[ par ], fGeneralizedBarChart, result = GeneralizedBarChart[ par ], fStackedBarChart, result = StackedBarChart[ par ], fPercentileBarChart, result = PercentileBarChart[ par ] ]; If[Head[result] === Graphics, MSPShow[result] ] ,"The matrix is not compatible with the BarChart function!"]] %>
<%Mathlet MSPBlock[{$$fname, $$submitButton1}, c = If[$$fname === Null, "", ToString[$$fname]]; ftype = Switch[$$opt, "jpg", "JPEG", "tif", "TIFF", "eps", "EPSTIFF", "xbm", "XBitmap", "mps", "MPS", _ , $$opt]; If[Head[result] === Graphics, MSPReturn[DisplayString[result, ftype], "image/"<>ftype , c<>"."<>$$opt] ] ] %>
Save as:
> GIF and animated GIF (.gif)
>JPEG (.jpeg)
>JPEG (.jpg)
> Encapsulated PostScript (.eps)
> Mathematica abbreviated PostScript (.mps)
> Adobe Acrobat portable document format (.pdf)
> Microsoft bitmap format (.bmp)
> Encapsulated PostScript with device independent preview (.epsi)
> Encapsulated PostScript with TIFF preview (.eps)
> Mathematica independent raster graphics format (.mgf)
> Portable bitmap format (.pbm)
>TIFF (.tif)
>TIFF (.tiff)
> X window system bitmap (.xbm)
With file name:
" >
Specific Options
Bar Orientation:
<%Mathlet MSPSetDefault[$$xBarOrientation, "True"] %>
> Vertical
> Horizontal
Bar Labels:
labels to be placed at the group tick mark positions
<%Mathlet MSPSetDefault[$$xBarLabelsFlag, "Automatic"] %>
> Automatic
> Specified:
" >
Bar Edges:
whether edges should be shown with the bars
<%Mathlet MSPSetDefault[$$xBarEdges, "True"] %>
> True
> False
Bar Values:
label each bar by its value (for BarChart and GeneralizedBarChart)
<%Mathlet MSPSetDefault[$$xBarValues, "False"] %>
> True
> False
Bar Spacing:
specify space between each bar, as a fraction of the width of one bar.
<%Mathlet MSPSetDefault[$$xBarSpacingFlag, "Automatic"] %>
> Automatic
> Specified:
" >
Bar Group Spacing:
specify space between each group of bars, as a fraction of the width of one bar (used only in BarChart).
<%Mathlet MSPSetDefault[$$xBarGroupSpacingFlag, "Automatic"] %>
> Automatic
> Specified:
" >
General Options
Plot range:
(All - all points are included, Automatic - outlying points are dropped)
X:
<%Mathlet MSPSetDefault[$$xPlotRange, "Automatic"] %>
> Automatic
> All
> Specified
" > < = x < =
" >
Y:
<%Mathlet MSPSetDefault[$$yPlotRange, "Automatic"] %>
> Automatic
> All
> Specified
" > < = y < =
" >
<%Mathlet MSPSetDefault[$$xAxe, "True"] %> <%Mathlet MSPSetDefault[$$yAxe, "True"] %>
Axes:
X:
> True
> False Y:
> True
> False
<%Mathlet MSPSetDefault[$$axesOriginFlag, "Automatic"] %>
Axes origin:
> Automatic
> Specified: X :
" > Y :
" >
Axes labels:
x label:
" > y label:
" >
<%Mathlet MSPSetDefault[$$xTicksFlag, "Automatic"] %> <%Mathlet MSPSetDefault[$$yTicksFlag, "Automatic"] %>
Ticks:
Whether to draw tick marks if there are axes. You may specify the positions at which ticks will be drawn.
X:
> Automatic
> None
> Specified:
" >
(list of values)
Y:
> Automatic
> None
> Specified:
" >
(list of values)
<%Mathlet MSPSetDefault[$$xGridsFlag, "None"] %> <%Mathlet MSPSetDefault[$$yGridsFlag, "None"] %>
GridLines:
Whether to draw gridlines. You may specify the positions at which gridlines will be drawn.
X:
> None
> Automatic
> Specified:
" >
(list of values)
Y:
> None
> Automatic
> Specified:
" >
(list of values)
<%Mathlet MSPSetDefault[$$frame, "True"] ;%>
Frame:
> True
> False
Frame labels:
Frame label down:
" > Frame label left:
" >
Frame label up:
" > Frame label right:
" >
<%Mathlet MSPSetDefault[$$rotateLabel, "True"] %>
Rotate labels:
> True
> False
(whether to allow text in frame labels to be vertically positioned)
Plot label:
" >
<%Mathlet MSPSetDefault[$$aspectRatioFlag, "1/GoldenRatio"] %>
Aspect ratio:
> Default
> Specified:
" >
Setting the AspectRatio option changes the whole shape of your plot. AspectRatio gives the ratio of height to width.
Its
default
value is the inverse of the Golden Ratio - supposedly the most pleasing shape for a rectangle.
Automatic
determines the shape of the display area from the original coordinate system.
Plot color (RGB color):
red part :
" > green part :
" > blue part :
" >
Specifies the default color to be used for the axes, the frames and the bounds of the figure.
The values of the color parts must be between 0 and 1.
Background (RGB color):
red part :
" > green part :
" > blue part :
" >
Image size:
">
specifies that the image should have a width of x printer's points
© 2004 web
C
omputing, Scientific Visualization