Skip to content

Plotting recipes (in order to clean up doc plots) #36

Open
@mileslucas

Description

@mileslucas

We have all of the information required to plot a dust law in the ExtinctionLaw structs, so we should be able to create a plotting recipe with RecipesBase to enable usage like

law = CCM89()
plot(law)

creating this plot recipe should be pretty easy and very similar to the recipes used in Polynomials.jl.

In terms of the interface, I think we need three key components

  1. what law are we plotting
  2. what wavelengths are we plotting
  3. Are we plotting wavenumbers (inverse micron, same effective shape as frequency) or wavelengths.

Here's what I think would be easiest to accomplish that interface

  1. Trivial
  2. By default, use the bounds of the law. Add a recipe with bounds f(::ExtinctionLaw, a, b) and a recipe with an iterable f(::ExtincitonLaw, X)
  3. Let's add a keyword argument "unit". Default is unit="invum". Other string options include unit="angstrom", unit="micron", etc. Really we should just use Unitful for parsing these, except for the "invum" case since that won't show up in unitful despite being (AFAIK) a de facto unit.

The onus for these recipes is to stop doing what we're doing with the plot docs, which is writing scripts that must be evaluated locally to generate plots that are checked out into version control and then only used for docs. A much better workflow would be to have the plots made as part of the documentation step, and ideally we can show the plotting code inside the docs for full reproducibility. After making these recipes, the docs should be able to be rewritten without the plots dir, and instead with simple plot(law) calls using Documenter's @example blocks.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions