|
From: Pierre H. <pie...@cr...> - 2012-09-26 09:58:43
|
Hello, In relation to the recent thread on pareto chart, I have a question with regards to the synchronization of ticks location when using twinx plots. This question may have been adressed in the past, but my Google search on this topic was unfruitful. Sorry if this question was already answered. Basically, when using twinx two plot two different data sets, the scale of the data, in the general case, is to be different (thus the need for twinx). However, adding a grid to such a twinx plot leads to a very irregular placement because the ticks positions are not "synchronized". (I pasted a quick example to illustrate the tick placement issue at the end of this message) Ideally, I would like that both axis share a common placement for the ticks. Is there a way to do that ? I guess this would require that the two ticks Locators share "some algorithm" so that they would "agree" on the placement instead of working separetely. Other option may be that one Locator could work as a slave of the other one. (I'm just trying to draw a rough picture) Best, Pierre quick example to illustrate the tick placement issue : import matplotlib.pyplot as plt ax1 = plt.subplot(111) ax1.plot([1,2,3], 'bo-') ax1.grid(True) ax2 = plt.twinx(ax1) ax2.plot([11,12], 'rs-') ax2.grid(True) ax1.set_xlim(-0.5,2.5) plt.show() |