File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -129,11 +129,22 @@ Attribute fixing
129129function fixaspectratio! (attr, u, axisletter)
130130 aspect_ratio = get! (attr, :aspect_ratio , :auto )
131131 if aspect_ratio in (:auto , :none )
132+ # Keep the default behavior (let Plots figure it out)
132133 return
133134 end
134135 if aspect_ratio === :equal
135136 aspect_ratio = 1
136137 end
138+ #= ======================================================================================
139+ Implementation example:
140+
141+ Consider an x axis in `u"m"` and a y axis in `u"s"`, and an `aspect_ratio` in `u"m/s"`.
142+ On the first pass, `axisletter` is `:x`, so `aspect_ratio` is converted to `u"m/s"/u"m"
143+ = u"s^-1"`. On the second pass, `axisletter` is `:y`, so `aspect_ratio` becomes
144+ `u"s^-1"*u"s" = 1`. If at this point `aspect_ratio` is *not* unitless, an error has been
145+ made, and the default aspect ratio fixing of Plots throws a `DimensionError` as it tries
146+ to compare `0 < 1u"m"`.
147+ =======================================================================================#
137148 if axisletter === :y
138149 attr[:aspect_ratio ] = aspect_ratio* u
139150 return
You can’t perform that action at this time.
0 commit comments