Skip to content

Commit 4085520

Browse files
committed
added remaining law plots
1 parent 223e1bb commit 4085520

16 files changed

+121
-15296
lines changed

docs/src/assets/F04_plot.svg

Lines changed: 0 additions & 798 deletions
This file was deleted.

docs/src/assets/F19_plot.svg

Lines changed: 0 additions & 807 deletions
This file was deleted.

docs/src/assets/F99_plot.svg

Lines changed: 0 additions & 798 deletions
This file was deleted.

docs/src/assets/FM90_plot.svg

Lines changed: 0 additions & 2040 deletions
This file was deleted.

docs/src/assets/G16_fixed_Rv_plot.svg

Lines changed: 0 additions & 910 deletions
This file was deleted.

docs/src/assets/G16_fixed_f_A_plot.svg

Lines changed: 0 additions & 801 deletions
This file was deleted.

docs/src/assets/M14_plot.svg

Lines changed: 0 additions & 807 deletions
This file was deleted.

docs/src/assets/cal00_plot.svg

Lines changed: 0 additions & 720 deletions
This file was deleted.

docs/src/assets/ccm89_plot.svg

Lines changed: 0 additions & 711 deletions
This file was deleted.

docs/src/assets/gcc09_plot.svg

Lines changed: 0 additions & 710 deletions
This file was deleted.

docs/src/assets/od94_plot.svg

Lines changed: 0 additions & 711 deletions
This file was deleted.

docs/src/assets/sfd98_plot.svg

Lines changed: 0 additions & 4765 deletions
This file was deleted.

docs/src/assets/vcg04_plot.svg

Lines changed: 0 additions & 701 deletions
This file was deleted.

docs/src/color_laws.md

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -138,71 +138,89 @@ and is loosely associated with the size of the dust grains in the interstellar m
138138

139139
### Clayton, Cardelli and Mathis (1989)
140140

141-
![](assets/ccm89_plot.svg)
141+
```@example
142+
using DustExtinction, CairoMakie; lplot(CCM89)
143+
```
142144

143145
```@docs
144146
CCM89
145147
```
146148

147149
### O'Donnell 1994
148150

149-
![](assets/od94_plot.svg)
151+
```@example
152+
using DustExtinction, CairoMakie; lplot(OD94)
153+
```
150154

151155
```@docs
152156
OD94
153157
```
154158

155159
### Calzetti et al. (2000)
156160

157-
![](assets/cal00_plot.svg)
161+
```@example
162+
using DustExtinction, CairoMakie; lplot(CAL00)
163+
```
158164

159165
```@docs
160166
CAL00
161167
```
162168

163169
### Valencic, Clayton, & Gordon (2004)
164170

165-
![](assets/vcg04_plot.svg)
171+
```@example
172+
using DustExtinction, CairoMakie; lplot(VCG04)
173+
```
166174

167175
```@docs
168176
VCG04
169177
```
170178

171179
### Gordon, Cartledge, & Clayton (2009)
172180

173-
![](assets/gcc09_plot.svg)
181+
```@example
182+
using DustExtinction, CairoMakie; lplot(GCC09)
183+
```
174184

175185
```@docs
176186
GCC09
177187
```
178188

179189
### Fitzpatrick (1999)
180190

181-
![](assets/F99_plot.svg)
191+
```@example
192+
using DustExtinction, CairoMakie; lplot(F99)
193+
```
182194

183195
```@docs
184196
F99
185197
```
186198

187199
### Fitzpatrick (2004)
188200

189-
![](assets/F04_plot.svg)
201+
```@example
202+
using DustExtinction, CairoMakie; lplot(F04)
203+
```
190204

191205
```@docs
192206
F04
193207
```
194208

195209
### Fitzpatrick (2019)
196210

197-
![](assets/F19_plot.svg)
211+
```@example
212+
using DustExtinction, CairoMakie; lplot(F19)
213+
```
198214

199215
```@docs
200216
F19
201217
```
202218

203219
### Maiz Apellaniz et al. (2014)
204220

205-
![](assets/M14_plot.svg)
221+
```@example
222+
using DustExtinction, CairoMakie; lplot(M14)
223+
```
206224

207225
```@docs
208226
M14
@@ -222,7 +240,9 @@ DustExtinction.checkbounds
222240

223241
#### Fitzpatrick & Massa (1990)
224242

225-
![](assets/FM90_plot.svg)
243+
```@example
244+
using DustExtinction, CairoMakie; lplot(FM90)
245+
```
226246

227247
```@docs
228248
FM90
@@ -239,8 +259,12 @@ G03_LMCAve
239259

240260
#### Gordon et al. (2016)
241261

242-
![](assets/G16_fixed_f_A_plot.svg)
243-
![](assets/G16_fixed_Rv_plot.svg)
262+
```@example
263+
using DustExtinction, CairoMakie
264+
265+
mplot(G16, (2.0, 3.1, 4.0, 5.0, 6.0), 1.0)
266+
mplot(G16, 3.1, 0.0:0.2:1.0)
267+
```
244268

