Skip to content

Instantly share code, notes, and snippets.

@camriddell
camriddell / Python Plotting - Working With Long Labels
Last active October 25, 2022 18:19
Summary of some of the ways one can work with long labels in both matplotlib & bokeh. Based on an example created in ggplot2 (R) https://www.andrewheiss.com/blog/2022/06/23/long-labels-ggplot/
We couldn’t find that file to show.
@braingineer
braingineer / matprint.py
Created March 8, 2017 01:31 — forked from lbn/matprint.py
Pretty print a matrix in Python 3 with numpy
def matprint(mat, fmt="g"):
col_maxes = [max([len(("{:"+fmt+"}").format(x)) for x in col]) for col in mat.T]
for x in mat:
for i, y in enumerate(x):
print(("{:"+str(col_maxes[i])+fmt+"}").format(y), end=" ")
print("")
# Try it!
import numpy as np