Changing the scale of the y-axis

  • MATLAB
  • Thread starter EngWiPy
  • Start date
  • Tags
    Scale
In summary, the individual is asking if it is possible to change the scale of the y-axis on a figure in Octave to capture more details. They provide an example of wanting to change the scale from 1, 0.8, 0.6, 0.4, 0.2, 0 to 0.4, 0.1, 0.01, 0.001, 0.0001, ... after a certain point. They have tried using the command "set(gca,'ytick',[my_ticks])" but it did not achieve the desired result. Another individual suggests using semilogy() to achieve a log scale on the y-axis, or manually rescaling the data and
  • #1
EngWiPy
1,368
61
Hi,

I am using Octave to do simulations. I have multiple curves in the same figure. I want to change the scale of y-axis after some point to capture more details. For example, the default y-ticks are 1, 0.8, 0.6, 0.4. 0.2, 0. Between 1 and 0.4 the default scale is good for my curves, but between 0.4 and 0, I want to change the scale to 0.4, 0.1, 0.01, 0.001, 0.0001, ... Can I do that on the same figure or I have to separate the curves?

Thanks
 
Physics news on Phys.org
  • #2
I tried

Code:
set(gca,'ytick',[my_ticks])

but this doesn't change the scale. Rather, it keeps the same distance between the default ticks, and add more ticks near the zero. I want to change the distance between the ticks below 0.4.
 
  • #3
Not precisely what you asked for but maybe near enough: use a log scale on the y axis. To do this, replace plot(...) by semilogy(...).
 
  • Like
Likes FactChecker and EngWiPy
  • #4
semilogy() is a nice way because it achieves the result while also "smoothly" varying the scale in some commonly understood way.

A more involved way would be to rescale your data however you see fit and then relabel the axis tick marks accordingly.
 
  • Like
Likes EngWiPy and FactChecker
  • #5
If you simply call

Code:
ax = gca;

You get a handle to the axes object in the figure. You can then modify the properties of the object to do almost anything you want. See the documented properties of the object here. YScale can change the scale of the y-axis to log, YTick sets the tick values, etc...
 
  • Like
Likes EngWiPy

Related to Changing the scale of the y-axis

1. Why is changing the scale of the y-axis important in scientific research?

The scale of the y-axis is important in scientific research because it allows for accurate measurement and interpretation of data. By adjusting the scale, we can better visualize and understand the relationship between variables and make more informed conclusions.

2. How do you determine the appropriate scale for the y-axis?

The appropriate scale for the y-axis should be determined based on the range and distribution of the data. It should be evenly spaced and include all data points. It is also important to consider the purpose of the graph and what information needs to be conveyed to the audience.

3. Can changing the scale of the y-axis manipulate the interpretation of data?

Yes, changing the scale of the y-axis can manipulate the interpretation of data if it is not done carefully. By altering the scale, the relationship between variables can appear to be stronger or weaker than it actually is. Therefore, it is important to clearly label the scale and explain any changes made in the graph.

4. Are there any limitations to changing the scale of the y-axis?

Yes, there are limitations to changing the scale of the y-axis. It can only provide a visual representation of data and does not change the actual values. Additionally, changing the scale too drastically can make it difficult to compare data between different graphs or studies.

5. How often should the scale of the y-axis be changed in a scientific study?

The scale of the y-axis should only be changed if necessary to accurately represent the data. It is important to carefully consider and justify any changes made to the scale in order to avoid misleading interpretations. In general, it is best to keep the scale consistent throughout a study to maintain consistency and integrity of the data.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
789
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
5K
  • Introductory Physics Homework Help
Replies
18
Views
723
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
3K
  • Set Theory, Logic, Probability, Statistics
Replies
9
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
3K
  • Programming and Computer Science
Replies
12
Views
1K
Back
Top