Pseudospectra.jl icon indicating copy to clipboard operation
Pseudospectra.jl copied to clipboard

Proof of concept Recipes for Plots

Open csimal opened this issue 4 years ago • 3 comments
trafficstars

Hi there,

I've implemented spectralportrait as a Plots Recipe as a proof of concept of how this could be done. This would allow having only one implementation for Plots that works for every backend.

Example use:

using Plots, Pseudospectra, LinearAlgebra
# pyplot() use any Plots backend

n = 150
B=diagm(1 => fill(2im,n-1), 2 => fill(-1,n-2), 3 => fill(2,n-3), -2 => fill(-4,n-2), -3 => fill(-2im, n-3))
Pseudospectra.PSAPlots.spectralportrait(B)

I'd be happy to help implement the rest of the plotting functions as recipes if needed.

csimal avatar Aug 14 '21 20:08 csimal

Note: It goes without saying that this PR is not really meant to be merged into the main branch. It's just a preliminary.

csimal avatar Aug 14 '21 20:08 csimal

Thanks! When I wrote most of this (several years ago) I found working with Recipes very frustrating and didn't pursue them, but if you're able to get them to handle the content here, I would be glad to replace some of my plotting hackery.

RalphAS avatar Aug 16 '21 14:08 RalphAS

I've gotten most of the way through basic recipes. I'll add tests for these next.

Seeing as Makie is much better for interactivity, I think it might be better to leave that out for the Plots support (especially as it makes the code at lot less gory)

csimal avatar Aug 17 '21 20:08 csimal