Reputation:
I am trying to create square plots (equal axes length) on log-log scale, but I have no luck. Can any one help me with this.
Upvotes: 1
Views: 529
Reputation: 458
You can use this function:
def set_aspect_ratio_log(plot, aspect_ratio):
x_min, x_max = plot.get_xlim()
y_min, y_max = plot.get_ylim()
return plot.set_aspect(aspect_ratio * ((math.log10(x_max / x_min)) / (math.log10(y_max / y_min))))
Hope this helps.
Upvotes: 1