|
From: Maciej K. <kur...@gm...> - 2014-08-25 15:50:39
|
Ben, The adjusting and aspect solution works just perfect, thanks for your fast answer. Although i still want to ask for another solution for reloading a plot, because i don't like the idea of serialization and writing to disk. From what i've found even if i have a variables handling figure and axis when i quit the window some part of it probably form the window framework are deleted anyway. In this case i think i can redraw all the artists on the newly created figure somehow but is there a relatively simple way to just set up new window and attach the old figure there? Maciej W dniu 25.08.2014 o 16:00, Benjamin Root pisze: > Maciej, > > When you close a figure, just about everything gets destroyed (this is > why you should always savefig() prior to doing a show()). There is a > mechanism for "reloading" a plot using python pickles: > http://stackoverflow.com/questions/7290370/store-and-reload-matplotlib-pyplot-object > > As for setting the aspect ratio to 'equal', there is a second optional > argument that indicates which thing should get adjusted to achieve an > equal aspect. By default, it is 'datalim', I think, which adjusts the > limits of the axes. I think if you set it to 'box', it will do what > you want (you might need 'box-forced' if you are sharing axes). Fiddle > around with these settings to get what you want. > http://matplotlib.org/api/axes_api.html#matplotlib.axes.Axes.set_aspect > > To have the axes extended on the whole figure area, there are multiple > ways to do that. In particular, you can set the margins for the figure: > http://matplotlib.org/api/pyplot_api.html?highlight=subplots_adjust#matplotlib.pyplot.subplots_adjust > > All of this would work just fine with autoscale. > > I hope that helps! > Ben Root > > > > On Mon, Aug 25, 2014 at 7:00 AM, Maciej Kurnicki <kur...@gm... > <mailto:kur...@gm...>> wrote: > > I'm using matplotlib for drawing lines, points and circles > basically. I > have 2 problems i can't solve by myself and it's hard to solve > them not > digging into source i think. > First problem: I got an instance of figure class and i want to > preserve > it during closing and reopening the output window. I'm curious what is > happening after clicking on close button on the main widow and is > there > any way to reopen previously saved figure, and if yes how to save that > figure for future reopenings. > Second problem: I want to achieve 3 things simultaneously, > a) have the axes extended on the whole figure area > b) unit distance on y axis has to be the same as unit distance on > x axis > c) all above has to work well with autoscale(), i want to have a > lot of > artists on the axes > The best thing i have is setting aspect as equal and using autoscale, > but it fix axes to be same lenght and i don't want axes to be same > length i want the unit distance to be the same > > Thanks for any help, > Maciek > > ------------------------------------------------------------------------------ > Slashdot TV. > Video for Nerds. Stuff that matters. > http://tv.slashdot.org/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > <mailto:Mat...@li...> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |