Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

plotting in python

import matplotlib.pyplot as plt
import numpy as np

# Simple data to display in various forms
x = np.linspace(0, 2 * np.pi, 400)
y = np.sin(x ** 2)

fig, axarr = plt.subplots(2, 2)
fig.suptitle("This Main Title is Nicely Formatted", fontsize=16)

axarr[0, 0].plot(x, y)
axarr[0, 0].set_title('Axis [0,0] Subtitle')
axarr[0, 1].scatter(x, y)
axarr[0, 1].set_title('Axis [0,1] Subtitle')
axarr[1, 0].plot(x, y ** 2)
axarr[1, 0].set_title('Axis [1,0] Subtitle')
axarr[1, 1].scatter(x, y ** 2)
axarr[1, 1].set_title('Axis [1,1] Subtitle')

# Fine-tune figure;
# hide x ticks for top plots and y ticks for right plots

plt.setp([a.get_xticklabels() for a in axarr[0, :]], visible=False)
plt.setp([a.get_yticklabels() for a in axarr[:, 1]], visible=False)


# Tight layout often produces nice results
# but requires the title to be spaced accordingly

fig.tight_layout()
fig.subplots_adjust(top=0.88)

plt.show()


Comment

PREVIOUS NEXT
Code Example
Python :: how to hide ticks in python 
Python :: seaborn color palette python 
Python :: python reverse list 
Python :: get current url with parameters url django 
Python :: flask session auto logout in 5 mins 
Python :: sum of prime numbers python 
Python :: ConfusionMatrixDisplay size 
Python :: python get nested dictionary keys 
Python :: logarithms python 
Python :: flask bootstrap 
Python :: python lowercase first letter 
Python :: list all files in folder python 
Python :: python 2d dictionary 
Python :: uses specific version python venv 
Python :: get vowels from string python 
Python :: if else python 
Python :: flask api 
Python :: how to take array as input in python 
Python :: python heatmap 
Python :: python bisect 
Python :: how to center a string python 
Python :: Python Datetime Get year, month, hour, minute, and timestamp 
Python :: reset index python 
Python :: python __repr__ 
Python :: uninstall a python package from virtualenv 
Python :: character to ascii python 
Python :: a sigmoid function 
Python :: np.exp in python numpy 
Python :: mkvirtualenv python version 
Python :: deep learning with python 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =