Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #12688 > unrolled thread
| Started by | bigchap86 <ross.d.chapman@gmail.com> |
|---|---|
| First post | 2012-12-08 06:28 +0000 |
| Last post | 2012-12-09 15:58 +0000 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
Date Formatting bigchap86 <ross.d.chapman@gmail.com> - 2012-12-08 06:28 +0000
Re: Date Formatting James Choi <sabio@isabio.com> - 2012-12-09 15:58 +0000
Re: Date Formatting azzteke <klaus.giesselmann@web.de> - 2012-12-09 15:58 +0000
| From | bigchap86 <ross.d.chapman@gmail.com> |
|---|---|
| Date | 2012-12-08 06:28 +0000 |
| Subject | Date Formatting |
| Message-ID | <k9umme$sia$1@smc.vnet.net> |
Hello all,
Quick question re: date formatting:
So I've imported a data set externally from Excel with the intent to try to plot a time series graph. Unfortunately, the dates have come in the following format:
Mar-28-2008
When using the DateListPlot function, Mathematica does recognize this date format as a date, as long as you put each data point into the formula individually, and put quotations around them, e.g.:
DataListPlot[{1,2},{"Mar-28-2008", "Apr-03-2009"}] works as a function, BUT if you set {"Mar-28-2008", "Apr-03-2009"}=dates, and use DataListPlot[{1,2},{dates}], it doesn't work.
Anyone have ideas on how to reformat the dates so it works? It appears that there's some sort of disconnect when the dates are entered into a series.
Thanks!
[toc] | [next] | [standalone]
| From | James Choi <sabio@isabio.com> |
|---|---|
| Date | 2012-12-09 15:58 +0000 |
| Message-ID | <ka2ce9$7ft$1@smc.vnet.net> |
| In reply to | #12688 |
Looks like you should remove { } around dates since your dates already have it.
DateListPlot[{1, 2}, date]
You can use DateList function to convert text into a list.
DateList[#] & /@ {"Mar-28-2008", "Apr-03-2009"}
James
[toc] | [prev] | [next] | [standalone]
| From | azzteke <klaus.giesselmann@web.de> |
|---|---|
| Date | 2012-12-09 15:58 +0000 |
| Message-ID | <ka2cfr$7gs$1@smc.vnet.net> |
| In reply to | #12688 |
> When using the DateListPlot function, Mathematica does recognize this date format as a date, as long as you put each data point into the formula individually, and put quotations around them, e.g.:
>
> DataListPlot[{1,2},{"Mar-28-2008", "Apr-03-2009"}] works as a function, BUT if you set {"Mar-28-2008", "Apr-03-2009"}=dates, and use DataListPlot[{1,2},{dates}], it doesn't work.
>
> Anyone have ideas on how to reformat the dates so it works? It appears that there's some sort of disconnect when the dates are entered into a series.
Hello bigchap,
there are a couple of mistakes. Your assignment '{"Mar-28-2008", "Apr-03-2009"}=dates' is wrong - should be: name = value.
Then, DataListPlot[{1,2},{dates}] doesn't work, because (a) the name of the function is to be "DateListPlot" and (b) you put 'dates' in between curly brackets.
Regards
azzteke
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web