|
From: Benjamin R. <ben...@ou...> - 2012-10-11 11:52:21
|
On Thursday, October 11, 2012, Damon McDougall wrote: > On Wed, Oct 10, 2012 at 3:55 PM, Benjamin Root <ben...@ou...<javascript:;>> > wrote: > > > > > > On Wed, Oct 10, 2012 at 9:40 AM, rand0m <ra...@0x... <javascript:;>> > wrote: > >> > >> Hello, > >> > >> I'm new to matplotlib and I hope you can help me out with my question. > >> When drawing for example a Rectangle() I have to specify it like the > >> following: > >> rect = Rectangle((1, 3), 2, 20, facecolor="#aaaaaa") > >> > >> Where 2 is the length and 20 is the height. (1,3) is for xy. > >> > >> Imagine a coordination system where x-axis should represent the value 0 > >> to 100. I would like to draw the rectangle from 50 to 60 on x-axis. So > >> I would specify: > >> > >> rect = Rectangle((50, 3), 10, 20, facecolor="#aaaaaa") > >> > >> But this does not work as desired because at the xtick 50 the x-axis > >> does not "hold" the value 50 but 5 because I made xticks 1-100 with step > >> 10. So my x-axis "holds" the values 1-10. But I need 1-100. > >> > >> If anyone knows what Im missing I d be glad to hear about it :-). > >> > >> thank you > >> > > > > I am not quite sure I understand what you mean. Can you attach an image > of > > the plot you made so far? > > > > Ben Root > > I'm not sure if adding a patch autoscales the view, try > > rect = Rectangle((50, 3), 10, 20, facecolor="#aaaaaa") > ax.add_patch(rect) > ax.set_xlim(0, 100) > ax.set_ylim(0, 25) > > We managed to solve it, but apparently it was off-list. Essentially, I showed him how to use a MultipleLocator to control the axis ticks, rather than labeling them manually at a different scale. Ben Root |