Create heatmaps with Python, pandas, seaborn I wrote the following code as a reference.
import seaborn as sns import pandas as pd import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt fig, axes = plt.subplots (nrows = 2, ncols = 3, figsize = (10, 10)) list_2d = [[0, 1, 2], [3, 4, 5]] arr_2d = np.arange (-8, 8) .reshape ((4, 4)) sns.heatmap (list_2d, ax = axes [0, 0]) sns.heatmap (arr_2d, ax = axes [1, 2])
When executed, the following image was output.
However, this rectangular image is very disturbing. (The rectangular image here is
4 rectangles with empty margins and their values. )
Is there a way to display 2 rows and 3 columns without displaying this rectangular image?
I'm sorry to tell you.
Answer # 1
Axes instance.axis ("off")
matplotlib.axes.Axes.axis — Matplotlib 3.1.0 documentation
Make the axes white with matplotlib (hide the x-axis and y-axis and hide them)-quiet name (拙 Article)
For question text code,
for ax in axes.ravel () [1: -1]: ax.axis ("off")
Try adding somewhere (before the result is output).
Answer # 2
This is an answer after understanding "this rectangle" as a color bar.
fig, axes = plt.subplots (nrows = 2, ncols = 3, figsize = (10, 10)) list_2d = [[0, 1, 2], [3, 4, 5]] arr_2d = np.arange (-8, 8) .reshape ((4, 4)) sns.heatmap (list_2d, ax = axes [0, 0], cbar = False) sns.heatmap (arr_2d, ax = axes [1, 2], cbar = False)
- i want to output multiple lines of html code using python
- python - when i use a variable in dfquery (), it is not output
- python - i want to combine split images
- python - i want to join all the matrices output by the while statement horizontally
- i want to combine split images using cv2 (python)
- python - i want to find the standard deviation of the output result
- to get the same output without using python dict
- i want to create a for statement to output the day of the week in python
- python 3x - i want to output the python3 ping result to csv
- python - i want to delete all the images (* jpg) on my drive
- python - i want to perform the same process for multiple xlsx files in a folder and save them with "_aggregate" at the
- python - i want to compare images and find the same image
- python 3x - i want to output a character string that contains a specific character string
- python - logic to create multiple combinations from multiple values so that the total is 1000 or more
- python - i have a question about multiple updates of pymongo
- python - i want to extract only the matching lines in two csv and output a new csv
- python - probability prediction using multiple time series data
- python 3x - is it possible to set multiple python3 tkinter themes? impossible?
- python - django how to receive multiple checkbox values
- [python37] i want to output the center coordinates of two minimum circumscribed circles
- python - i want to find the intersection of the lines of the least squares method when the button is pressed
- how to write a program that takes the l2 norm of python without using the for statement, about speeding up
- python - background program by sharley method
- python - library addition in pycharm
- i want to see the change of one element of a recurrence formula including a python matrix
- i have a question about runtime errors and exception handling in python
- python - discord teaming bot doesn't work properly
- python - i want to convert the characters obtained from the txt file to numbers
- python hdf5 how to add to saved data (how to use mode ='a')
- i don't understand the meaning of x used in a python pandas lambda expression