Heatmap Heat Map

Source: Internet
Author: User
Tags add numbers vmin

#!/usr/bin/env python#-*-coding:utf-8-*-ImportNumPy as NPImportPandas as PDImportSeaborn as SNS fromSciPyImportStatsImportMatplotlib as MplImportMatplotlib.pyplot as Plt#Heat Map Heatmapnp.random.seed (0) sns.set () Uniform_data= Np.random.rand (3,3)Print(Uniform_data)#vmin=0.3,vmax=0.6, specifying the minimum and maximum values, center can specify intermediate valuesHeatmap = Sns.heatmap (uniform_data,vmin=0.3,vmax=0.6) plt.show ()#read a copy of the dataFlights = Sns.load_dataset ("Flights")Print(Flights.head ()) Flights= Flights.pivot ("Month"," Year","passengers")Print(flights)#a matrix, the number of passengers more and moreAx =Sns.heatmap (flights)#annot=true means to add numbers into the graph, fmt= "D": is a format, if there is no garbled#linewidths: spacing between squaresAx = Sns.heatmap (flights,annot=true,fmt="D", linewidths=.5) plt.show ()#, CMap: PaletteBX = Sns.heatmap (flights,cmap="Ylgnbu") plt.show ()

Heatmap Heat Map

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.