Group Abstract Group Abstract

Message Boards Message Boards

0
|
4.4K Views
|
4 Replies
|
1 Total Like
View groups...
Share
Share this post:

Plot a ListLinePlot with time stamps?

Posted 7 years ago

enter image description here

I have the following command:

ListLinePlot[Transpose[sampleData[[{2, 18}]]], Frame -> True, 
 PlotRange -> {All, {0, 5000}}, 
 FrameLabel -> {"Latitude (\[Degree])", 
   "\!\(\*SubscriptBox[\(T\), \(e\)]\) (K)"}]

If I want to get the timestamp, which corresponds to sampleData[{1}] for Latitude >40 and Latitude <80, how should the command be rewritten?

I tried,

ListLinePlot[Transpose[sampleData[[{2, 18}]] /; sampleData[[2]] >= 40 && sampleData[[2]] <= 80], Frame -> True, 
PlotRange -> {All, {0, 5000}}, 
FrameLabel -> {"Latitude (\[Degree])", 
"\!\(\*SubscriptBox[\(T\), \(e\)]\) (K)"}]

but it doesn't work.

Thanks

POSTED BY: T P
4 Replies
Posted 7 years ago

enter image description here

Hi Rohit,

Transpose[sampleData[[{1, 2, 15}]]]

{{2014, 11, 1, 1, 1, 0.696}, 21.1056, 248160.}, {{2014, 11, 1, 1, 1, 1.197}, 21.0738, 249216.},..............................

  • Index 1 refers to the timestamp which I must retrieve,
  • index 2 is the x-axis variable which I must retrieve from # >= 40 && # <= 80 & I
  • will also need data from Index 15 and 18

How can I retrieve a list of these data points?

POSTED BY: T P
Posted 7 years ago

If your data looks like this

data = {{{2014, 11, 1, 1, 1, 0.696}, 21.1056, 248160.}, 
        {{2014, 11, 1, 1, 1, 1.197}, 41.0738, 249216.},
        {{2014, 11, 1, 1, 1, 2.197}, 60.0738, 249216.}}

Then this will give the elements where the second index (x value) is in the desired range

Select[data, #[[2]] >= 40 && #[[2]] <= 80 &]
(* {{{2014, 11, 1, 1, 1, 1.197}, 41.0738, 249216.}, {{2014, 11, 1, 1, 1, 2.197}, 60.0738, 249216.}} *)

To get just the timestamp and x value

Most /@ Select[data, #[[2]] >= 40 && #[[2]] <= 80 &]
(* {{{2014, 11, 1, 1, 1, 1.197}, 41.0738}, {{2014, 11, 1, 1, 1, 2.197}, 60.0738}} *)
POSTED BY: Rohit Namjoshi
Posted 7 years ago

Hi Rohit, this worked.

POSTED BY: T P
Posted 7 years ago
POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard