jw3126 / UnitfulRecipes.jl

Plots.jl recipes for Unitful.jl arrays
MIT License
37 stars 10 forks source link

axis labels for `plot!` #60

Closed JeffFessler closed 3 years ago

JeffFessler commented 3 years ago

If I start a figure with plot with some basic stuff like the title and then use plot! to add data, the units do not appear. MWE:

using UnitfulRecipes
using Unitful: m
using Plots

x = (1:5)m
y = x.^2

p1 = plot(x, y, label="")
plot!(title = "this order works")

p2 = plot(title="no axis units here :(")
plot!(x, y, label="")

plot(p1, p2)
Screen Shot 2021-07-18 at 9 21 18 PM

I realize that in this MWE I could reverse the order and plot the data first then add the title, but often I am looping over several datasets and adding each using plot! so it can be convenient to start with the title or other stuff. I am unsure if this issue is specific to UR and fixable, or if it is a more general limitation of Recipes that I must find some other way to work around?