Visual layout editor for matplotlib and any plotting library built upon matplotlib like seaborn.

Overview

Matplotlib Layout Generator

Before you start:

  1. You must have experience with using matplotlib.
  2. It needs to be use on desktop. Not designed for mobile.

Add subplot to the layout:

image


Adjust the subplot:

After you added subplot you can drag, resize and close it. image


Add more subplots and play with layout:

image


Copy the generated code (which is displayed under the layout):

image


Use the generated code:

Generated code is simply a function which accepts the matplotlib figure and returns the dictionary of the created axes (subplots), where key is the name of subplot you have typed:

Super simple example:

import matplotlib.pyplot as plt

def generate_axes(fig):
    gridspec = fig.add_gridspec(nrows=13, ncols=12)
    axes = {}
    ax_my_plot = fig.add_subplot(gridspec[0:3, 0:3])
    axes['my_plot'] = ax_my_plot
    ax_sales = fig.add_subplot(gridspec[3:6, 0:7])
    axes['sales'] = ax_sales
    ax_orders = fig.add_subplot(gridspec[6:9, 3:10])
    axes['orders'] = ax_orders
    ax_this = fig.add_subplot(gridspec[0:4, 7:11])
    axes['this'] = ax_this
    ax_that = fig.add_subplot(gridspec[9:13, 6:10])
    axes['that'] = ax_that
    return axes

fig = plt.figure(figsize=(10, 10), constrained_layout=True)
axes = generate_axes(fig)

# now add plots to each axes as usual:
# axes['sales'].plot(x,y)...

plt.show()

created plot:

image

notebook: https://colab.research.google.com/drive/1FKs-SrGWEK7MKMPeN4TXv5BNqBz5UX-X?usp=sharing

Normal example:

import matplotlib.pyplot as plt
import numpy as np

def generate_axes(fig):
    gridspec = fig.add_gridspec(nrows=13, ncols=12)
    axes = {}
    ax_my_plot = fig.add_subplot(gridspec[0:3, 0:3])
    axes['my_plot'] = ax_my_plot
    ax_sales = fig.add_subplot(gridspec[3:6, 0:7])
    axes['sales'] = ax_sales
    ax_orders = fig.add_subplot(gridspec[6:9, 3:10])
    axes['orders'] = ax_orders
    ax_this = fig.add_subplot(gridspec[0:4, 7:11])
    axes['this'] = ax_this
    ax_that = fig.add_subplot(gridspec[9:13, 6:10])
    axes['that'] = ax_that
    return axes

fig = plt.figure(figsize=(10, 10), constrained_layout=True)
axes = generate_axes(fig)


########################################
x = np.linspace(0, 10, 100)
y = 4 + 2 * np.sin(2 * x)
axes['my_plot'].plot(x,y)

########################################
np.random.seed(1)
x = 4 + np.random.normal(0, 1.5, 200)
axes['orders'].hist(x, bins=8, linewidth=0.5, edgecolor="white")

########################################
np.random.seed(3)
x = 4 + np.random.normal(0, 2, 24)
y = 4 + np.random.normal(0, 2, len(x))
axes['sales'].scatter(x, y)


########################################
labels = ['G1', 'G2', 'G3', 'G4', 'G5']
men_means = [20, 34, 30, 35, 27]
women_means = [25, 32, 34, 20, 25]

x = np.arange(len(labels))  # the label locations
width = 0.35  # the width of the bars

rects1 = axes['that'].bar(x - width/2, men_means, width, label='Men')
rects2 = axes['that'].bar(x + width/2, women_means, width, label='Women')

axes['that'].set_ylabel('Scores')
axes['that'].set_title('Scores by group and gender')
axes['that'].set_xticks(x, labels)
axes['that'].legend()

########################################
labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
sizes = [15, 30, 45, 10]
explode = (0, 0.1, 0, 0)  # only "explode" the 2nd slice (i.e. 'Hogs')

axes['this'].pie(sizes, explode=explode, labels=labels, autopct='%1.1f%%',
        shadow=True, startangle=90)
axes['this'].axis('equal')  # Equal aspect ratio ensures that pie is drawn as a circle.

plt.show()

created plot:

image

notebook: https://colab.research.google.com/drive/1FKs-SrGWEK7MKMPeN4TXv5BNqBz5UX-X?usp=sharing

You might also like...

Audio visual mitigation of Rickrolls using computer vision.

Computer Vision Rick Astley Muter This project utilizes an advanced computer vision model to mute your speakers when Rick Astley is detected on your s

Oct 20, 2022

IngredientRecipeFinder - Web app built with react using Edamam API to find any recipe for an ingredient search with nutrition filters (high protein, low carb,etc)

