![]() A minimal case that reproduces the problem is: While I am sure it is very clear to you, I find even the reduced one hard to parse. When I say there is a lot going on you are using bar, datetimes, generating very specific data, etc. In general if you want to know anything about screen space, do () to make sure everything has been resolved. Similarly if you are using any of tight_layout or constrained_layout, we don't update the position of anything until draw time. In this case, you were triggering the auto-scaling by calling get_xlim() which resolves the "stale" limits and then pushes the updated information down into the transforms.įor performance reasons we accept storing information in two places so that we do not have to query the view limits every time we use it. In this case, when you have not explicitly set the limits, we defer computing the auto-limits until we must (so if you add 5k lines we only compute the limits once instead of 5k times). On one hand people want us to be as fast as possible, which means we have been trying to defer doing work until as late as possible. We recently tried to make the warnings a bit more glaring (see / ). Print('inv tr_x',inv(tr_x)) //<- AND HERE Print('aa bb',aa,bb,date2num(aa),date2num(bb)) Pip3 install -U -upgrade-strategy eager -r requirements.txt Installed via the following command, with requirements.txt containing "matplotlib" However, when passing the transAxes output to transData.inverted().transform() we get back 10957 - 14610.Įxpected: We should have translated back to ~18449. On the "ax" line we also see that the xlim is ~18449. Inverting that transform using transData.inverted().transform() goes back to ~11123 and ~14388 on x, and 0 on y.Īs you can see the on the transAxes output lines, x=1.0 is pixel = 1800. Tr_x input ġ pixel data width 2.356774193547608 Īs you can see on the tr_x lines, transforming x's in the 18449 xlim range maps to ~320 and ~1706 pixel space, and 9000.0 on y to 110 in pixel space. autofmt_xdate( rotation = 45) # image_memory_file = io. #bar_width = (bar_duration*(fig_width_inch*plot_width_perc_of_fig) / plot_width_sec) / 72.0 #reading online it appears bar_width is unitless and represents "the size of one bar" = 1.0 fig. Print( 'aa bb', aa, bb, date2num( aa), date2num( bb)) Plot_width_sec = float(( quotes_x - quotes_x). subplots( figsize =( fig_width_inch, fig_width_inch * aspect), dpi = dpi) ![]() ![]() Ppi = 72.0 #standard dpi = 200 ppd = ppi / float( dpi)Īspect = 0.5 plot_width_perc_of_fig = 0.8 #standard matplot value fig_width_inch = 10 fig_width_dot = dpi * fig_width_inch fig, ax = plt. python_version())īar_duration = 60 start = datetime( year = 2020, month = 7, day = 6, hour = 6) dates import date2num from datetime import datetime, timedelta import io import matplotlib print( 'VERSION INFO') TO convert between pixels and points (a point is 1/72 inches), you may be able to play around with and fig.dpi_scale_trans (the tutorial has something on this, I think).Import matplotlib. ![]() ![]() There are various other transforms you can do - coordinates relative to your data, relative to the axes, as a proportion of the figure, or in pixels for the figure (the transformations tutorial is really good). # array(, <- one y unit is 384 pixels (on my computer) # what's one vertical unit & one horizontal unit in pixels?Īx.ansform()((0,0)) In particular, (points) returns pixel coordinates where (0,0) is the bottom-left of the viewport. Have a look at the Transformations tutorial (wow, that took a lot of digging to find - !) ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |