在Mathematica中绘制情节背景

时间:2011-09-04 15:28:42

标签: background wolfram-mathematica plot customization

考虑到:

ListPlot[Range[10], 
         Background -> Gray, 
         PlotLabel -> "I don`t want the background here !"]

enter image description here

有没有办法让背景仅适用于实际的绘图区?

不在轴上,不在标签后面。那么基本上就是那个矩形{{0,0},{10,10}}?

编辑:我们可以使用PolarListPlot做同样的事吗?

From Cartesian Plot to Polar Histogram using Mathematica上使用Sjoerd解决方案:

dalist = {{21, 22}, {26, 13}, {32, 17}, {31, 11}, {30, 9}, 
          {25,12}, {12, 16}, {18, 20}, {13, 23}, {19, 21}, 
          {14, 16}, {14,22}, {18, 22}, {10, 22}, {17, 23}}

ScreenCenter = {20, 15}

ListPolarPlot[{ArcTan[##],EuclideanDistance[##]} & @@@ (# - ScreenCenter & /@ dalist), 
               PolarAxes -> True, PolarGridLines -> Automatic, Joined -> False, 
               PolarTicks -> {"Degrees", Automatic}, 
               BaseStyle -> {FontFamily -> "Arial", FontWeight -> Bold, 
               FontSize -> 12}, PlotStyle -> {Red, PointSize -> 0.02}]

enter image description here

4 个答案:

答案 0 :(得分:10)

你可以这样做:

ListPlot[Range[10], PlotLabel -> "I don`t want the background here !",
  Frame -> {True, True, False, False}, AxesOrigin -> {0, 0}, 
 Prolog -> {Gray, Rectangle[Scaled[{0, 0}], Scaled[{1, 1}]]}]

enter image description here

答案 1 :(得分:5)

您可以在

中使用Labeled
Labeled[
  ListPlot[Range[10], Background -> Gray,
  PlotLabel -> "I don`t want the background here !"],
  "So place the label here", Top]

答案 2 :(得分:2)

ListPlot[Range[10], 
         Background -> Gray, 
         PlotLabel -> Style["I don`t want the background here !",
                            Background -> White ]]

result

答案 3 :(得分:2)

你可以这样做:

Show[Graphics[{Pink, Rectangle[{0, 0}, {10, 10}]}], 
 ListPlot[Range[10]], Axes -> True, AspectRatio -> 1/2]

enter image description here

修改

也许更好

c = RandomInteger[100, 10];
ListPlot[c,  Prolog -> {Pink, Rectangle[{0, Min@c}, {Length@c, Max@c}]}]