python add vertical line in plot

# Basic syntax:
plt.axvline(x_coordinate)

# Example usage:
import matplotlib.pyplot as plt
plt.figure(figsize=(5, 5))
plt.axvline(x=10, ymin=0.10, ymax=0.70, color='b', ls='--', lw=1.5, label='axvline - % of full height')
plt.legend(bbox_to_anchor=(1.0, 1), loc='best')
plt.show()

# Where:
#	- x is the x axis coordinate for the vertical line
#	- ymin is the minimum y-value to show
#	- ymax is the maximum y-value to show
#	- ls is the line style (see also '-', '-.', and ':')
#	- lw is the line width

3.57
7
Lynxear 100 points

                                    xposition = [0.3, 0.4, 0.45]
for xc in xposition:
    plt.axvline(x=xc, color='k', linestyle='--')

3.57 (7 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
python matplotlib add vertical line set vertical line matplotlib matplotlib draw vertical line in plot vertical lines in line plotly python vertical lines in line plot python matplotlib plot draw vertical line vertical line over whole figure pyplot plot a vertical line in python plot vertical lines python how to draw vertical lines on pyplot matplotlib axes add vertical line matplotlib add a vertical line vertical line subplot matplotlib vertical line with value matplotlib matplotlib style that only have vertical line matplotlib vertical line ax add vertical lines from array to plot python matplotlib ax vertical line vertical line plt add a vertical line in python plot vertical line plot in python plot add vertical line python draw vertical line on matplot lib draw vertical line matplot lib add vertical line matplotlib vertical line with label matplotlib add vertical lines to plot python matplotllib vertical line put vertical line on graph matplotlib matplotlib vertical line example vertical line on imshow matplotlib python plot draw a vertical line in 0 add vertical lines matplotlib plot a dtraight vertical line python how to draw a vertical line on plt print vertical line matplotlib matplotlib adding vertical line matlotplib vertical line how to plot a vertical line in python matplotlib add vertical lines matplotlib vertical lline draw a vertical line matplotlib plotly vertical line python matplotlib vertical line instead of a point matplotlib draw vertical line how to plot a vertical line matplotlib vertical line plot python draw vertical lines matplotlib add vertical line pandas plot vertical line python plot vertical line in plot python matplotlib dotted vertival line matplotlib vertical line plot plt. vertical line matplotlib plot straight vertical line how to plot vertical line in matplotlib matplotlib plot vertical lines onto plot how to plot vertical line with pyplot draw vertical line on plot ptyhon matplotlib ax add vertical line matplotlib plot vertical line at point how to add vertical line in matplotlib plot does vertical line instead of line in python matplotlib plot a vertical line matplotlib ad vertical line plot line vertical python matplotlib barplot vertical line plt plot add vertical line add vertical line to plot python python plot vertical line at x plot vertical line to a point python vertical lines matplotlib python pyplot vertical line plt vertical line dashed matplotlib line chart vertical matplot vertical line vertical line python matplotlib plt vertical line matplotlib matplotlib plot vertical line with height add vertical lines to plot matplotlib matplotlib vertical line position matplotlib vertical lin plt vertical lin pyplot verticar line py vertical line draw vertical line in matplotlib horizontal line with matplotlib matplotlib single vartical bar plot a vertical line in matplotlib line style plot python vline draw vertical line in plot python matplotlib multiple vertical lines vertical line on 3rd tick in line graph matplotlib pyplot add multiple verticle line to plot pyplot add verticle line to plot vertical line matplotlib extended to top matplotlib vertical area plt.vlines pyplot plot vertical line draw only vertical bar in python matplotlib vertical line matplotlib subplot matplotlib set vertical line plot vertical lines using a variable matplotlib add vertical line pyplot plot vertical lines matplotlib pyplot plot vertical line matplot lib plot vertical line pyplot draw vertical line matplotlib dashed vertical line matplotlib vertical line2d matplotlib vertical 2dline matplotlib plot add vertical line plot a vertical line python make vertical line matplotlib plot line vertical how to move a vertical line in matplotlib with x value plotting vertical lines matplotlib vertical line chart python add vertical line to bar chart python pyplot vertical lines vertical line graph matplotlib vline plt dashed plot vertical line in python python add vertical line in plot plot vertical lines ymin ymax matplotlib line plot vertical x axis values python matplotlib vertical line of height pypot vertical line add a vertical line in matplotlib vertical line in line plot in python plot vertical line matplotlib plot vertica llines matplotlib plt add vertical line python matplotlib vertical line add vertical line in plt vertical dotted line matplotlib verticle dotted line matplotlib matplotlib vertical line at x matplotlib plot x vertical line vertical line matplotlib plotting vertical lines in python plot vertical line python plt plt vertical line matplotlib vertical lines add vertical line in matplotlib pyplot vertical line vertical dash line in matplotlib matplotlib plot vertical line plt plot a vertical line draw vertical line matplotlib matplotlib add vertical line matplot lib plot lines at x values how to draw vertical line in matplotlib how to add vertical lines on matplotlib at the end when all the line series are added how to make a verticle line as a certain x tick in matplotlib plt plot vertical line how to make vertical line as dashed line in matplotlib draw vertical line plot python plot vertical line python python vertical line python plot vertical line plot a vertical axis python vertical line in barplot python draw red line in matplotlib vertical line python matplotlib vertical line python_plt_vertical_line python plot vertical lines
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source