Skip to content

Instantly share code, notes, and snippets.

@torfjelde
torfjelde / Manifest.toml
Last active February 10, 2024 12:56
Quick and dirty example of a mixture sampler using some internals of MCMCTempering.jl.
# This file is machine-generated - editing it directly is not advised
julia_version = "1.10.0"
manifest_format = "2.0"
project_hash = "a0590676db40552635a5877095b47d6a64ec5413"
[[deps.ADTypes]]
git-tree-sha1 = "41c37aa88889c171f1300ceac1313c06e891d245"
uuid = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
version = "0.2.6"
@ztangent
ztangent / make.jl
Last active April 3, 2022 04:39
Documenter.jl workaround for custom HTML meta tags
using Documenter, PDDL
# Include workaround to inject custom meta tags
include("metatags.jl")
# Add custom metatags
empty!(CUSTOM_META_TAGS)
PREVIEW_IMAGE_URL =
"YOUR PREVIEW URL HERE"
SITE_DESCRIPTION =
@jkrumbiegel
jkrumbiegel / makie_sankey.jl
Created March 12, 2022 13:25
sankey makie
function sankey!(target, x1, x2, bend, start_min, start_max, stop_min, stop_max, color_start, color_stop)
bezier(t, p1, p2, p3, p4) = (1 - t)^3 * p1 + 3(1 - t)^2 * t * p2 + 3 * (1 - t) * t^2 * p3 + t^3 * p4
b(t, start, stop) = begin
p_start = Point2f(x1, start)
p_stop = Point2f(x2, stop)
c1 = Point2f(x1 + bend * (x2-x1), start)
c2 = Point2f(x2 - bend * (x2-x1), stop)
bezier(t, p_start, c1, c2, p_stop)
end
@hugke729
hugke729 / rasterize_and_save.py
Last active December 3, 2023 02:55
Simplify export of matplotlib figures when both raster and vector components are desired in output
# A function to rasterize components of a matplotlib figure while keeping
# axes, labels, etc as vector components
# https://brushingupscience.wordpress.com/2017/05/09/vector-and-raster-in-one-with-matplotlib/
from inspect import getmembers, isclass
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
def rasterize_and_save(fname, rasterize_list=None, fig=None, dpi=None,