How to Rescale the X-Axis in Mathematica?

  • Context: Mathematica 
  • Thread starter Thread starter olietc
  • Start date Start date
  • Tags Tags
    Mathematica
Click For Summary

Discussion Overview

The discussion revolves around how to rescale the x-axis in Mathematica plots, specifically when plotting a function with respect to a variable T. Participants explore different methods to achieve the desired axis labeling and scaling.

Discussion Character

  • Technical explanation
  • Mathematical reasoning

Main Points Raised

  • One participant seeks assistance in plotting a function with an x-axis that displays values from 0 to 3 instead of 0 to 30, with the intention of labeling the axis as T/10.
  • Another participant suggests using the Plot function with a modified range and axes label: Plot[function, {x, 0, 3}, AxesLabel -> {T/10, y-label}].
  • A third participant provides a function with zeros at specific points and demonstrates two methods to change the x-axis units to x/10, using either a transformation of the function or custom ticks.
  • A later reply expresses appreciation for one of the proposed methods, noting its effectiveness in keeping the function unchanged while achieving the desired axis scaling.

Areas of Agreement / Disagreement

Participants appear to agree on the need for rescaling the x-axis, but multiple methods are presented without a consensus on a single best approach.

Contextual Notes

Some methods depend on specific definitions of the function and the desired appearance of the plot, which may not be universally applicable.

olietc
Messages
2
Reaction score
0
Hi guys
I am trying to plot a function with respect to T, but I want to rescale my axis.
For example my range right now shows 0, 10, 20, 30. But I want it to show 0, 1, 2, 3 and so that I can then put an x-axis label of T/10.
Can anyone help?
 
Physics news on Phys.org
Try with:

Plot[function, {x, 0, 3}, AxesLabel -> {T/10, y-label}]
 
Here's a function that has zeros at x=10 and x=20.
Code:
f[x_]:=(x-10)(x-20)
and it's normal plot
Code:
Plot[f[x],{x,0,30},AxesLabel->{x,f}]

Here's two different ways to change the x-axis units to x/10:
Code:
Plot[f[10x],{x,0,3},AxesLabel->{x/10,f}]
Code:
Plot[f[x],{x,0,30},Ticks->{Table[{i,i/10.},{i,0,30,5}],Automatic},AxesLabel->{x/10,f}]
 
Thanks so much!
I like that last option Simon_Tylor, it keeps the function the same. Up until now the only thing I could think of was changing the x inside the function like you did in your first example..
 
Not a problem olietc!
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 18 ·
Replies
18
Views
5K
  • · Replies 5 ·
Replies
5
Views
2K