highfestiva / finplot

Performant and effortless finance plotting for Python
MIT License
935 stars 187 forks source link

What is the difference between set_y_scale and set_y_range and how to set it proper #513

Closed Protomolekule closed 7 months ago

Protomolekule commented 7 months ago

I'm using the set_y_range to zoom into the Y scale def fplt_set_pricerange(self, settings): if settings['auto'] == False: # use settings by program fplt.set_y_range(settings['min'], settings['max']) else: min = self.df_main[['Open', 'Close', 'High', 'Low']].min().min() # get min and max from df max = self.df_main[['Open', 'Close', 'High', 'Low']].max().max() fplt.set_y_range(min, max) fplt.refresh ()

but I get scale which I don't expect Screenshot Y Set by value

I've expected similar to

Screenshot Y ok

Both have the same df. But as soon as I use the function set_y_range I get the unreadable numbers.

How to use the fplt.set_y_range() and fplt.set_y_scale() to zoom programaticaly? thanks in advance

highfestiva commented 7 months ago

set_y_scale() is only for flipping between linear and log scales. set_y_range() fixes the Y-range so you won't be able to move outside of them. Due to a bug in Qt, I have to scale the values down if they are big, but it's hard to tell if that's what's going on in your case. Could you post a minimal but complete example for me to reproduce the bug?

Protomolekule commented 7 months ago

Ah, ok.Thanks, one question cleared. I'm trying to reduce code to reproduce the behavior. Could't get it today. I'll come back to that next week. I think I call it in the wrong way, because the standard example is working proper. Maybe I call the class in wrong way.

Protomolekule commented 7 months ago

Was a memory problem. fixed by restricting other parts mem usage