2
$\begingroup$

I want to make a plot similar to LogLinearPlot, but with power of 2 ticks instead of 10 on x axis.

values = {n -> 2^x}
Plot[{Evaluate[f[n] /. values]}, {x, 2, 10}]

How to mark x axis with 2^2, 2^3, ... , 2^10 instead of default 2, 3, ..., 10 ?

$\endgroup$
4
  • 1
    $\begingroup$ It's not really clear what you want. How about this? Plot[{2^x}, {x, 2, 10}, Ticks -> {Range[2, 10], 2^Range[2, 10]}] $\endgroup$
    – akater
    May 8, 2014 at 19:50
  • 2
    $\begingroup$ 1) see the help for Ticks and StandardForm 2) Be careful and don't use names starting with Capital letters ... they are used by Mma itself (See also the help for N[]) $\endgroup$ May 8, 2014 at 19:52
  • $\begingroup$ to belisarius - that is an important note about capital letters, changed N to n to avoid unnecessary confusion. $\endgroup$
    – megasplash
    May 10, 2014 at 9:55
  • $\begingroup$ here is a similar question for ListLogLogPlot $\endgroup$
    – megasplash
    Jul 10, 2014 at 14:31

1 Answer 1

6
$\begingroup$

For illustrative purposes:

DiscretePlot[x, {x, 0, 10}, Frame -> True, 
 FrameTicks -> {Table[{j, 
     Style[Superscript[2, j], ScriptSizeMultipliers -> {0.15}, 
      ScriptBaselineShifts -> {0, 1}]}, {j, 10}], Automatic, None, 
   None}, BaseStyle -> 16, 
 PlotLabel -> "\!\(\*SubscriptBox[\(log\), \(2\)]\)(n)"]

enter image description here

I added the options ScriptSizeMultipliers and ScriptBaselineShifts to illustrate the customizability of appearance (i.e. feel free to play with).

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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