Group Abstract Group Abstract

Message Boards Message Boards

Plot data imported from an Excel file?

Posted 8 years ago
Attachments:
POSTED BY: Azad Kaygun
6 Replies

It is meant to translate the dates as strings, for example "10.12.2015", into Mathematica dates. You may avoid this cleanup if, instad of Import, you used SemanticImport, but I am not familiar with that command.

POSTED BY: Gianluca Gorni

What's the meaning of this part?

/. {dt_String, 
     numbers__?
      NumericQ} :> {DateObject[{dt, {"Day", ".", "Month", ".", 
        "Year"}}], numbers};
POSTED BY: Gianluigi Salvi
Posted 8 years ago

Thank you so far, now I got the Issue that i need three different graphs for wind, solar, and last how can I arrange that? Besides I need a graphic for every year and not all together

POSTED BY: Azad Kaygun

You can control the time range with PlotRange. For example

data = {{{2006, 10, 1}, 10}, {{2006, 10, 15}, 12}, {{2006, 10, 30}, 
    15}, {{2006, 11, 20}, 20}};
DateListPlot[data]
DateListPlot[data, 
 PlotRange -> {{{2006, 10, 1}, {2006, 10, 30}}, All}]

Your records are made of quadruples of the form {time, v2, v3, v4}. You can plot v2, v2, v4 separately against time:

DateListPlot[cleanedData[[All, {1, 2}]]]
DateListPlot[cleanedData[[All, {1, 3}]]]
DateListPlot[cleanedData[[All, {1, 4}]]]
POSTED BY: Gianluca Gorni
Posted 8 years ago
POSTED BY: Jim Baldwin

First you import the file into mathematica as

myData = Import["file path"]

Then you clean up the data, for example with

cleanedData = 
  myData[[1, 3 ;; -1]] /. {dt_String, 
     numbers__?
      NumericQ} :> {DateObject[{dt, {"Day", ".", "Month", ".", 
        "Year"}}], numbers};

Then you can plot with DateListPlot:

DateListPlot[cleanedData[[All, {1, 3}]]]
POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard