Customsize Background in Plot within Mathematica

那年仲夏 提交于 2019-12-11 18:36:01

问题


Considering:

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

Is there any way to have the background applied solely to the actual plotting zone?

Not on the axis, not behind the label. So basically to the rectangle {{0,0},{10,10}} in that case?

EDIT: Can we do the Same using PolarListPlot?

Using Sjoerd Solution on From Cartesian Plot to Polar Histogram using Mathematica:

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}]


回答1:


You could do something like this:

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}]]}]




回答2:


You could use Labeled as in

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



回答3:


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




回答4:


You could do:

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

Edit

Perhaps better

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


来源:https://stackoverflow.com/questions/7300229/customsize-background-in-plot-within-mathematica

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!