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.

So I've been trying to import a large set of data (6900 point pairs) from an excel (.xls) file. The Exel file has 2 columns of numeric data. I've also been trying to plot this data, but when I do, it won't allow me to alter my DataRange.

Here is a simplified version of my code:

Subscript[Elliptical\[ScriptCapitalL], \[Nu]] = 
 Import["EllipticalGalaxy.xls"][[3]]

ListPlot[Subscript[Elliptical\[ScriptCapitalL], \[Nu]], 
 DataRange -> {0, 10000}]

Actually, no matter which DataRange I specify, this will not alter the plot (i.e. the default way it is plotting doesn't even include all my points).

My fix for this was to use PlotRange, instead, which actually works, UNLESS I use ListLogLinearPlot (or ListLogLogPlot, or ListLogPlot).

Here is another sample of my code when I replace ListPlot with ListLogLinearPlot:

ListLogLinearPlot[Subscript[Elliptical\[ScriptCapitalL], \[Nu]], 
 PlotRange -> {{0, Log[10000]}, {0, 1}}]

This will alter the range of the plot, but not the domain...

My 2 questions are:

1) Why won't DataRange work?

2) Why won't PlotRange work for the logarithmic axis?

share|improve this question
1  
PlotRange and DataRange serve different purposes. The first is to control how much to plot, wheras the second is to relabel the x index. Reading up on both of these in the docs will make things clearer –  rm -rf Sep 30 '12 at 5:29
    
I understand that, but I haven't been using them simultaneously. –  Atreyu Sep 30 '12 at 5:32
    
There's nothing wrong with using them simultaneously. You should include a minimal example, because we don't have your xls file –  rm -rf Sep 30 '12 at 5:34
    
ListLogLinearPlot[{{0, 1}, {1, 2}, {2, 3}, {3, 4}}, PlotRange -> {{0, Log[2]}, {0, 3.7}}] The x axis won't change its x values in this case... I'm clearly a beginner =P –  Atreyu Sep 30 '12 at 5:41
    
Same for ListPlot[{{0, 1}, {1, 2}, {2, 3}, {3, 4}}, DataRange -> {0, 2}], the data range remains from 0 to 3, no matter which values I enter for DataRange –  Atreyu Sep 30 '12 at 5:52

1 Answer 1

Your PlotRange starts at 0 on the log axis and that's preventing MMa from evaluating it. MMa is falling back to Automatic when you are using a 0 on a log scale. Use for example 0.5

ListLogLinearPlot[{{0, 1}, {1, 2}, {2, 3}, {3, 4}}, Joined -> True, 
 PlotRange -> {{0.5, Log[20]}, {0, 3.7}}]

or similar.

I don't know what your data looks like but if you got {x, y} data point pairs then DataRange makes no sense with ListPlot. DataRange is used when you only have y-values and want to set their x range. In 3D this is the same for ListContourPlot when you have {x, y} pairs you can set their range.

share|improve this answer
    
This still doesn't change anything for me... but thank you for the comment on DataRange. –  Atreyu Sep 30 '12 at 7:05
    
Using Show gives the right plot range for me, but there's still a few quirks you need to work around, which I'm still unsure of... –  Atreyu Sep 30 '12 at 8:02
2  
@Atreyu Maybe it would help if you could provide some of your data points, say 10 to 20 so we can work with data you are using. What are the quirks? –  Matariki Sep 30 '12 at 8:09

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.