I would like to draw a figure with shared X axis in semilogx, where the upper panel would show a scatter plot of these points (x, y), and the bottom would show an histogram of the values of x, with bins having steps of 0.1 IN LOG10. I would like to have the tickmarks like in a semilogx plot (so with something like gca().set_xscale('log')).
==> I am desperately trying that but didn't find a working solution yet.
Below is an illustration of what I am plotting, but without any suggestion for getting the right tickmarks/xaxis etc..
any input welcome here! Thanks in advance for your help
My dataset would be for example:
x = rand(100)
y = rand(100)
# sel1 and sel2 being some selection of x
# here is just a working - but stupid - example
sel1 = (x < 0.5)
sel2 = (x > 0.5)
selx1 = compress(sel1, x)
selx2 = compress(sel2, x)
bins = arange(-2,0.1,0.1)
n1, n1bins, patches1 = hist(log10(selx1), bins)
n2, n2bins, patches2 = hist(log10(selx2), bins)
a = axes([0.15,0.4,.8,.55])
b = axes([0.15,0.05,.8,.35])
p1 = bar(n1bins, n1, width, color='chartreuse')
p2 = bar(n2bins, n2, width, color='khaki')
# of course this xlim does not work at all... and
# I would like to have the tickmarks and labels right