2
$\begingroup$

I want to replace the numbers on a framed plot's axes with that number multiplied by a variable, call it x. (The idea is that I'm plotting things which depend on some scale, and I want to show that on the axes, i.e. that I'm plotting these functions with x divided out.)

Here's a minimal example that I've written up:

Plot[a, {a, 0, 1}, 
  Frame -> True, 
  FrameTicks -> 
    {{Partition[Riffle[Range[0, 1, 0.2], (Range[0, 1, 1/5] /. x_Rational :> N[x]) x], 2], None}, 
     {Automatic, None}}]

It does the trick, but the problem is that I need to adjust it each time I change the plot range. What I do is plot the function without the FrameTicks, see which numbers are plotted on the y-axis, and adjust the range accordingly. Is there a way to automate that process?

$\endgroup$
  • 2
    $\begingroup$ Something like this? So you change the range only once.. :) $\endgroup$ – Öskå Jul 19 '14 at 11:38
  • $\begingroup$ Closely related: (5369) $\endgroup$ – Mr.Wizard Jul 19 '14 at 12:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.