I hope my answer in the other thread clears your problem. One note, I found that some grid lines are missing at first run. This can be fixed by using "host.xaxis.get_major_ticks()" instead of "host.xaxis.majorTicks" (same for yaxis).
-JJ On Sun, Sep 27, 2009 at 2:22 AM, Gökhan Sever <gokhanse...@gmail.com> wrote: > > > On Sat, Sep 26, 2009 at 11:14 PM, Jae-Joon Lee <lee.j.j...@gmail.com> wrote: >> >> On Sat, Sep 26, 2009 at 11:10 PM, Gökhan Sever <gokhanse...@gmail.com> >> wrote: >> > To run the code, you have to get nasafile.py and add this into your >> > PYTHONPATH, later get dccn_plot.py and >> > 09_03_26_11_36_15.dmtccnc.combined.raw file. nasafile.py has the >> > NasaFile >> > class to read this ascii file. >> > >> > run as ./dccn_plot.py 09_03_26_11_36_15.dmtccnc.combined.raw >> > >> >> Please note that your entire application is hardly a "small, complete >> example". >> While I did download your code from the svn and ran it, but >> understand that it makes the job difficult and reduces your chance of >> getting help from the developers (or other users). >> > > I know it is getting complex even for myself. Lots of data source and trying > to make a general reading routine is somewhat lowering the readability. You > should have seen this same code without classes in action. That NasaFile > class has helped me alot actually, but the extra functionality also adds > lots of lines of code there, too. Thinking of moving this to a GUI. > Nevertheless for the time being I am talking in a more speculative way. > > >> >> > I have changed the code as you suggested. Here is the result: >> > http://img44.imageshack.us/img44/1075/newsso.png >> > >> > Two things I notice, right y-axis label is gone, and latter the top >> > x-axis >> > nicely added there but it a replicate of bottom x-axis. Doing this: >> >> For the diappearing label, >> unfortunately, the axes_grid toolkits has slightly different behavior >> from mainline mpl. >> >> >> http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html#id5 >> >> >> http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/axislines.html >> >> Adding >> >> pary.axis["right"].label.set_visible(True) >> >> in your code will work. > > Thanks, this worked. > >> >> At second thought, this might be a bug in the axes_grid toolkit. >> >> For your second point. >> There is a reason that I used a factor 3600 in my first example. >> >> aux_trans = mtransforms.Affine2D().scale(3600., y_max) # transform >> from ax2 to ax1 > > Added this line to the code: > > aux_trans = mtransforms.Affine2D().translate(0., 0.).\ > scale(3600, dccn.data['dccnConSTP'].max()) > > See how the output looks like : > http://img18.imageshack.us/img18/5056/newss2.png > > As you might see, the pary plotting disappears, when I use this scaling > which seemingly correct scaling for my case. It remedies the top axis > properly. They are correct equivalences of second-from-midnight > representation of time, i.e 45000 --> 12:30:00 (12.5) > > When I play a little bit more in IPython (Still experiment, not in a > production stage :)) when the figure is up: > > pary.xaxis.set_major_formatter(DateFormatter('%H:%M:%S')) > > Then it turns wrong: http://img3.imageshack.us/img3/4707/newss3.png > Either my understanding, or somethings internally in formatting code. > > So close, these things are not easy to figure out. And to me these are > beyond advanced matplotlib functionality. I will put a more simplified > sample code once I figure out this. > > Thank you again. > > > > > > >> >> You need to try to understand the units for date-time display and then >> figure out the correct transform for your need. >> If you try 3600, the unit will show as hours. But you may need some >> more work to make it fit your need. >> >> -JJ >> >> >> > >> > from matplotlib.dates import DateFormatter, HourLocator >> > locator = HourLocator() >> > pary.xaxis.set_major_locator(locator) >> > formatter = DateFormatter(r'$%H^h >> > ) >> > ax2.xaxis.set_major_formatter(formatter) >> > >> > results with my IPython session crashed: >> > >> > RuntimeError: Locator attempting to generate 216001 ticks from 41000.0 >> > to >> > 50000.0: exceeds Locator.MAXTICKS >> > >> > >> > I want to be able see in this fashion: >> > >> > I[3]: current_axis = gca() >> > I[4]: current_axis.xaxis.set_major_formatter(DateFormatter('%H:%M:%S')) >> > >> > but this returns the bottom x-axis and changes them to all 00:00:00. > > > > -- > Gökhan > ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users