@@ -87,8 +87,13 @@ def __init__(
8787 self .factor = factor
8888
8989 def query (self , graph , parent_coordinates = "axes" ):
90- # TODO: get dpi from graph or refactor transform to be dpi independent
91- dpi = 100.0
90+ desc = Desc (("N" ,))
91+ dpi_eval = graph .evaluator (
92+ desc_like ({"x" : desc , "y" : desc }, coordinates = "display_inches" ),
93+ desc_like ({"x" : desc , "y" : desc }, coordinates = "display" ),
94+ )
95+ dpi = dpi_eval .evaluate ({"x" : [1 ], "y" : [1 ]})["x" ][0 ]
96+
9297 d , hash = super ().query (graph , parent_coordinates )
9398 transforms = np .zeros ((len (self .sizes ), 3 , 3 ))
9499 scale = np .sqrt (self .sizes ) * dpi / 72.0 * self .factor
@@ -147,8 +152,13 @@ def __init__(
147152 self .units = units
148153
149154 def query (self , graph , parent_coordinates = "axes" ):
150- # TODO: get dpi from graph or refactor transform to be dpi independent
151- dpi = 100.0
155+ desc = Desc (("N" ,))
156+ dpi_eval = graph .evaluator (
157+ desc_like ({"x" : desc , "y" : desc }, coordinates = "display_inches" ),
158+ desc_like ({"x" : desc , "y" : desc }, coordinates = "display" ),
159+ )
160+ dpi = dpi_eval .evaluate ({"x" : [1 ], "y" : [1 ]})["x" ][0 ]
161+
152162 d , hash = super ().query (graph , parent_coordinates )
153163
154164 # TODO: this section is verbose and likely to be useful elsewhere
@@ -193,7 +203,6 @@ def query(self, graph, parent_coordinates="axes"):
193203 raise ValueError (f'Unrecognized units: { self ._units !r} ' )
194204
195205
196- print (f"{ sc = } , { self .units = } " )
197206 transforms = np .zeros ((len (self .widths ), 3 , 3 ))
198207 widths = self .widths * sc
199208 heights = self .heights * sc
0 commit comments