How to define where x axis intercepts y axis

  • Thread starter Thread starter jemma
  • Start date Start date
  • Tags Tags
    Axis
Click For Summary
SUMMARY

To define where the x-axis intercepts the y-axis in a MATLAB bar plot, users can overlay a horizontal line at the desired intercept value. In the discussed example, the x-axis should intercept the y-axis at 0.5, allowing bars above this value to appear above the x-axis and those below to appear below. The MATLAB function bar() is utilized for plotting, and the ylim() function is used to set the y-axis limits. For further guidance, users can refer to the MATLAB documentation on creating plots.

PREREQUISITES
  • Familiarity with MATLAB programming environment
  • Understanding of basic plotting functions in MATLAB
  • Knowledge of y-axis limits using ylim()
  • Ability to overlay graphical elements in MATLAB plots
NEXT STEPS
  • Learn how to use the line() function in MATLAB to overlay horizontal lines
  • Explore advanced plotting techniques in MATLAB for customized visualizations
  • Research MATLAB documentation on bar() and ylim() functions
  • Investigate additional MATLAB plotting options for data representation
USEFUL FOR

Data analysts, MATLAB users, and anyone interested in customizing bar plots for better data visualization.

jemma
Messages
35
Reaction score
0
I want to plot a bar plot using matlab.
For example:

x = [0.4 0.5 0.7 0.2 0.1 0.8]
bar(x)
ylim([0 1])

now I want the x-axis to intercept the y-axis at 0.5 so that any bars >0.5 lie above the x-axis and any bars <0.5 are below.

Is this possible?
Thanks.
 
Physics news on Phys.org
I'd look into overlaying a horizontal line on top of your bar graph:
http://www.mathworks.com/help/techdoc/creating_plots/f10-19972.html#f10-22444
 
Last edited by a moderator:

Similar threads

  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K