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

MathGroup Archive 2010

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

Search the Archive

Re: Labeling points on ListPlot - Transform string date element in list of tripes

  • To: mathgroup at smc.vnet.net
  • Subject: [mg106506] Re: [mg106488] Labeling points on ListPlot - Transform string date element in list of tripes
  • From: "David Park" <djmpark at comcast.net>
  • Date: Fri, 15 Jan 2010 03:16:24 -0500 (EST)
  • References: <1321194.1263468925111.JavaMail.root@n11>

Something like this, but you might want to select and massage the point
labels.

{lldates, llpoints} =
  Transpose[
   lunarlibrationdatepoints /. {date_String, x_,
      y_} :> {StringTake[date, 10], {x, y}}];

lldates2 = DateString[#,{"DayNameShort"," ","Day"}]& /@ lldates //Quiet;

Graphics[
 {Line[lunarlibrationpoints],
  AbsolutePointSize[5],
  Point /@ llpoints,
  MapThread[Text[#1, #2, {-1.5, 0}] &, {lldates2, llpoints}]},
 PlotRangePadding -> 1.5,
 Frame -> True,
 FrameLabel -> {subEarthLongitude, subEarthLatitude},
 BaseStyle -> {FontSize -> 12},
 ImageSize -> 500]

You don't need ListPlot, and a Frame is better than an Axes plot. There is a
problem in the overwriting of some of the dates. If this was to be viewed in
a notebook you could use Tooltips. Otherwise you need more selective points,
and maybe a table for accurate data.

Graphics[
 {Line[lunarlibrationpoints],
  AbsolutePointSize[5],
  MapThread[Tooltip[Point[#2], #1] &, {lldates2, llpoints}],
  Text["Points at Midnight\n15 Jan 2010 to 14 Feb 2010", {-7,
    5.5}, {-1, 0}]},
 PlotRangePadding -> 1.5,
 Frame -> True,
 FrameLabel -> {subEarthLongitude, subEarthLatitude},
 BaseStyle -> {FontSize -> 12},
 ImageSize -> 500]

David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/ 


From: Canopus56 [mailto:canopus56 at yahoo.com]

I have a date ordered set of lunar libration points for the coming lunar
month, list "lunarlibrationpoints" - a subset of list
"lunarlibrationdatepoints" - which is plotted with:

ListPlot[lunarlibrationpoints,
 AxesLabel -> {subEarthLongitude, subEarthLatitude}, Joined -> True ]   

Q1. - How do I label the points on the foregoing plot with label tags like a
date or text (e.g. "01-21-2010", "New", "1st Qtr", "Full", "3rd Qtr")

The list "lunarlibrationdatepoints" can be imported with:

lunarlibrationdatepoints = Import["Librationdatepoints.csv", "Data"]

- where the csv file contains date string dates and x-y points in the form:

01/15/2010 00:00, 1.88531, -0.05868

- which imports the date as a string.

Q2. How do a transform the date string elements in an array into a new array
with the date-times recognized in date format?

Thanks in advance, Kurt

Appended:  lunarlibrationpoints, lunarlibrationdatepoints

lunarlibrationpoints = {{1.88531`, -0.05868`}, {1.48071`, -0.48333`}, \
{0.51372`, -1.46487`}, {-0.89192`, -2.80368`}, {-2.29053`, \
-4.02242`}, {-3.63769`, -5.07292`}, {-4.88443`, -5.91182`}, \
{-5.97681`, -6.50049`}, {-6.85651`, -6.80485`}, {-7.46284`, \
-6.79571`}, {-7.63154`, -6.68184`}, {-7.7365`, -6.45045`}, \
{-7.62541`, -5.75668`}, {-7.09256`, -4.71852`}, {-6.12555`, \
-3.36477`}, {-4.74635`, -1.75715`}, {-3.01874`, 0.00579`}, {-1.05013`,
    1.79374`}, {-0.51078`, 2.24904`}, {1.01573`, 3.46133`}, {3.0159`,
   4.87283`}, {4.79227`, 5.92584`}, {6.21539`, 6.56454`}, {7.2008`,
   6.77939`}, {7.71399`, 6.5966`}, {7.76689`, 6.0715`}, {7.76517`,
   6.06435`}, {7.39809`, 5.24102`}, {6.6774`, 4.1876`}, {5.67751`,
   2.96399`}, {4.4741`, 1.62811`}, {3.13841`,
   0.23621`}, {1.73383`, -1.15655`}, {0.31436`, -2.49586`}, \
{-1.07546`, -3.72878`}, {-1.23675`, -3.86572`}, {-2.39938`, \
-4.80488`}}

lunarlibrationdatepoints = {{"01/15/2010 00:00",
   1.88531`, -0.05868`}, {"01/15/2010 07:11",
   1.48071`, -0.48333`}, {"01/16/2010 00:00",
   0.51372`, -1.46487`}, {"01/17/2010 00:00", -0.89192`, -2.80368`}, \
{"01/18/2010 00:00", -2.29053`, -4.02242`}, {"01/19/2010 00:00", \
-3.63769`, -5.07292`}, {"01/20/2010 00:00", -4.88443`, -5.91182`}, \
{"01/21/2010 00:00", -5.97681`, -6.50049`}, {"01/22/2010 00:00", \
-6.85651`, -6.80485`}, {"01/23/2010 00:00", -7.46284`, -6.79571`}, \
{"01/23/2010 10:53", -7.63154`, -6.68184`}, {"01/24/2010 00:00", \
-7.7365`, -6.45045`}, {"01/25/2010 00:00", -7.62541`, -5.75668`}, \
{"01/26/2010 00:00", -7.09256`, -4.71852`}, {"01/27/2010 00:00", \
-6.12555`, -3.36477`}, {"01/28/2010 00:00", -4.74635`, -1.75715`}, \
{"01/29/2010 00:00", -3.01874`,
   0.00579`}, {"01/30/2010 00:00", -1.05013`,
   1.79374`}, {"01/30/2010 06:18", -0.51078`,
   2.24904`}, {"01/31/2010 00:00", 1.01573`,
   3.46133`}, {"02/01/2010 00:00", 3.0159`,
   4.87283`}, {"02/02/2010 00:00", 4.79227`,
   5.92584`}, {"02/03/2010 00:00", 6.21539`,
   6.56454`}, {"02/04/2010 00:00", 7.2008`,
   6.77939`}, {"02/05/2010 00:00", 7.71399`,
   6.5966`}, {"02/05/2010 23:45", 7.76689`,
   6.0715`}, {"02/06/2010 00:00", 7.76517`,
   6.06435`}, {"02/07/2010 00:00", 7.39809`,
   5.24102`}, {"02/08/2010 00:00", 6.6774`,
   4.1876`}, {"02/09/2010 00:00", 5.67751`,
   2.96399`}, {"02/10/2010 00:00", 4.4741`,
   1.62811`}, {"02/11/2010 00:00", 3.13841`,
   0.23621`}, {"02/12/2010 00:00",
   1.73383`, -1.15655`}, {"02/13/2010 00:00",
   0.31436`, -2.49586`}, {"02/14/2010 00:00", -1.07546`, -3.72878`}, \
{"02/14/2010 02:51", -1.23675`, -3.86572`}, {"02/15/2010 00:00", \
-2.39938`, -4.80488`}}








  • Prev by Date: Re: trouble with a Binet in a generalized Pell recursion
  • Next by Date: Re: Trouble with coupled quadratic equations where the
  • Previous by thread: Re: Labeling points on ListPlot - Transform string date element in list of tripes
  • Next by thread: Trouble with coupled quadratic equations where the solutions are degenerate/symmetric