[Matplotlib-users] Questions about GUIs
Hi, I am trying to use matplotlib to visually explore certain different representation of images. I have the core functionality done. This allows to explore one image that appears on two subplots w/ the possibility to highlight regions on either subplot and see the corresponding one on the other. What I have left to do is to provide some mean to select the image one wants to explore. I tried to follow some advice given on this list, but it seems gui dialogs (file selection in this case) don't get along well with the thread tricks done by ipython to maintain interactivity while using matplotlib (ipython started w/ -gthread or -pylab option). If I start ipython without options, the dialogs do respond, but then I loose the ipython shell. Am I trying to do something out of normal with matplotlib? I would appreciate any advice or pointers that would allow me overcome these limitations. Jorge -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] imshow with side plots whitespace problem
The axes_grid toolkit is base on use cases for images of aspect 1, and I haven't carefully considered cases where the aspect is different from 1. And I guess this is one of such cases I overlooked. Please try to add below lines in your code (I couldn't try your code because of the missing data file, but it works with the the scatter example you referred). ax.set_aspect(auto) divider.set_aspect(True) divider.get_horizontal()[0]._aspect=0.5 The interface should be improved but I guess this will work. Regards, -JJ On Fri, Jul 24, 2009 at 1:19 PM, Jeff Thomasjeff.thomas...@gmail.com wrote: Currently, I am trying to plot a 2D array with imshow and two 1D arrays on separate plots attached to the top and right of the imshow image. I got it to work, however when I change the aspect of the image (which I want to do) white space and unusual scalings appear. I want to get rid of it and have the scales that match the aspect. Basically, I want to do the same thing shown in the example http://matplotlib.sourceforge.net/examples/axes_grid/scatter_hist.html attached is the result with out the aspect change. also attached is the result with aspect change attempt. here is the code that produces the result above: import numpy as np import tables from matplotlib.pyplot import * import matplotlib as mpl import matplotlib.cm as cm fig = figure(figsize=[12.5,7.5]) from mpl_toolkits.axes_grid import make_axes_locatable #get 3D array from hdf5 file a = tables.openFile(/Users/magoo/vorpal-data-2/unl-1mm-3d_ElecMultiField_25.h5) b = a.root.ElecMultiField[ : , : , : ,1] ax = fig.add_subplot(111) ax.set_autoscale_on(False) divider = make_axes_locatable(ax) axLOutx = divider.new_vertical(1, pad=0.3, sharex=ax) fig.add_axes(axLOutx) #plot line above axLOutx.plot(b[365,:,75]) axLOutx.set_xlim( (0,145)) axLOuty = divider.new_horizontal(2, pad=0.5, sharey=ax) fig.add_axes(axLOuty) #plot line on right yarr = np.arange(0, np.shape(b[:, 75, 75])[0], 1) axLOuty.plot(b[:,75,75], yarr) axLOuty.set_ylim( (769,0)) # plot image/2D array im = ax.imshow(b[:,:,75], extent=[0,145,769,0],cmap=cm.jet) # when I add (aspect = .5) as another argument I get what is shown in the second attached image cb = colorbar(im, fraction=0.015) plt.draw() plt.show() -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] square plots with linear equal axes -- help
Hi This should be so simple, but I have been struggling for a long time trying to create a square plot of exact dimensions (so a series of them can be overlaid later), with x and y axis limits identical and set by me (preferably without the plot limits updating automatically as I add or delete data, but that is a separate issue), while working interactively on a single plot using pyplot in ipython on OS X using the current enthought distribution. with pyplot imported as plt, typical of what I have tried are many variations on plt.plot(*args) with args a list of x,y sets fig = plt.gcf() fig.set_size_inches(6,6,forward='True')to force a redraw ax = plt.gca() ax.grid(True) plt.axis([1.0,10.0,1.0,10.0]) plt.draw() Sometimes the x axis is set correctly, but the y axis is not, and is typically showing more range (approximately 0.8-10.1 for example), possibly because the plot is not square, though it is close, or because the scales are not equal. I have tried adding 'equal' to the plt.axis command, and entering the values as plt.axis(xmin=1.0,xmax=10.0,ymin=1.0,ymax=10.0) and entering just the first three and then plt.axis('equal') and I have tried working with ax.set_aspect('equal') But, I am truly lost as I try to sort out which elements are in control. Any help or leads would be greatly appreciated. Scanning old archives and googling has not yet got me there. kersey -- View this message in context: http://www.nabble.com/square-plots-with-linear-equal-axes-help-tp24638812p24638812.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users