Matplotlib plot Add Table instance code, matplotlib plot

Source: Internet
Author: User

Matplotlib plot Add Table instance code, matplotlib plot

The code shown in this article mainly uses Python + matplotlib to plot and add tables to the graph.

Code
Import matplotlib. pyplot as pltimport numpy as npplt. figure () ax = plt. gca () y = np. random. randn (9) col_labels = ['col1', 'col2', 'col3'] row_labels = ['row1', 'row2', 'row3'] table_vals = [[11, 12, 13], [, 23], [28, 29, 30] row_colors = ['red', 'gold', 'green'] my_table = plt. table (cellText = table_vals, colWidths = [0.1] * 3, rowLabels = row_labels, colLabels = col_labels, rowColours = row_colors, colColours = row_colors, loc = 'best') plt. plot (y) plt. show ()
Demo

Code testing is effective, so you can rest assured to refer to it.

Summary

The above is all about the code for adding a table instance using matplotlib. I hope it will be helpful to you. If you are interested, you can continue to refer to other related topics on this site. If you have any shortcomings, please leave a message. Thank you for your support!

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.