From: John H. <jdh...@ac...> - 2004-06-22 13:03:50
|
from matplotlib.matlab import * m = array([0.1, 0.2, 0.3, 0.6, 0.8, 1, 3]) r = array([18, 180, 1800, 1.8, 0.18, 250, 2.8]) plot(m, r) set(gca(), "yscale", "log") show() This is a known issue I've been meaning to work on. Here's what is happening. On the plot command the tick locator is autoranging the axes and ymin becomes 0. Since the log transformation applies to the tick locations as well as the data, it is log transforming the tick location of zero. To fix this, I need to check the axes range when the call to set yscale is made and fix it. In the meantime, you can explicity set the ylim after the call to plot and before the call to yscale. from matplotlib.matlab import * m = array([0.1, 0.2, 0.3, 0.6, 0.8, 1, 3]) r = array([18, 180, 1800, 1.8, 0.18, 250, 2.8]) plot(m, r) set(gca(), 'ylim', (0.1, 2000)) set(gca(), "yscale", "log") show() JDH |