Use Python matplotlib.pyplot to draw a rectangular box

Source: Internet
Author: User

Import Matplotlib.patches as Patches
Import Matplotlib.pyplot as Plt


Ax = Fig.add_subplot (111)
# Draw Rectangle Currentaxis = PLT.GCA ()  #  Gets the current sub-figure x_rect =x_index*tr/480 = (y_index-fft_ 2POW_POINT/2) *fr/= patches. Rectangle (X_rect, Y_rect), target_height*tr/480, Target_weight*fr/fft_2pow_point, linewidth=2, edgecolor='  R', facecolor='none') currentaxis.add_patch (rect) 

The current charts and sub-plots can be obtained using PLT.GCF () and PLT.GCA (),

In the rectangle function (X_rect, Y_rect) represents the starting point of the rectangle (the lower-left corner of the rectangle), target_height*tr/480, Target_weight*fr/fft_2pow_ Point represents the length and width of the rectangle, respectively

For these four parameters, you need to correspond to a known coordinate axis, that is, my horizontal ordinate is known as:

Y_grid, X_grid = Np.meshgrid (Np.linspace (-FR/2, FR/2, Width + 1),                                         480 + 1, endpoint=false))

Facecolor This parameter corresponds to: sets the parameter inside the rectangle box.

Use Python matplotlib.pyplot to draw a rectangular box

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.