multipanel plots in python matplotlib

preview_player
Показать описание
how to make 3X1, 2X1 etc multipanel plots in matplotlib. Here is the code I used
# -*- coding: utf-8 -*-
"""
Created on Thu May 2 20:08:48 2019

@author: tsparks
"""
#grab libraries
import pandas as pd
import numpy as np
import matplotlib as mpl

#grab dataset 1
#pull data from CSV
x_data = df['x'].dropna()
y_data = df['y'].dropna()
x_error = df['x error'].dropna()
y_error = df['y error'].dropna()
#Set the limits of the plot for dataset1
xmin1=0
xmax1=16
ymin1=0
ymax1=60

#grab dataset 2
#pull data from CSV
x_data2 = df['x'].dropna()
y_data2 = df['y'].dropna()
x_error2 = df['x error'].dropna()
y_error2 = df['y error'].dropna()

#Set the limits of the plot for dataset1
xmin2=0
xmax2=16
ymin2=-5
ymax2=5
#Generate some nice colors
seshadri = ['#c3121e', '#0348a1', '#ffb01c', '#027608', '#0193b0', '#9c5300', '#949c01', '#7104b5']
# 0sangre, 1neptune, 2pumpkin, 3clover, 4denim, 5cocoa, 6cumin, 7berry

#Prepare multipanel plot
gs = gridspec.GridSpec(4,3)

#Generate first panel

#generate second panel

#Export figure
Рекомендации по теме