245269
```@docs
246270
G16

ext/MakieExt.jl

Lines changed: 80 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module MakieExt
22
using DustExtinction
3-
import DustExtinction: bounds, aa_to_invum, ExtinctionLaw, lplot, lplot!, dplot, dplot!
3+
import DustExtinction: bounds, aa_to_invum, ExtinctionLaw, lplot, lplot!, mplot, mplot!, dplot, dplot!
44
using Makie: Makie, convert_arguments, PointBased, lines, lines!, heatmap, heatmap!, Colorbar, rich, superscript, axislegend
55

66
function Makie.convert_arguments(P::PointBased, law::ExtinctionLaw)
@@ -15,7 +15,7 @@ module MakieExt
1515
"""
1616
lplot(law::ExtinctionLaw; args...)
1717
18-
Color law plot with automatic axis labels.
18+
Rv law plot with automatic axis labels.
1919
"""
2020
lplot(law::ExtinctionLaw; args...) = lines(
2121
law;
@@ -29,7 +29,7 @@ module MakieExt
2929
"""
3030
lplot(law::Type{<:ExtinctionLaw}; args...)
3131
32-
Color law series plot with automatic axis labels.
32+
Rv law series plot with automatic axis labels.
3333
"""
3434
function lplot(law::Type{<:ExtinctionLaw}; args...)
3535
# Dummy plot
@@ -44,10 +44,86 @@ module MakieExt
4444
fig
4545
end
4646

47+
"""
48+
lplot(law::FM90; args...)
49+
50+
Fittable law plot with automatic axis labels.
51+
"""
52+
lplot(law::FM90; args...) = lines(law;
53+
axis = (;
54+
xlabel = rich("x [μm", superscript("-1"), "]"),
55+
ylabel = rich("(E(λ) - V) / E(B - V)"),
56+
),
57+
args...,
58+
)
59+
60+
"""
61+
lplot(law::FM90; args...)
62+
63+
Fittable law series plot with automatic axis labels.
64+
"""
65+
function lplot(law::Type{<:FM90}; args...)
66+
# m1
67+
fig, ax, p = lplot(law(); label="total")
68+
69+
# m2
70+
lines!(ax, law(c3=0.0, c4=0.0); label="linear term")
71+
72+
# m3
73+
lines!(ax, law(c1=0.0, c2=0.0, c4=0.0); label="bump term")
74+
75+
# m4
76+
lines!(ax, law(c1=0.0, c2=0.0, c3=0.0); label="FUV rise term")
77+
78+
# for Rv in (2.0, 3.1, 4.0, 5.0, 6.0)
79+
# lines!(ax, law(Rv); label=rich("Rv = $(Rv)"), args...)
80+
# end
81+
82+
axislegend(ax; position=:lt)
83+
84+
fig
85+
end
86+
87+
"""
88+
mplot(law::Type{G16}, Rvs, f_A::Real; args...)
89+
90+
Mixture law plot with automatic axis labels.
91+
"""
92+
function mplot(law::Type{G16}, Rvs, f_A::Real; args...)
93+
# Dummy plot
94+
fig, ax, p = lplot(law())
95+
96+
for Rv in Rvs
97+
lines!(ax, law(; Rv, f_A); label=rich("Rv = $(Rv)"), args...)
98+
end
99+
100+
axislegend(ax, "f_A = $(f_A)"; position=:lt)
101+
102+
fig
103+
end
104+
105+
"""
106+
mplot(law::Type{G16}, Rvs, f_A::Real; args...)
107+
108+
Mixture law series plot with automatic axis labels.
109+
"""
110+
function mplot(law::Type{G16}, Rv::Real, f_As; args...)
111+
# Dummy plot
112+
fig, ax, p = lplot(law())
113+
114+
for f_A in f_As
115+
lines!(ax, law(; Rv, f_A); label=rich("f_A = $(f_A)"), args...)
116+
end
117+
118+
axislegend(ax, "Rv = $(Rv)"; position=:lt)
119+
120+
fig
121+
end
122+
47123
"""
48124
dplot(dustmap=SFD98Map(); lrange=(-3, 3), brange=(-1, 1))
49125
50-
Plot a heatmap of the given `dustmap`, with galactic longitude ``(l)`` on the x-axis and galactic latitude ``(b)`` on the y-axis. Angles are displayed in degrees by default. The plot axis ranges for both are set by `lrange` and `brange`, respectively.
126+
Heatmap of the given `dustmap`, with galactic longitude ``(l)`` on the x-axis and galactic latitude ``(b)`` on the y-axis. Angles are displayed in degrees by default. The plot axis ranges for both are set by `lrange` and `brange`, respectively.
51127
"""
52128
function dplot(dustmap=SFD98Map(); lrange=(-3, 3), brange=(-1, 1))
53129
l = range(lrange..., length=400)

src/DustExtinction.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,15 @@ export redden,
3030
lplot,
3131
lplot!,
3232
dplot,
33-
dplot!
33+
dplot!,
34+
mplot,
35+
mplot!
3436

3537
# Plot recipe stubs
3638
function lplot end
3739
function lplot! end
40+
function mplot end
41+
function mplot! end
3842
function dplot end
3943
function dplot! end
4044

0 commit comments

Comments
 (0)