# ListLogLinearPlot

I have a table of data containing four columns

0. 4.246579091762123e-6 0.03265347837226368 2.194410478609251
1. -0.12938661984768404 0.16521412970349758 1.856296278715755
2. -0.6524263619026305 1.317312564309627 2.4581977984322188
3. -1.481025225749298 1.5601344096178906 2.437032682967227
4. -0.8045597481535853 1.5245713778727028 1.9797559186772764
5. -0.3300249450506991 2.180177753839574 3.0821864146136346

I need to take the log of this table and plot the last columns against the 1st one. I have come across ListLogLinearPlot which, I believe works as ListLinePlot somehow. However, I could not get the desired result.

The above table is in a .dat file and I used the below-mentioned code:

data1 = Import[".../Data.dat", "Table"]
ListLinePlot[{data1[[All, {1, 2}]], data1[[All, {1, 3}]],data1[[All, {1, 4}]]}]

ListLogLinearPlot[{data1[[All, {1, 2}]], data1[[All, {1, 3}]],data1[[All, {1, 4}]]}]


Could someone tell me can this process works? If yes, then how to make it work?

• ListLogLinearPlot is logarithmic on the x axis where values in your table are negative. Commented Mar 13, 2022 at 3:25
• After reading the answer by @BobHanlon it is not clear to me if you had problems with Export and Import or manipulating the specific set of data. If the latter is the case, please let me know so I can delete my answer at it is irrelevant. Many thanks!
– user49048
Commented Mar 13, 2022 at 5:44
• I didn't have a problem with importing the data file, however, you showed an alternative way without manually giving the address of the location. Thank you for that Commented Mar 13, 2022 at 6:10
– user49048
Commented Mar 13, 2022 at 6:11

$Version (* "13.0.1 for Mac OS X x86 (64-bit) (January 28, 2022)" *) Clear["Global*"] data = {{0., 4.246579091762123*^-6, 0.03265347837226368, 2.194410478609251}, {1., -0.12938661984768404, 0.16521412970349758, 1.856296278715755}, {2., -0.6524263619026305, 1.317312564309627, 2.4581977984322188}, {3., -1.481025225749298, 1.5601344096178906, 2.437032682967227}, {4., -0.8045597481535853, 1.5245713778727028, 1.9797559186772764}, {5., -0.3300249450506991, 2.180177753839574, 3.0821864146136346}}; ListLinePlot[ data[[All, {1, #}]] & /@ {2, 3, 4}, PlotLegends -> (StringForm["Column ", #] & /@ {2, 3, 4})]  On a log scale you cannot plot the first point of each curve since Log[0] evaluates to -Infinity ListLogLinearPlot[ data[[All, {1, #}]] & /@ {2, 3, 4}, PlotLegends -> (StringForm["Column ", #] & /@ {2, 3, 4}), Joined -> True]  Alternatively, you can drop the first column and default the data range to {1, 6} ListLogLinearPlot[ data[[All, #]] & /@ {2, 3, 4}, PlotLegends -> (StringForm["Column ", #] & /@ {2, 3, 4}), Joined -> True]  • How about axes? They should not be the same as before as we are taking log of the data. How to correct the axes? Commented Mar 18, 2022 at 10:57 • For a LogLinearPlot or its List equivalent, the Log is of the x variable rather than the y. Note that the spacing on the x-axis is not uniform. Because the range is limited, the difference is limited. Commented Mar 18, 2022 at 13:55 I am not quite sure how you exported your data, so below I am showing you one way that works. Quit[]$Version


"12.0.0 for Linux x86 (64-bit) (April 7, 2019)"

I have saved the notebook on my desktop, so when I run

SetDirectory[NotebookDirectory[]]


I get

"/home/mylaptop'sname/Desktop"

I am exporting in the following way. I used the same name as you did. This creates a file Data.dat on my Desktop -note I did not know what to export, so I picked some random functions.

Export["Data.dat", Table[{n, 2 n, 4 n, 6 n}, {n, 30}]]


Now we want to import in the notebook

First we

Quit[]


now we import our data

data1 = Import[NotebookDirectory[] <> "Data.dat"];


and we can check what we did

data1


gives

{{1, 2, 4, 6}, {2, 4, 8, 12}, {3, 6, 12, 18}, {4, 8, 16, 24}, {5, 10, 20, 30}, {6, 12, 24, 36}, {7, 14, 28, 42}, {8, 16, 32, 48}, {9, 18, 36, 54}, {10, 20, 40, 60}, {11, 22, 44, 66}, {12, 24, 48, 72}, {13, 26, 52, 78}, {14, 28, 56, 84}, {15, 30, 60, 90}, {16, 32, 64, 96}, {17, 34, 68, 102}, {18, 36, 72, 108}, {19, 38, 76, 114}, {20, 40, 80, 120}, {21, 42, 84, 126}, {22, 44, 88, 132}, {23, 46, 92, 138}, {24, 48, 96, 144}, {25, 50, 100, 150}, {26, 52, 104, 156}, {27, 54, 108, 162}, {28, 56, 112, 168}, {29, 58, 116, 174}, {30, 60, 120, 180}}

And now in order to do the plots you mentioned

ListLinePlot[{data1[[All, {1, 2}]], data1[[All, {1, 3}]],
data1[[All, {1, 4}]]}]

ListLogLinearPlot[{data1[[All, {1, 2}]], data1[[All, {1, 3}]],
data1[[All, {1, 4}]]}]


I hope it's clear

• How about axes? They should not be the same as before as we are taking log of the data. How to correct the axes? Commented Mar 18, 2022 at 10:57
• @user84456 please take a closer look at the plots. ListLogLinearPlot has a Log` x-axis
– user49048
Commented Mar 18, 2022 at 19:18