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.

One way to plot a sequence of numbers on a logarithmic number line is this:

LogLogPlot[0, {t, 8, 16}, Axes -> {True, False}, 
 Ticks -> {{8, 9, 10, 11, 12, 13, 14, 15, 16}}]

logarithmic number line values 8 to 16

How can the line be bent into a circle, or how can these values be plotted on a circle?

logarithmic values 8 to 16 on circle

The ParametricPlot function plots a circle around the coordinates when using [{Sin[2 u], Cos[2 u]}, {u, 0, 2 Pi}] and Graphics[Circle[]] draws a circle but I can't figure out how to put Ticks on them.

share|improve this question

4 Answers 4

up vote 4 down vote accepted

Approach with build-in PolarTicks:

PolarPlot[, {x, 0, 1}, PolarAxes -> Automatic, 
  PolarTicks -> Transpose@{π/2 - 2 π Rescale@Log[#], 
    Join[{""}, #[[2 ;; -2]], {ToString@#[[-1]] <> "/" <> ToString@#[[1]]}]}] &@ Range[8, 16]

enter image description here

share|improve this answer
    
Ah, nice that you could use PolarTicks. I've usually found it easier to herd cats than to get PolarTicks to behave the way I want... –  rm -rf Oct 13 '13 at 22:38
set = {8, 9, 10, 11, 12, 13, 14, 15, 16};
logset = Log[set];
resc = 2 Pi Rescale[logset];
f[u_] := {Sin[u], Cos[u]};
markers = Line[{f[#], 1.1 f[#]}] & /@ resc;
labels = MapThread[
   Text[#1, 1.2 f[#2]] &, {set /. {8 -> "16/8", 16 -> ""}, resc}];
Graphics[{Circle[], markers, labels}]

enter image description here

share|improve this answer

It's probably best to ditch ParametricPlot and the like and build your own number line using graphics primitives. The following is my implementation (the code should be pretty easy to follow):

Clear@logCircle
logCircle[pts_] := 
    With[
        {
            θ = 360 Accumulate@Normalize[Differences[Log@pts], Total], 
            coord = {Sin[# Degree], Cos[# Degree]} &
        },
        Graphics[{
            Circle[],
            MapThread[
                Text[
                    If[# == Last@pts, # ~~ "/" ~~ First@pts, #] /. n_?NumericQ :> ToString@n, 
                    1.1 coord@#2
                ] &, 
                {Rest@pts, θ}
            ],
            Map[Line[{coord@#, 1.05 coord@#}] &, θ]
        }]
    ]

logCircle[Range[8, 16]]

share|improve this answer
    
How would your code look using Rescale@logset instead of Accumulate@Normalize[Differences[Log@pts]? –  Bo C. Oct 13 '13 at 10:58
1  
@Bogdan Replace Accumulate@Normalize[...] with Rest@Rescale@Log@pts. Rest of it remains the same, and you can use it with any set of ticks. –  rm -rf Oct 13 '13 at 14:43

(Third version) Here is the code as a function. numlist need not be a Range.

circlog[numlist_] := Block[{a,b}, {a,b} = numlist[[{1,-1}]];
Show[Graphics@{ Circle[{0,0},1],
{Text[If[# == a, SequenceForm[b,"/",a], #], 1.1 #2], Line@{#2, 1.04 #2}}&
@@@ ({#, Through[{Sin,Cos}[2Pi*Log[b/a,#/a]]]}& /@ Most@numlist) },
AspectRatio->Automatic]];
circlog@Range[8,16]

enter image description here

share|improve this answer
    
There's an extra ; at the end of the code. The reason I didn't use Range is that this should work with any sequence of numbers; values 8 to 16 were easy to exemplify in a drawing. How would the code change when using {8, 9, 10, 11, 12, 13, 14, 15, 16}? –  Bo C. Oct 13 '13 at 11:06
    
The ; at the end suppresses the unwanted - Graphics - message that 5.2 prints. I've updated the code to handle non-Range lists. –  Ray Koopman Oct 14 '13 at 8:21
    
There's a & missing before the @@@. Now all I have to do is add another line and write circlog[{8, 9, 10, 11, 12, 13, 14, 15, 16}] –  Bo C. Oct 14 '13 at 10:04
    
Done, as requested. –  Ray Koopman Oct 14 '13 at 15:57

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.