-
Notifications
You must be signed in to change notification settings - Fork 10
Description
I have a surface that is drawn in 3D space (length x, y, and z) with a 4th axis, the colorbar, which could be unitless, time, pressure, or some other dimension. The issue is that the colorbar title keeps the units from the 3rd axis (m). If I try to color based on anything other than a unitless number or a length, I get an error. If I could rename the colorbar_title = "Real Title ($real_units)" I would just strip out those units myself, but the other unit stays in so the title would be: "Real Title (kPa) (m)".
begin
X = [1u"m", 1u"m"; 1u"m", 1u"m"]
Y = [1u"m", 1u"m"; 1u"m", 1u"m"]
Z = [1u"m", 1u"m"; 1u"m", 1u"m"]
C = rand(2, 2)
surface!(X, Y, Z, surfacecolor=C, color=:turbo, colorbar=true, colorbar_title="this should change (kPa)")
end
I considered rolling my own for this, but I have other elements like the ball being brought into the plot using UnitfulRecipes so I would either have to enforce that everything comes in using the correct units or handle it elegantly or not use UnitfulRecipes for any of it and roll my own for the whole thing.
I've only just started making recipes of my own so when I open the code base it's a little beyond me. I think two potential solutions would be:
- Allow a user to turn off the automatic units application to a specific axis
- Have the colorbar pick up the units of the series its plotting
Please let me know if I've missed an easy solution or I'd be happy to contribute a solution with a little direction. Thanks!