Ingredient Recipe Finder Web app This web app built with the use of Edamam API allows you to find any type of recipe for a specific ingredient you are

Jan 4, 2022

Next-gen, highly customizable content editor for the browser - based on React and Redux and written in TypeScript. WYSIWYG on steroids.

ReactPage ReactPage is a smart, extensible and modern editor ("WYSIWYG") for the web written in React. If you are fed up with the limitations of conte

Jan 6, 2023

💻 Build your own code editor that compiles and runs 40+ programming languages.

💻 Build your own code editor that compiles and runs 40+ programming languages.

CodeRush - Compile and Execute code in 40+ languages ⚡️ A code editor that compiles and runs your code on the web. Blog: FreeCodeCamp - Build A Code I

Jan 1, 2023

Light-weight react-like maximum-optimistic library for building user interfaces.

wili Wili is a 2kb Light-weight react-like maximum-optimistic library for building user interfaces. Usage Welcome componenet: class Welcome extends Wi

Feb 16, 2022

How to submit HTML forms to Google Sheets. (Updated for 2021 Script Editor)

How to submit HTML forms to Google Sheets. (Updated for 2021 Script Editor)

Submit a HTML form to Google Sheets How to submit a simple HTML form to a Google Sheet using only HTML and JavaScript. Updated for Google Script Edito

Jan 6, 2023

A set of higher-order components to turn any list into an animated, accessible and touch-friendly sortable list✌️

A set of higher-order components to turn any list into an animated, accessible and touch-friendly sortable list✌️

A set of higher-order components to turn any list into an animated, accessible and touch-friendly sortable list Examples available here: http://claude

Jan 2, 2023

Landing page for any SaaS company, using Nextjs and NextUI

Landing page for any SaaS company, using Nextjs and NextUI

NextJS and NextUI Landing Page Template You can deploy here directly to vercel This is a template for NextJS and NextUI. NextJS NextUI You can see the

Dec 23, 2022

CoWIN Vaccination Tracker, Below is the PRODUCTION LINK this is updated at end of each day. To see any latest Updates, please check the documentation

CoWIN Vaccination Slots Checking App. CoWIN Vaccination Slots Checking App is a user-friendly website that allow users to find vaccine in nearby avail

Jan 28, 2022
Tina is an open source editor that brings visual editing into React websites. Tina empowers developers to give their teams a contextual and intuitive editing experience without sacrificing code quality.

Tina is an open-source toolkit for building content management directly into your website. Community Forum Getting Started Checkout the tutorial to ge

Tina 8.2k Jan 1, 2023
A draggable and resizable grid layout with responsive breakpoints, for React.

React-Grid-Layout React-Grid-Layout is a grid layout system much like Packery or Gridster, for React. Unlike those systems, it is responsive and suppo

RGL 16.9k Jan 4, 2023
Plock is a responsive masonry layout implementation for React. Very simple to use and easy to understand.

About Plock ?? Plock is a responsive masonry layout implementation for React. Very simple to use and easy to understand. Can I see a demo? ?? The demo

Renato Pozzi 130 Dec 9, 2022
An easy to use and simple masonry layout for React Js based on flexbox column.

React Masonry An easy to use and simple masonry layout for React Js based on flexbox column. Live Preview / Demo In Here Basic Usage Masonry Layout <M

null 16 Dec 23, 2022
here in this git repo you will get react js basic layout, having in responsive mode.

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 3 Feb 23, 2022
MSN Redesign made with Next - Inspired by Igor Monteiro's Layout

MSN Redesign ?? Made with Next - Inspired by Igor Monteiro's Layout | Behance ??️ Stack Next React Yarn (v1.22.17) CSS in JS CSS - Gradient Responsive

Lais Frigério 6 Feb 16, 2022
Shows how React components and Redux to build a friendly user experience with instant visual updates and scaleable code in ecommerce applications

This simple shopping cart prototype shows how React components and Redux can be used to build a friendly user experience with instant visual updates and scaleable code in ecommerce applications.

Alan Vieyra 4 Feb 1, 2022
A text editor built with react , firebase and quill

Welcome to Text-Editor ?? A simple text editor built with react,firebase v8 & quill ✨ Demo Install npm install Usage npm run start Run tests npm run t

Whirl 4 Aug 30, 2022
Visual debugger for framer-motion

Visual debugger for framer-motion Demo install npm install tracer-motion --save-dev # or yarn add tracer-motion --dev usage import { motion } from

Siddharth Kshetrapal 69 Oct 9, 2022
A reusable react hook that preserves a components semantic accessibility to create a visual block link.

useAccessibleBlockLink is a reusable react hook that preserves a components semantic accessibility to create a visual block link. This hook supports multiple links within the same block.

Wayfair Tech – Incubator 4 Nov 28, 2022