How to Rescale the Horizontal Axis in Mathematica?

In summary, the conversation revolves around using simple Mathematica commands to plot a function and then rescale the horizontal axis of the resulting graph. The desired outcome is to have the horizontal axis start at 25 instead of 0 and end at 35 instead of 10, without changing the position or value of the plotted function. Possible solutions include using the Ticks option or adjusting the function itself.
  • #1
Anna Kaladze
35
0
Hi All,

I have some simple Mathematica commands:

f[x_]=x^2+3*x-1

Plot[f[x],{x,0,10}]

Now, I need to "rescale" the horizontal axis of the resulting graph, so that number 25 is added to its value (i.e., the horizontal axis would take the starting value 25 (in place of 0) and 35 (in place of 10), and everything in between similarly. I do not want the position/value of the f[x] itself change. How do I achieve that?

Thanks a lot.

Anna.
 
Physics news on Phys.org
  • #2
I am guessing a little bit here about what you want.

Try this
f[x_]:=x^2+3*x-1;Plot[f[x],{x,-5,5}]

Then try this
Plot[f[x],{x,-5,5},Ticks->{{{-4,21},{-2,23},{2,27},{4,29}},Automatic}]

and see if that is what you are asking for
 
  • #3
Try:
Plot[f[x-25],{x,25,35}]
 

Related to How to Rescale the Horizontal Axis in Mathematica?

1. What is axis rescaling in Mathematica and why is it important?

Axis rescaling in Mathematica is a technique used to adjust the scale of the axes in a plot or graph. This is important because it allows for a more accurate representation of the data and can help to better visualize the relationship between variables.

2. How do I rescale the x-axis in Mathematica?

To rescale the x-axis in Mathematica, you can use the PlotRange option in the Plot or ListPlot function. For example, you can specify the range of the x-axis as PlotRange -> {{xmin, xmax}, Automatic} to adjust the minimum and maximum values of the x-axis.

3. Can I rescale both the x-axis and y-axis in a single plot?

Yes, you can rescale both the x-axis and y-axis in a single plot by specifying the range for each axis in the PlotRange option. For example, PlotRange -> {{xmin, xmax}, {ymin, ymax}} will adjust the ranges for both axes.

4. How can I change the scale of the axes from linear to logarithmic in Mathematica?

You can change the scale of the axes from linear to logarithmic by using the ScalingFunctions option in the Plot or ListPlot function. For example, ScalingFunctions -> "Log" will change the scale of the axis to logarithmic.

5. Is there a way to automatically rescale the axes in Mathematica?

Yes, you can use the Automatic option in the PlotRange option to automatically rescale the axes based on the range of the data. Additionally, you can use the Automatic option in the ScalingFunctions option to automatically adjust the scale of the axes based on the data.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
331
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
290
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
951
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
2K
Back
Top