sanic request stream

from sanic import Sanic from sanic.blueprints import Blueprint from sanic.response import stream, text from sanic.views import HTTPMethodView from sanic.views import stream as stream_decorator

amending request object

from random import randint from sanic import Sanic from sanic.response import text app = Sanic("Example")

authorized sanic

# -*- coding: utf-8 -*- from functools import wraps from sanic import Sanic from sanic.response import json

sanic blueprints

from sanic import Blueprint, Sanic from sanic.response import file, json app = Sanic("Example") blueprint = Blueprint("bp_example", url_prefix="/my_blueprint") blueprint2 = Blueprint("bp_example2", url_prefix="/my_blueprint2")

matplotlib annotate explain

import matplotlib.pyplot as plt import matplotlib.patches as mpatches fig, axs = plt.subplots(2, 2) x1, y1 = 0.3, 0.3 x2, y2 = 0.7, 0.7

matplotlib Legend

import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(211) ax.plot([1, 2, 3], label="test1") ax.plot([3, 2, 1], label="test2")

PGF texsystem

import matplotlib.pyplot as plt plt.rcParams.update({ "pgf.texsystem": "pdflatex", "pgf.preamble": "\n".join([ r"\usepackage[utf8x]{inputenc}", r"\usepackage[T1]{fontenc}", r"\usepackage{cmbright}", ]), })

PGF preamble

import matplotlib as mpl mpl.use("pgf") import matplotlib.pyplot as plt plt.rcParams.update({

matplotlib pgf fonts

PGF fonts import matplotlib.pyplot as plt plt.rcParams.update({ "font.family": "serif", # Use LaTeX default serif font. "font.serif": [],

matplotlib multicursor

Showing a cursor on multiple plots simultaneously. This example generates three axes split over two different figures.  On hovering the cursor over data in one subplot, the values of that datapoint are shown in all axes