Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I'm currently trying to use data gathered as a function of time (here, the fluorescence of a biological sample), but am new to Mathematica and don't know how to properly specify axis relations (and units, etc.).

Using ExcelLink 3.5, I've imported the data for one of many drugs whose effect on the fluorescence function I want to analyze. Because of how the information was imported, the listed data I've collected for $f(t)$ is in a list, with no reference to what the independent variable (x-axis) values should be. I made my plot with

ListPlot[{28,32,37,66}]

producing x-axis values of {1, 2, 3, 4} by default, and not t in minutes, which would be {300, 600, 1200, 1440} in my case).

How can I make a plot with the proper x-axis values?

share|improve this question
    
Does your problem of setting the DataRange for ListPlot have anything to do with ExcelLink? If no, please modify your question and title accordingly. –  István Zachar Apr 14 '13 at 10:57
add comment

1 Answer

up vote 3 down vote accepted

If the points were regularly spaced you could use Datarange:

ListPlot[{28, 32, 37, 66}, DataRange -> {300, 1440}]

enter image description here

However, they aren't spaced regularly, so in one way or another you have to specify the x values. Like this, for instance:

ListPlot[Transpose[{{300, 600, 1200, 1440}, {28, 32, 37, 66}}]]

enter image description here

BTW ExcelLink is not really necessary to get data from Excel. Mathematica's Import function can import data in various Excel compatible formats (XLS, XLSX, CSV, TSV).

share|improve this answer
    
That looks useful, however, I need to graph it so that those four data points within ListPlot occur specifically at times {300,600,1200,1440}. I will certainly look through the documentation on DataRange, though! Thank you. I read about that prior to learning of ExcelLink. Do you know of an efficient way to import Excel data that will incorporate the data for both f(t) and t itself? I'm not particular to ExcelLink, I just assumed it was the easiest route. –  Ghersic Apr 13 '13 at 20:32
    
@Ghersic See update –  Sjoerd C. de Vries Apr 13 '13 at 20:37
    
@Ghersic Your question seemed to imply that you only had access to the y-values. If the t values are on the same sheet you can do a simple Import (type XLS or XLSX in the doc center search bar) and get the columns that contain the data from the result using the usual list manipulating functions‌​. –  Sjoerd C. de Vries Apr 13 '13 at 20:41
    
Thanks. I do have access to both the y- and t-data. I will try doing this using Import command, extracting the lists from the rows, and inputting the ListPlot command in the format you laid out in your original answer. This does sound simpler than using ExcelLink. –  Ghersic Apr 13 '13 at 20:46
    
Seems all I have to do now is figure out why exactly Transpose[] is necessary here (rather than just switching the two lists) and to figure out which importation feature I prefer. Thanks for your help, @Sjoerd. –  Ghersic Apr 13 '13 at 21:12
show 4 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.