4
$\begingroup$

I have a set of data {x,y,stdev}, and I want to have a SINGLE line joining the data points.

Whenever I put Joined -> True while running ListLogLogPlot, I get all these extraneous lines that I'm not able to deduce where they're originating from.

data3 = {{1.25`*^-7, 6.505`*^-7, 9.1`*^-9}, {1.2499999999999999`*^-6, 0.0000598392`, 8.32`*^-7}, {0.000012499999999999999`, 0.0021682996`, 0.0000290116`}, {0.000125`, 0.0264216604`, 0.0011165428`}, {0.00125`, 0.1169769169`, 0.0015663171`}, {0.012499999999999999`, 0.4577327298`, 0.0107049024`}, {0.125`, 1.8380050695499999`, 0.074451469`}, {1.25`, 5.796026990950001`, 0.4667664415`}, {12.5`, 12.6452287892`, 2.9714758632`}, {125.`, 15.167773831949999`, 3.4492264127`}, {2.5`*^-7, 2.5947`*^-6, 3.6`*^-8}, {2.4999999999999998`*^-6, 0.0001998515`, 2.9297`*^-6}, {0.000024999999999999998`, 0.0051567977`, 0.0000906581`}, {0.00025`, 0.0426349414`, 0.0005633788`}, {0.0025`, 0.1721446492`, 0.0040464007`}, {0.024999999999999998`, 0.664622794`, 0.018272221`}, {0.25`, 2.66528408005`, 0.114312145`}, {2.5`, 7.78070269025`, 0.8960672623`}, {25.`, 14.321022694500002`, 3.6701272203`}, {250.`, 18.893069122900002`, 7.3919788655`}}; ListLogLogPlot[{data3[[;; , 1 ;; 2]]}, Joined -> True] 

When I do this, I get a plot that looks like this enter image description here

And not a single line connecting the data: enter image description here

How do I resolve this issue? Logically I'm not able to see where the additional Joining is coming from that's creating the extra lines.

$\endgroup$

2 Answers 2

4
$\begingroup$

Another idea is to use ListCurvePathPlot, especially if your curve doesn't conform to a function (i.e., there are multiple y-values for a single x-value), although you will have to work a bit to get the desired log scaling. First, here is ListCurvePathPlot on your data:

ListCurvePathPlot[data3[[All, ;;2]]] 

enter image description here

Next, here is how to modify things to get log scaling:

ListCurvePathPlot[ Log[data3[[All, ;;2]]], AxesOrigin -> {Log[10^-7],Log[10^-7]}, Ticks->{Charting`ScaledTicks["Log"],Charting`ScaledTicks["Log"]} ] 

enter image description here

$\endgroup$
3
$\begingroup$

The data set is unsorted and this causes zigzags. Try this:

ListLogLogPlot[SortBy[data3[[;; , 1 ;; 2]], First], Joined -> True] 

enter image description here

$\endgroup$
3
  • $\begingroup$ This solved it - thank you so much! $\endgroup$ Commented Aug 6, 2018 at 0:18
  • 2
    $\begingroup$ Or just ListLogLogPlot[Sort[data3[[;; , 1 ;; 2]]], Joined -> True] $\endgroup$ Commented Aug 6, 2018 at 0:22
  • $\begingroup$ @wiscoYogi You're welcome. $\endgroup$ Commented Aug 6, 2018 at 0:24

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.