From: André W. <co...@wo...> - 2021-03-18 20:40:40
|
Hi Alexis, this is the expected behavior. The reason is, that (a) you need more then one number at an axis, (b) ranges are fixed if set at the axis, and (c) all automatic log axis "partitions" always include a label at value 1 (i.e. 10^0). While any positive integer can be used as the step for the exponents (like 10^0, 10^2, 10^4, ..., or 10^0, 10^3, 10^6, ..., and so on) and an arbitrary range might be in use (i.e. not including 10^0), the logic remains that same. For your case numbers at 10^0 and 10^2 are a valid partition, but 10^1 and 10^3 are not. 10^1, 10^2, 10^3 is fine, too, but 10, 100 and 1000 is rejected in your case due to overlapping labels. (Changing the texter to write the numbers using exponents could help here.) If you get the range from the data and allow PyX to extend the range (as done by default), it probably finds a reasonable solution. Also including 10^0 (i.e. 1) will likely help in many situations. However note that overlapping labels are always rejected. Hence for tiny graphs the automatic axis partitioning might fail and there is no way out except reducing the font size, but you already observed that ... :-) Best, André Am 18.03.21 um 14:23 schrieb Alexis Poncet: > Hi, > > The following code fails with pyx.graph.axis.axis.NoValidPartitionError. > > from pyx import * > xaxis = graph.axis.log(min=10, max=1000) > yaxis = graph.axis.log(min=1, max=100) > g = graph.graphxy(width=1.2, x=xaxis, y=yaxis) > g.writePDFfile() > > I don't really understand why PyX is not able to find a partition. You > can check that the problem disappears with `width=1.3` or with > `unit.set(xscale=0.8)`. > I solved by it by providing explicitely the ticks, but I feel that PyX > should be able to find a solution (as it does for the y axis). > > ticks = [graph.axis.tick.tick(x, label=a) for x, a in zip([10, 100, > 1000], ["10", "", "1000"])] > xaxis = graph.axis.log(min=10, max=1000, parter=None, manualticks=ticks) > > I don't know if this qualifies as a bug, or if it is expected behavior. > > Cheers, > > Alexis > > > > _______________________________________________ > PyX-user mailing list > PyX...@li... > https://lists.sourceforge.net/lists/listinfo/pyx-user -- by _ _ _ / \ \ / ) Dr. André Wobst, co...@wo..., https://www.wobsta.de / _ \ \/\/ / wobsta GmbH, Ulmer Straße 248, 86156 Augsburg, Germany (_/ \_)_/\_/ Office: +49 (0)821 90796043, Mobile: +49 (0)160 93804217 |