Bloomberg has a standard plot style for its line plots in which it uses a gradient filling. Actually the way this seems to be constructed is that a gradient from the ymax to ymin is used as the background in the plot area and then the area above the line is set to transparent
.
What is the best way to make a plot like that in Mathematica for plotting {x,y} data?
Answer
How about this?
bankerPlot[data_] := ListLinePlot[
data,
AxesOrigin -> {0, 0},
Prolog -> Polygon[Join[data, Reverse[data.DiagonalMatrix[{1, 0}]]],
VertexColors -> Join[
Blend[{Black, Blue}, #] & /@ Normalize[data[[All, 2]], Max],
ConstantArray[Black, Length[data]]
]
],
PlotStyle -> White,
Background -> Black,
AxesStyle -> White
]
bankerData = Transpose[{Range[100], Accumulate[RandomReal[{-1, 1}, 100]] + 10}];
bankerPlot[bankerData]
Comments
Post a Comment