Skip to main content
Became Hot Network Question
added 62 characters in body
Source Link
MMAUser
  • 409
  • 2
  • 6

I want to plot a time series so that positive values appear in red and negative values in green.

I have tried all kind of variants of the following, which just plots everything in the last color specified (Green in this case). Also tried with ColorFunction, to no avail.

Maybe it's just me, but I find these trivial plotting issues are some of the most complex and time consuming to figure out in the Wolfram Language.

tsData = TimeSeries[RandomReal[{-1, 1}, 100], {Range[100]}];

   DateListPlot[tsData,Joined->False,Filling->Axis,PlotStyle->{If[#>0,Red,Green]&/@tsData["Values"]}]

I want to plot a time series so that positive values appear in red and negative values in green.

I have tried all kind of variants of the following, which just plots everything in the last color specified (Green in this case). Also tried with ColorFunction, to no avail.

Maybe it's just me, but I find these trivial plotting issues are some of the most complex and time consuming to figure out in the Wolfram Language.

   DateListPlot[tsData,Joined->False,Filling->Axis,PlotStyle->{If[#>0,Red,Green]&/@tsData["Values"]}]

I want to plot a time series so that positive values appear in red and negative values in green.

I have tried all kind of variants of the following, which just plots everything in the last color specified (Green in this case). Also tried with ColorFunction, to no avail.

Maybe it's just me, but I find these trivial plotting issues are some of the most complex and time consuming to figure out in the Wolfram Language.

tsData = TimeSeries[RandomReal[{-1, 1}, 100], {Range[100]}];

   DateListPlot[tsData,Joined->False,Filling->Axis,PlotStyle->{If[#>0,Red,Green]&/@tsData["Values"]}]
Source Link
MMAUser
  • 409
  • 2
  • 6

Coloring Points in a DateListPlot

I want to plot a time series so that positive values appear in red and negative values in green.

I have tried all kind of variants of the following, which just plots everything in the last color specified (Green in this case). Also tried with ColorFunction, to no avail.

Maybe it's just me, but I find these trivial plotting issues are some of the most complex and time consuming to figure out in the Wolfram Language.

   DateListPlot[tsData,Joined->False,Filling->Axis,PlotStyle->{If[#>0,Red,Green]&/@tsData["Values"]}]