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$ Commented Apr 21, 2016 at 19:01
  • $\begingroup$ That changes the entire problem itself. $\endgroup$ Commented 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$ Commented Apr 21, 2016 at 19:05
  • 3
    $\begingroup$ maybe ParametricPlot[{Sqrt[3]r/2,f[r]},{r,0,20}] $\endgroup$ Commented 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$ Commented 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$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.