Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: PlotMarkers and DateListPlot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg110179] Re: PlotMarkers and DateListPlot
  • From: "M.Roellig" <markus.roellig at googlemail.com>
  • Date: Mon, 7 Jun 2010 08:04:43 -0400 (EDT)
  • References: <hufu00$ecu$1@smc.vnet.net>

On 6 Jun., 12:41, Dan Loewenherz <dloewenh... at gmail.com> wrote:
> Hi all,
>
> I'm trying to use some Graphics elements as markers for data points in
> my DateListPlot. I'm running into an issue where the first element of
> the PlotMarker list is being superimposed on every point in the plot.
> Here is the code which returns
> similarly undesired behavior. Instead of letters, I'm using points.
> Nonetheless, the problem is the same.
>
> The desired behavior is for the points to scale to the values of
> HourlyDataPointCount.
>
> --------8<--------
>
> HourlyAverageCost = {186.8235294117647, 153.28722772277229,
>   148.25412844036697, 147.67576719576721, 148.1043396226415,
>   147.34375, 142.72424242424245, 141.44635627530366,
>   152.81413333333333, 151.30989583333334, 153.04958677685951,
>   153.12459893048128, 163.7921212121212, 184.74429223744292,
>   177.25316455696202, 140.55072463768116, 215.27272727272728,
>   149.90322580645162, 138.625, 94.0, 0, 140.0625,
> 142.44230769230768};
>
> HourlyDataPointCount = {17, 101, 109, 189, 159, 160, 231, 494, 375,
>   384, 242, 187, 165, 219, 158, 69, 11, 31, 8, 1, 0, 16, 52};
>
> Hours = Map[DateString[{2010, 1, 1, #, 0, 0}] &, Array[# &, 23]];
>
> Points = Map[
>  Graphics[{PointSize[Log[#/10 + 0.001]], Point[{0, 0}]}] &,
>  HourlyDataPointCount]
>
> DateListPlot[Transpose[{Hours, HourlyAverageCost}], ImageSize -> 600,
>  LabelStyle -> Directive[FontFamily -> "Helvetica", "Medium"],
>  DateTicksFormat -> {"HourShort", " ", "AMPM"},
>  PlotStyle -> {{Thick, RGBColor[0, 0, 0]}}, Joined -> True,
>  Frame -> False, PlotRange -> {Automatic, {0, 350}},
>  PlotMarkers -> Points]
>
> -------->8--------
>
> Thanks in advance,
> Dan

Hi Dan,

one problem is the size scaling of your PointSize, which produces very
big points.
But the main problem is that providing a list of PlotMarkers means
using one
list element per list of data points, i.e. when you provide one list
of data points
you will only use the first element of the PlotMarkers list. See the
documentation
for a respective example. As I mentioned in a recent post, I would
like the default
behavior to automatically use all elements of a list of PlotMarkers
even if only
one list of data points was provided.
A work around is to split your list of n points into n lists of one
point:

Points = Map[
  Graphics[{PointSize[Log10[#/100 + 0.001]], Point[{0, 0}]}] &,
  HourlyDataPointCount];

DateListPlot[Partition[Transpose[{Hours, HourlyAverageCost}], 1],
 ImageSize -> 600,
 LabelStyle -> Directive[FontFamily -> "Helvetica", "Medium"],
 DateTicksFormat -> {"HourShort", " ", "AMPM"},
 PlotStyle -> {{Thick, RGBColor[0, 0, 0]}}, Joined -> True,
 Frame -> False, PlotRange -> {Automatic, {0, 350}},
 PlotMarkers -> Points]


I also changed your point size scaling a little.

Best, Markus


  • Prev by Date: Re: Push to clipboard?
  • Next by Date: Re: PlotMarkers and DateListPlot
  • Previous by thread: Re: FullSimplify and negative radicands
  • Next by thread: Re: PlotMarkers and DateListPlot