About 1,630,000 results
Open links in new tab
  1. python - Plot a horizontal line on a given plot - Stack Overflow

    Use axhline (a horizontal axis line). For example, this plots a horizontal line at y = 0.5: If you want to draw a horizontal line in the axes, you might also try ax.hlines() method. You need to …

  2. matplotlib.axes.Axes.axhline — Matplotlib 3.10.3 documentation

    Add horizontal lines in data coordinates. axhspan. Add a horizontal span (rectangle) across the axis. axline. Add a line with an arbitrary slope.

  3. Plot a Horizontal line in Matplotlib - GeeksforGeeks

    Apr 2, 2025 · axhline() function is useful when you need to draw a horizontal line that spans the entire width of the plot, regardless of the x-axis limits. It is commonly used to mark thresholds, …

  4. Plot Horizontal Line in Matplotlib - Matplotlib Color

    May 26, 2024 · You can create subplots in Matplotlib and draw horizontal lines in each subplot to compare different datasets or visualize multiple variables simultaneously. Here is an example …

  5. How To Plot Vertical And Horizontal Lines in Matplotlib

    Jan 9, 2023 · In this tutorial, we will demonstrate how to use matplotlib functions to plot vertical and horizontal lines in an existing plot. We will also discuss some of the options and …

  6. 3 Convenient Methods to Plot a Horizontal or Vertical Line

    Jun 24, 2023 · In this tutorial, we will explore three different methods to achieve this using Matplotlib: the ‘axhline’ and ‘axvline’ functions, the ‘plot’ function, and the ‘hlines’ and ‘vlines’ …

  7. How to Plot Horizontal Line in Python - Delft Stack

    Feb 2, 2024 · We will introduce how to create a horizontal line in Python. We will also introduce the Matplotlib library in Python. A horizontal line is any straight line that drives from left to right …

  8. How to Add Horizontal Lines to Your Python Plots

    Apr 26, 2025 · Pandas plots are essentially built on Matplotlib, so we can directly use plt.axhline() to add a horizontal line to a Pandas plot. You can further customize the horizontal line by: …

  9. Horizontal line matplotlib - Python Guides

    Oct 26, 2021 · The syntax to create horizontal grid lines: matplotlib.axis.YAxis.grid() This method is used to draw horizontal lines only. Let’s see an example: # Import Library import …

  10. Creating and Customizing Horizontal Lines in Matplotlib

    The `axhline` and `hlines` functions in Matplotlib make it easy to add and customize horizontal lines in your plots. This tutorial will guide you through various ways to use and customize …

  11. Some results have been removed
Refresh