1
$\begingroup$

I want to scale the x-axis in the plot by a factor of $\frac{\sqrt{3}}{2}$, When I change the variable in the command:

Plot[f,{Sqrt[3]r/2,0,20}]

I am getting an error as "tag Times in $\frac{\sqrt{3}r}{2}$ is protected"

How to remove this problem?

$\endgroup$
6
  • $\begingroup$ You try to scale the iterator - that doesn't work. Scale the function argument instead... $\endgroup$
    – Yves Klett
    Apr 21, 2016 at 19:01
  • $\begingroup$ That changes the entire problem itself. $\endgroup$
    – vbj
    Apr 21, 2016 at 19:02
  • $\begingroup$ you could scale the x-axis with this: How to assign arbitrary values to frameaxis of a ListDensityPlot $\endgroup$
    – Kay
    Apr 21, 2016 at 19:05
  • 3
    $\begingroup$ maybe ParametricPlot[{Sqrt[3]r/2,f[r]},{r,0,20}] $\endgroup$
    – george2079
    Apr 21, 2016 at 19:07
  • $\begingroup$ @george2079, I used the command suggested but I am not sure whether this corresponds to the problem or not. I will state the problem, $r$ is along horizontal direction, whereas I have calculated the function along a line inclined at $\frac{\pi}{6}$, I want to plot the function along that inclined line. $\endgroup$
    – vbj
    Apr 21, 2016 at 19:32

1 Answer 1

4
$\begingroup$

You could use ReplaceAll (/.) to introduce a scaled variable to plot over.

For example, assuming f implicity depends on r, you could introduce rscaled:

f := Sin[r] + r; (* Example function *)
Plot[f, {r, 0, 20 2/Sqrt[3]}] (* Original Plot *) 
Plot[f /. r -> rscaled 2/Sqrt[3], {rscaled, 0, 20 }] (*Scaled Plot*)

Alternatively, it's simpler if r is an explicit argument. For example,

g[r_] := Sin[r] + r;
Plot[g[rscaled 2/Sqrt[3]], {rscaled, 0, 20 }]
$\endgroup$

Your Answer

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

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