You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
(12) |
Sep
(12) |
Oct
(56) |
Nov
(65) |
Dec
(37) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(59) |
Feb
(78) |
Mar
(153) |
Apr
(205) |
May
(184) |
Jun
(123) |
Jul
(171) |
Aug
(156) |
Sep
(190) |
Oct
(120) |
Nov
(154) |
Dec
(223) |
| 2005 |
Jan
(184) |
Feb
(267) |
Mar
(214) |
Apr
(286) |
May
(320) |
Jun
(299) |
Jul
(348) |
Aug
(283) |
Sep
(355) |
Oct
(293) |
Nov
(232) |
Dec
(203) |
| 2006 |
Jan
(352) |
Feb
(358) |
Mar
(403) |
Apr
(313) |
May
(165) |
Jun
(281) |
Jul
(316) |
Aug
(228) |
Sep
(279) |
Oct
(243) |
Nov
(315) |
Dec
(345) |
| 2007 |
Jan
(260) |
Feb
(323) |
Mar
(340) |
Apr
(319) |
May
(290) |
Jun
(296) |
Jul
(221) |
Aug
(292) |
Sep
(242) |
Oct
(248) |
Nov
(242) |
Dec
(332) |
| 2008 |
Jan
(312) |
Feb
(359) |
Mar
(454) |
Apr
(287) |
May
(340) |
Jun
(450) |
Jul
(403) |
Aug
(324) |
Sep
(349) |
Oct
(385) |
Nov
(363) |
Dec
(437) |
| 2009 |
Jan
(500) |
Feb
(301) |
Mar
(409) |
Apr
(486) |
May
(545) |
Jun
(391) |
Jul
(518) |
Aug
(497) |
Sep
(492) |
Oct
(429) |
Nov
(357) |
Dec
(310) |
| 2010 |
Jan
(371) |
Feb
(657) |
Mar
(519) |
Apr
(432) |
May
(312) |
Jun
(416) |
Jul
(477) |
Aug
(386) |
Sep
(419) |
Oct
(435) |
Nov
(320) |
Dec
(202) |
| 2011 |
Jan
(321) |
Feb
(413) |
Mar
(299) |
Apr
(215) |
May
(284) |
Jun
(203) |
Jul
(207) |
Aug
(314) |
Sep
(321) |
Oct
(259) |
Nov
(347) |
Dec
(209) |
| 2012 |
Jan
(322) |
Feb
(414) |
Mar
(377) |
Apr
(179) |
May
(173) |
Jun
(234) |
Jul
(295) |
Aug
(239) |
Sep
(276) |
Oct
(355) |
Nov
(144) |
Dec
(108) |
| 2013 |
Jan
(170) |
Feb
(89) |
Mar
(204) |
Apr
(133) |
May
(142) |
Jun
(89) |
Jul
(160) |
Aug
(180) |
Sep
(69) |
Oct
(136) |
Nov
(83) |
Dec
(32) |
| 2014 |
Jan
(71) |
Feb
(90) |
Mar
(161) |
Apr
(117) |
May
(78) |
Jun
(94) |
Jul
(60) |
Aug
(83) |
Sep
(102) |
Oct
(132) |
Nov
(154) |
Dec
(96) |
| 2015 |
Jan
(45) |
Feb
(138) |
Mar
(176) |
Apr
(132) |
May
(119) |
Jun
(124) |
Jul
(77) |
Aug
(31) |
Sep
(34) |
Oct
(22) |
Nov
(23) |
Dec
(9) |
| 2016 |
Jan
(26) |
Feb
(17) |
Mar
(10) |
Apr
(8) |
May
(4) |
Jun
(8) |
Jul
(6) |
Aug
(5) |
Sep
(9) |
Oct
(4) |
Nov
|
Dec
|
| 2017 |
Jan
(5) |
Feb
(7) |
Mar
(1) |
Apr
(5) |
May
|
Jun
(3) |
Jul
(6) |
Aug
(1) |
Sep
|
Oct
(2) |
Nov
(1) |
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2025 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Alexey S. <sh...@gm...> - 2012-11-09 11:20:33
|
Thank you for 1.2.0 release! Could you please make it clear that matplotlib requires python.org-Python sourceforge.net-NumPy? Telling about it during installation would be great. I've lost an hour trying to figure out why matplotlib installer [1] doesn't let me choose my system HD, saying "matplotlib requires System Python 2.7 to install". Figuring out the correct NumPy version was also confusing. First I made a mistake by install numpy via system `easy_install`: $ easy_install numpy Ooops, wrong numpy. Let's download and install official NumPy [2]: $ /usr/local/bin/python -c "import pylab" RuntimeError: module compiled against API version 6 but this version of numpy is 4 ... ImportError: numpy.core.multiarray failed to import Hmm, it still tries to use wrong numpy. Let's remove it: $ /usr/local/bin/python -c "import numpy; print numpy.__file__" /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/__init__.py $ sudo rm -rf /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy Hooray: $ /usr/local/bin/python -c "import pylab" [1]: https://github.com/downloads/matplotlib/matplotlib/matplotlib-1.2.0-py2.7-python.org-macosx10.6.dmg [2]: http://sourceforge.net/projects/numpy/files/NumPy/1.6.2/numpy-1.6.2-py2.7-python.org-macosx10.6.dmg/download -- Alexey On Fri, Nov 9, 2012 at 4:57 AM, Michael Droettboom <md...@st...> wrote: > After months of hard work by a veritable army of contributors, I'm pleased > to announce the release of matplotlib 1.2.0. > > This is the first time we've released without the assistance of John Hunter, > who is sorely missed. I hope this is at least a small way to say thanks for > all of his great work. > > Release tarballs and binaries are available on github. (They are no longer > being made available on SourceForge). > > https://github.com/matplotlib/matplotlib/downloads > > This is the first release to support Python 3.x (and as a result drops > support for Pythons earlier than 2.6). There is new support for outputting > PGF/TikZ files. New plot types include 3D trisurface plots, and > streamplots. Tripcolor, boxplot, colorbars and contour plots have all grown > new features. And under the hood, numerous improvements in stability, > flexibility and robustness. For a complete list, see the "what's new" page: > > http://matplotlib.org/users/whats_new.html > > For an even more detailed list of 698 issues (!) resolved since the last > release, see the github statistics page: > > http://matplotlib.org/users/github_stats.html > > Enjoy! As always, there are number of good ways to get help with matplotlib > listed on the homepage at http://matplotlib.org/ and I thank everyone for > their continued support of this project. > > Mike > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_nov > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: klo uo <kl...@gm...> - 2012-11-09 01:50:20
|
Congratulation, team! Binary installer for 32-bit Windows, built using python.org's 2.7 and Numpy 1.6.2 is listed but file is not found. I guess it's boiling now, and will be available soon ;) On Fri, Nov 9, 2012 at 1:57 AM, Michael Droettboom <md...@st...> wrote: > After months of hard work by a veritable army of contributors, I'm > pleased to announce the release of matplotlib 1.2.0. > > This is the first time we've released without the assistance of John > Hunter, who is sorely missed. I hope this is at least a small way to say > thanks for all of his great work. > > Release tarballs and binaries are available on github. (They are no > longer being made available on SourceForge). > > https://github.com/matplotlib/matplotlib/downloads > > This is the first release to support Python 3.x (and as a result drops > support for Pythons earlier than 2.6). There is new support for outputting > PGF/TikZ files. New plot types include 3D trisurface plots, and > streamplots. Tripcolor, boxplot, colorbars and contour plots have all > grown new features. And under the hood, numerous improvements in > stability, flexibility and robustness. For a complete list, see the > "what's new" page: > > http://matplotlib.org/users/whats_new.html > > For an even more detailed list of 698 issues (!) resolved since the last > release, see the github statistics page: > > http://matplotlib.org/users/github_stats.html > > Enjoy! As always, there are number of good ways to get help with > matplotlib listed on the homepage at http://matplotlib.org/ and I thank > everyone for their continued support of this project. > > Mike > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_nov > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |
|
From: Michael D. <md...@st...> - 2012-11-09 00:57:17
|
After months of hard work by a veritable army of contributors, I'm pleased to announce the release of matplotlib 1.2.0. This is the first time we've released without the assistance of John Hunter, who is sorely missed. I hope this is at least a small way to say thanks for all of his great work. Release tarballs and binaries are available on github. (They are no longer being made available on SourceForge). https://github.com/matplotlib/matplotlib/downloads This is the first release to support Python 3.x (and as a result drops support for Pythons earlier than 2.6). There is new support for outputting PGF/TikZ files. New plot types include 3D trisurface plots, and streamplots. Tripcolor, boxplot, colorbars and contour plots have all grown new features. And under the hood, numerous improvements in stability, flexibility and robustness. For a complete list, see the "what's new" page: http://matplotlib.org/users/whats_new.html For an even more detailed list of 698 issues (!) resolved since the last release, see the github statistics page: http://matplotlib.org/users/github_stats.html Enjoy! As always, there are number of good ways to get help with matplotlib listed on the homepage at http://matplotlib.org/ and I thank everyone for their continued support of this project. Mike |
|
From: Sebastian R. <seb...@gm...> - 2012-11-08 15:23:48
|
Hi guys,
I have a problem with the "set_array" function. In a example from the
matplotlib homepage this works fine, but when I tries to adaot to my needs,
the image just stays the same. No Update, but also no error messages:
see On Timer function --> the plot is just created during the start but
never updated again. If I use imshow all the time, it works, but my
intention was not to use imshow allover, just update the image data.
Any ideas?
Cheers,
Sebi
Here is the code:
#!/usr/bin/env python
"""
"""
import sys, time, os, gc
import matplotlib
matplotlib.use('WXAgg')
from matplotlib import rcParams
import matplotlib.cm as cm
import numpy as np
import optparse
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg
from matplotlib.backends.backend_wx import NavigationToolbar2Wx
from matplotlib.figure import Figure
from wx import *
TIMER_ID = NewId()
class PlotFigure(Frame):
def __init__(self):
Frame.__init__(self, None, -1, "Test embedded wxFigure")
self.fig = Figure((8,6), 100)
self.canvas = FigureCanvasWxAgg(self, -1, self.fig)
self.toolbar = NavigationToolbar2Wx(self.canvas)
self.toolbar.Realize()
# On Windows, default frame size behaviour is incorrect
# you don't need this under Linux
tw, th = self.toolbar.GetSizeTuple()
fw, fh = self.canvas.GetSizeTuple()
self.toolbar.SetSize(Size(fw, th))
# Create a figure manager to manage things
# Now put all into a sizer
sizer = BoxSizer(VERTICAL)
# This way of adding to sizer allows resizing
sizer.Add(self.canvas, 1, LEFT|TOP|GROW)
# Best to allow the toolbar to resize!
sizer.Add(self.toolbar, 0, GROW)
self.SetSizer(sizer)
self.Fit()
EVT_TIMER(self, TIMER_ID, self.onTimer)
def init_plot_data(self):
# initialize data array and plot for the 1st time
self.data = np.zeros([96])
# create matrix which will contain the number of counted cells
well96 = np.zeros([8,12])
# read in cell numbers
#Nr = 8 # number of rows
#Nc = 12 # number of columns
#labelx = ['1','2','3','4','5','6','7','8','9','10','11','12']
#labely = ['A','B','C','D','E','F','G','H']
ax1 = self.fig.add_axes([0.075,0.1,0.75,0.85])
self.cax = self.fig.add_axes([0.85,0.1,0.075,0.85])
self.im = ax1.imshow(well96, cmap=cm.jet, interpolation='nearest')
self.fig.colorbar(self.im, cax=self.cax, orientation='vertical')
#self.ax1.set_xticks(np.arange(0,12,1))
#self.ax1.set_xticklabels(labelx)
#self.ax1.set_yticks(np.arange(0,8,1))
#self.ax1.set_yticklabels(labely)
#self.ax1.set_title('Cell Count per Well')
def GetToolBar(self):
# You will need to override GetToolBar if you are using an
# unmanaged toolbar in your frame
return self.toolbar
def onTimer(self, evt):
datain = np.loadtxt(options.filename, delimiter=';')
self.data[0:len(datain[:,1])] = datain[:,1]
welldata = self.data.reshape(8,12)
print welldata
self.im.set_array(welldata)
#self.im = self.ax1.imshow(welldata, cmap=cm.jet, interpolation='nearest')
self.fig.colorbar(self.im, cax=self.cax,orientation='vertical')
self.canvas.draw()
def onEraseBackground(self, evt):
# this is supposed to prevent redraw flicker on some X servers...
pass
if __name__ == '__main__':
# configure parsing option for command line usage
parser = optparse.OptionParser()
parser.add_option('-f', '--file',
action="store", dest="filename",
help="query string", default="spam")
# read command line arguments
options, args = parser.parse_args()
print 'Filename:', options.filename
app = PySimpleApp()
frame = PlotFigure()
frame.init_plot_data()
# Initialise the timer - wxPython requires this to be connected to
# the receiving event handler
t = Timer(frame, TIMER_ID)
t.Start(1000)
frame.Show()
app.MainLoop()
|
|
From: Damon M. <dam...@gm...> - 2012-11-08 13:44:11
|
On Thursday, November 8, 2012, Alejandro Weinstein wrote: > If you are in a Linux machine, you can use `inotify`: "Inotify (inode > notify) is a Linux kernel subsystem that acts to extend filesystems to > notice changes to the filesystem". > > It seems that there are a few option to use this from Python: > > http://pyinotify.sourceforge.net/ > http://code.activestate.com/recipes/576375-low-level-inotify-wrapper/ > > Alejandro. > > On Thu, Nov 8, 2012 at 1:34 AM, Sebastian Rhode <seb...@gm...<javascript:;>> > wrote: > > Hi, > > > > I have a textfile where every second a line is written. Usually the look > > like this: > > > > 1; 124; 455 > > > > a second later > > > > 1; 124; 455 > > 2; 104; 600 > > > > ... > > > > Finally such a file is quite easy to plot using matplotlib. But what > would > > be very useful for me is a script, that is watching the TXT file and > updates > > the plot when a new row "arrives". Any good ideas? > > > > Cheers, > > > > Sebi > > > > > > > ------------------------------------------------------------------------------ > > Everyone hates slow websites. So do we. > > Make your web apps faster with AppDynamics > > Download AppDynamics Lite for free today: > > http://p.sf.net/sfu/appdyn_d2d_nov > > _______________________________________________ > > Matplotlib-users mailing list > > Mat...@li... <javascript:;> > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_nov > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... <javascript:;> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > In bash: watch -n1 tail file.txt -- Damon McDougall http://www.damon-is-a-geek.com B2.39 Mathematics Institute University of Warwick Coventry West Midlands CV4 7AL United Kingdom |
|
From: Alejandro W. <ale...@gm...> - 2012-11-08 13:23:21
|
If you are in a Linux machine, you can use `inotify`: "Inotify (inode notify) is a Linux kernel subsystem that acts to extend filesystems to notice changes to the filesystem". It seems that there are a few option to use this from Python: http://pyinotify.sourceforge.net/ http://code.activestate.com/recipes/576375-low-level-inotify-wrapper/ Alejandro. On Thu, Nov 8, 2012 at 1:34 AM, Sebastian Rhode <seb...@gm...> wrote: > Hi, > > I have a textfile where every second a line is written. Usually the look > like this: > > 1; 124; 455 > > a second later > > 1; 124; 455 > 2; 104; 600 > > ... > > Finally such a file is quite easy to plot using matplotlib. But what would > be very useful for me is a script, that is watching the TXT file and updates > the plot when a new row "arrives". Any good ideas? > > Cheers, > > Sebi > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_nov > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: Miha P. <mp...@gm...> - 2012-11-08 08:48:59
|
Hi,
You could use the time module.
import time
while 1:
time.sleep(5) # freezes for 5 s
update plot
This should be less CPU consuming ...
lpmp
On Thu, Nov 8, 2012 at 9:41 AM, francesco oteri
<fra...@gm...>wrote:
> Hi,
> what about opening-closing the file every now and then, for example every
> 5seconds?
> you can do it using the function time(). It gives you the amount of time
> since I don't kno when,
> but you can count how many seconds are left using:
>
> a=time()
> while 1:
> b=time()
> left= b-a
> if left == 5sec:
> updating plot
>
> Actually is very cpu consuming, but it is the best I can propose :(
>
>
> Francesco
>
>
>
> 2012/11/8 Sebastian Rhode <seb...@gm...>
>
>> Hi,
>>
>> I have a textfile where every second a line is written. Usually the look
>> like this:
>>
>> 1; 124; 455
>>
>> a second later
>>
>> 1; 124; 455
>> 2; 104; 600
>>
>> ...
>>
>> Finally such a file is quite easy to plot using matplotlib. But what
>> would be very useful for me is a script, that is watching the TXT file and
>> updates the plot when a new row "arrives". Any good ideas?
>>
>> Cheers,
>>
>> Sebi
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Everyone hates slow websites. So do we.
>> Make your web apps faster with AppDynamics
>> Download AppDynamics Lite for free today:
>> http://p.sf.net/sfu/appdyn_d2d_nov
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
>
> --
> Cordiali saluti, Dr.Oteri Francesco
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_nov
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
|
|
From: francesco o. <fra...@gm...> - 2012-11-08 08:41:58
|
Hi,
what about opening-closing the file every now and then, for example every
5seconds?
you can do it using the function time(). It gives you the amount of time
since I don't kno when,
but you can count how many seconds are left using:
a=time()
while 1:
b=time()
left= b-a
if left == 5sec:
updating plot
Actually is very cpu consuming, but it is the best I can propose :(
Francesco
2012/11/8 Sebastian Rhode <seb...@gm...>
> Hi,
>
> I have a textfile where every second a line is written. Usually the look
> like this:
>
> 1; 124; 455
>
> a second later
>
> 1; 124; 455
> 2; 104; 600
>
> ...
>
> Finally such a file is quite easy to plot using matplotlib. But what would
> be very useful for me is a script, that is watching the TXT file and
> updates the plot when a new row "arrives". Any good ideas?
>
> Cheers,
>
> Sebi
>
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_nov
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
Cordiali saluti, Dr.Oteri Francesco
|
|
From: Sebastian R. <seb...@gm...> - 2012-11-08 08:35:30
|
Hi, I have a textfile where every second a line is written. Usually the look like this: 1; 124; 455 a second later 1; 124; 455 2; 104; 600 ... Finally such a file is quite easy to plot using matplotlib. But what would be very useful for me is a script, that is watching the TXT file and updates the plot when a new row "arrives". Any good ideas? Cheers, Sebi |
|
From: Chloe L. <ch...@be...> - 2012-11-07 17:34:47
|
> > I think a histogram isn't the thing I need because it is not important > when (the time) the values between 60 and 90 have been "created". Only > the values and the amount of values is important. You can make the values the independent axis of the histogram. > > Also when talking about a colormap I'm not sure if this is required. In > the end I want only one color (blue) in a rectangle that changes the > color/appearance based on the density. So I guess to bluescale it is the > right way as you suggested. > I think custom blue scale can only be done as a custom colormap; but R and G will be constant throughout. &C |
|
From: <ra...@0x...> - 2012-11-07 13:26:24
|
Hi! I think a histogram isn't the thing I need because it is not important when (the time) the values between 60 and 90 have been "created". Only the values and the amount of values is important. Also when talking about a colormap I'm not sure if this is required. In the end I want only one color (blue) in a rectangle that changes the color/appearance based on the density. So I guess to bluescale it is the right way as you suggested. And as you said, the min density value would be 60 and the max density value would be 90. I think I will make those values fix. As you told the "colorbar" might not mean the same on a later time. This is no problem and basically the goal of it. Cool, I guess this is the concept to be implemented. I'm searching for ways to bluescale with matplotlib.. I have hacked a little code snipped. I think it does what I desire, except of one thing left. Some of the little "elements" I draw do overlap and I dont know why. I print the values to plot on the x-axis to the console. As you see the x-coordinates do not overlap.. Does anyone know what the problem is? from matplotlib.ticker import MultipleLocator import numpy as np import matplotlib.pyplot as plt import random import array from pylab import gca # Source: http://stackoverflow.com/questions/8500700/how-to-plot-a-gradient-color-line-in-matplotlib #CONSTANTS NPOINTS = 100 COLOR='blue' RESFACT=10 MAP='winter' # choose carefully, or color transitions will not appear smooth FIGRES=111.0 # figure size: must be float! # create random data np.random.seed() x = [] tmp = 0 while tmp < NPOINTS: x.append(random.randrange(60, 98, 1)) tmp = tmp+1 fake_y_array = np.array([0]) a = 0 while a < NPOINTS-1: fake_y_array = np.append(fake_y_array, 0) a = a+1 y = fake_y_array x = sorted(x) #print x fig = plt.figure() ax4 = fig.add_subplot(FIGRES) # high resolution alpha npointsHiRes = len(x) stats = dict() for index in x: #stats.insert(index, stats[index] + 1) try: stats[index] = stats[index] + 1 except: stats[index] = 1 print stats # alpha is the transparency parameter # based on the more values we have, the smaller is the # difference between transparency per element in the graph # we multiply this alpha with a given factor to make the elements # appear visible enough for the human eye alpha_steps = (1.0/len(stats))*1 for i in range(npointsHiRes): #print 'x: ' + str(x[i]) #print 'stats: ' + str(stats[x[i]]) + ' (a) ' + str(alpha_steps*stats[x[i]]) if x[i] is x[i-1]: # skip this round because we already # have drawn one element # and based on its transparency # it is expressed how many times this # value exists continue ytmp = y[i:i+2] xtmp = x[i:i+2] try: if xtmp[0] is xtmp[1]: # ok if they equal, we cannot draw a visible line # +1 to draw it.. xtmp[1] = xtmp[1]+1 except IndexError: # last element is sometimes "alone" # so we add an effectively last one # to draw it with eye-visibility xtmp.append(xtmp[0]+1) a = np.array([0]) ytmp = np.hstack((ytmp, a)) ax4.plot(xtmp,ytmp, alpha=alpha_steps*stats[x[i]], color=COLOR, lw=100) #drawstyle: [ 'default' | 'steps' | 'steps-pre' | 'steps-mid' | 'steps-post' ] ax4.set_xlim(min(x),max(x)+1) gca().xaxis.set_major_locator(MultipleLocator((round(len(x)/FIGRES))*2)) gca().yaxis.set_major_locator(MultipleLocator()) plt.grid(True) #fig.savefig('gradColorLine.png') plt.show() On 11/06/2012 01:25 AM, Chloe Lewis wrote: > You're translating a histogram of your data into a colormap, yes? > > The matplotlib histogram returns bins and patches, which you could translate into color intensities; but I bet scipy.stats.histogram would be easier. Then the bin centers are the segment boundaries of the colormap, and the weight in each bin is the respective color intensity. > > Also, color has a finite extent but the bin weight might not. You'll need to choose a nominal max value to norm the colors to, and decide whether to use the same max value all the time (so early plots might all be light, late plots all dark) or calculate it from the data each time you plot (in which case the colorbar this month might not mean the same thing as the color bar last month). > > I think using all three of RGB is too confusing -- do it bluescale or grayscale. > > &C > > > > > On Nov 5, 2012, at 7:13 AM, ra...@0x... wrote: > >> Hi Chloe >> >> Thank you for answering. >> >> I agree the way you suggest. Currently I have done this: >> >> import matplotlib >> import matplotlib.pyplot as plt >> >> # http://matplotlib.org/examples/api/colorbar_only.html >> # >> http://matplotlib.org/api/colors_api.html#matplotlib.colors.LinearSegmentedColormap >> >> >> # The lookup table is generated using linear interpolation for each >> primary color, with the 0-1 domain divided into any number of segments. >> # x, y0, y1 >> cdict = {'red': [(0.0, 0.0, 0.0), >> (0.5, 1.0, 1.0), >> (1.0, 1.0, 1.0)], >> >> 'green': [(0.0, 0.0, 0.0), >> (0.25, 0.0, 0.0), >> (0.75, 1.0, 1.0), >> (1.0, 1.0, 1.0)], >> >> 'blue': [(0.0, 0.0, 0.0), >> (0.5, 0.0, 0.0), >> (1.0, 1.0, 1.0)]} >> >> # create colormap >> my_cmap = matplotlib.colors.LinearSegmentedColormap("my_colormap", >> cdict, N=256, gamma=1.0) >> >> # optional: register colormap >> #plt.register_cmap(name='my_colormap', data=cdict) >> >> fig = plt.figure(figsize=(5,1)) >> fig.subplots_adjust(top=0.99, bottom=0.01, left=0.2, right=0.99) >> plt.axis("off") >> import numpy as np >> a = np.linspace(0, 1, 256).reshape(1,-1) >> a = np.vstack((a,a)) >> plt.imshow(a, aspect='auto', cmap=my_cmap, origin='lower') >> >> plt.show() >> >> Now the tricky part has still to be done. I have a varying number (ca. >> 500, increasing) of values between 60 and 90. Those values must be >> represented in the colorbar. White if there is no value, blue towards >> black the more values are in the same area. >> For this, I guess, I have to set a x for each value (and three x since >> the color is calculated using RGB). And the closer it is to the previous >> one the more I have to calculate the color between blue and black. >> >> Or do you suggest another way to implement this? >> >> I do not know of any other software that this issue has been implemented. >> >> cheers! >> >> >> On 10/26/2012 07:47 PM, Chloe Lewis wrote: >>> you'll be doing something like the second color bar, but making the >>> boundary and color definitions a lot more flexible. Where the discrete >>> color bar uses >>> >>> cmap = mpl.colors.ListedColormap(['r', 'g', 'b', 'c']) >>> bounds = [1, 2, 4, 7, 8] >>> >>> you'll be making a whole LinearSegmentedColormap, see >>> >>> http://matplotlib.org/api/colors_api.html#matplotlib.colors.LinearSegmentedColormap >>> >>> and check out specifically the ascii-art explanation of interpolation between row[i] and row[i+1]. Red, green, blue will break based on your data density and how you want to express 'intensity'. And depending on whether you'll make it red-green-colorblindness neutral! >>> >>> Interesting problem. Has it been implemented in some other software? >>> >>> >>> Chloe Lewis >>> PhD candidate, Harte Lab >>> Division of Ecosystem Sciences, ESPM >>> University of California, Berkeley >>> 137 Mulford Hall >>> Berkeley, CA 94720 >>> ch...@be... <mailto:ch...@be...> >>> > |
|
From: mpelko <mp...@gm...> - 2012-11-06 09:49:20
|
I would also love to have this implemented. That is being able to not only set the colors, but also the alpha values as an array. -- View this message in context: http://matplotlib.1069221.n5.nabble.com/scatter-plot-individual-alpha-values-tp21106p39671.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: Marian J. <mja...@ta...> - 2012-11-06 08:03:27
|
Thanks for your reply. It's really nice. But, can you provide the code
(part of it) where the colormap start from "very light gray" to "black"
in the range (0,1). And all of the points >1 are black one and =0.0 IS
NOT white. I have 2D map with defined pair (x,y) and the values for
them, but also there are the pairs where I defined the value out of
range (z=5.). So I would like to show the 2D map in grayscale ((x,y),z)
but use WHITE color for z=5. Because when I set "cm.set_over('white')"
and the white is also for z=0.0 (not shifted colormap), you can't
distinguish these values - if it is z=5 or z=0. Of course, the possible
way is to use rgb colormaps (not grayscale) but I can't do it because I
need BW version of the figure.
Thanks in advance for your help.
Dňa Mon, 5 Nov 2012 22:50:31 +0100
klo uo <kl...@gm...> napísal:
> I asked same question with different problem here:
> http://matplotlib.1069221.n5.nabble.com/How-to-shift-colormap-td18451.html
>
> You can see there how to use Gimp and create mpl colormap and then later
> there is nifty code that will allow you to shift colormaps with a slider
>
> >From your problem I assume you would want the first.
>
> Here is ready made for you:
>
> ========================================
> import matplotlib as mpl
> import matplotlib.pyplot as plt
>
> ccm = {
> 'red' : (
> (0.000000, 0.000000, 0.000000),
> (0.000001, 1.000000, 1.000000),
> (0.500000, 0.500000, 0.500000),
> (1.000000, 0.000000, 0.000000)
> ),
> 'green' : (
> (0.000000, 0.000000, 0.000000),
> (0.000001, 1.000000, 1.000000),
> (0.500000, 0.500000, 0.500000),
> (1.000000, 0.000000, 0.000000)
> ),
> 'blue' : (
> (0.000000, 0.000000, 0.000000),
> (0.000001, 1.000000, 1.000000),
> (0.500000, 0.500000, 0.500000),
> (1.000000, 0.000000, 0.000000)
> )
> }
>
> cm = mpl.colors.LinearSegmentedColormap('my_map', ccm)
>
> from numpy import outer, arange, ones
> a = outer(arange(0, 1, 0.01), ones(10))
>
> plt.imshow(a, cmap=cm)
> plt.show()
> ========================================
|
|
From: Chloe L. <ch...@be...> - 2012-11-06 00:25:14
|
You're translating a histogram of your data into a colormap, yes? The matplotlib histogram returns bins and patches, which you could translate into color intensities; but I bet scipy.stats.histogram would be easier. Then the bin centers are the segment boundaries of the colormap, and the weight in each bin is the respective color intensity. Also, color has a finite extent but the bin weight might not. You'll need to choose a nominal max value to norm the colors to, and decide whether to use the same max value all the time (so early plots might all be light, late plots all dark) or calculate it from the data each time you plot (in which case the colorbar this month might not mean the same thing as the color bar last month). I think using all three of RGB is too confusing -- do it bluescale or grayscale. &C On Nov 5, 2012, at 7:13 AM, ra...@0x... wrote: > Hi Chloe > > Thank you for answering. > > I agree the way you suggest. Currently I have done this: > > import matplotlib > import matplotlib.pyplot as plt > > # http://matplotlib.org/examples/api/colorbar_only.html > # > http://matplotlib.org/api/colors_api.html#matplotlib.colors.LinearSegmentedColormap > > > # The lookup table is generated using linear interpolation for each > primary color, with the 0-1 domain divided into any number of segments. > # x, y0, y1 > cdict = {'red': [(0.0, 0.0, 0.0), > (0.5, 1.0, 1.0), > (1.0, 1.0, 1.0)], > > 'green': [(0.0, 0.0, 0.0), > (0.25, 0.0, 0.0), > (0.75, 1.0, 1.0), > (1.0, 1.0, 1.0)], > > 'blue': [(0.0, 0.0, 0.0), > (0.5, 0.0, 0.0), > (1.0, 1.0, 1.0)]} > > # create colormap > my_cmap = matplotlib.colors.LinearSegmentedColormap("my_colormap", > cdict, N=256, gamma=1.0) > > # optional: register colormap > #plt.register_cmap(name='my_colormap', data=cdict) > > fig = plt.figure(figsize=(5,1)) > fig.subplots_adjust(top=0.99, bottom=0.01, left=0.2, right=0.99) > plt.axis("off") > import numpy as np > a = np.linspace(0, 1, 256).reshape(1,-1) > a = np.vstack((a,a)) > plt.imshow(a, aspect='auto', cmap=my_cmap, origin='lower') > > plt.show() > > Now the tricky part has still to be done. I have a varying number (ca. > 500, increasing) of values between 60 and 90. Those values must be > represented in the colorbar. White if there is no value, blue towards > black the more values are in the same area. > For this, I guess, I have to set a x for each value (and three x since > the color is calculated using RGB). And the closer it is to the previous > one the more I have to calculate the color between blue and black. > > Or do you suggest another way to implement this? > > I do not know of any other software that this issue has been implemented. > > cheers! > > > On 10/26/2012 07:47 PM, Chloe Lewis wrote: >> you'll be doing something like the second color bar, but making the >> boundary and color definitions a lot more flexible. Where the discrete >> color bar uses >> >> cmap = mpl.colors.ListedColormap(['r', 'g', 'b', 'c']) >> bounds = [1, 2, 4, 7, 8] >> >> you'll be making a whole LinearSegmentedColormap, see >> >> http://matplotlib.org/api/colors_api.html#matplotlib.colors.LinearSegmentedColormap >> >> and check out specifically the ascii-art explanation of interpolation between row[i] and row[i+1]. Red, green, blue will break based on your data density and how you want to express 'intensity'. And depending on whether you'll make it red-green-colorblindness neutral! >> >> Interesting problem. Has it been implemented in some other software? >> >> >> Chloe Lewis >> PhD candidate, Harte Lab >> Division of Ecosystem Sciences, ESPM >> University of California, Berkeley >> 137 Mulford Hall >> Berkeley, CA 94720 >> ch...@be... <mailto:ch...@be...> >> |
|
From: Brad M. <bra...@gm...> - 2012-11-05 22:38:59
|
> > > > Essentially, you want a similar behavior to the markers in the scatter > plots, right? As you zoom or resize the plot, the circle markers stay as > circles and have the same size relative to the size of the figure. If that > is what you want, the way to do that is very easy. > > ax1.scatter([0.5], [0.5], s=30) > > Or whatever size you want (units of points). > > I hope that helps! > Ben Root > > Hi Ben, Thanks. I actually tried this before and it didn't appear to work for me. But I think the problem was that I thought s was the radius in units of my axes, and so was simply not seeing the dot on top of the line that was already there. I was just choosing values that were way too small to see. This should meet my needs. I wonder if you would mind expanding on that sentence? Does the example I > provide do what you want? > > Thanks, > Phil Phil, thanks for this example as well. It also would work for my purposes. All I meant by that sentence is that, in my real script, I am plotting a bunch of lines as well, and I just wanted these circles to also be present in the plot (the example code I attached was simply the circles/ellipses). Best, Brad |
|
From: Jason G. <jas...@cr...> - 2012-11-05 22:23:33
|
On 11/5/12 3:50 PM, klo uo wrote: > You can see there how to use Gimp and create mpl colormap and then later > there is nifty code that will allow you to shift colormaps with a slider Nice! I couldn't resist doing a Sage interact version of the slider thing: http://aleph.sagemath.org/?q=89b0c945-2ce3-4645-bf61-dbe0eed2c5cd&lang=sage Thanks, Jason -- Jason Grout |
|
From: klo uo <kl...@gm...> - 2012-11-05 21:50:39
|
I asked same question with different problem here: http://matplotlib.1069221.n5.nabble.com/How-to-shift-colormap-td18451.html You can see there how to use Gimp and create mpl colormap and then later there is nifty code that will allow you to shift colormaps with a slider >From your problem I assume you would want the first. Here is ready made for you: ======================================== import matplotlib as mpl import matplotlib.pyplot as plt ccm = { 'red' : ( (0.000000, 0.000000, 0.000000), (0.000001, 1.000000, 1.000000), (0.500000, 0.500000, 0.500000), (1.000000, 0.000000, 0.000000) ), 'green' : ( (0.000000, 0.000000, 0.000000), (0.000001, 1.000000, 1.000000), (0.500000, 0.500000, 0.500000), (1.000000, 0.000000, 0.000000) ), 'blue' : ( (0.000000, 0.000000, 0.000000), (0.000001, 1.000000, 1.000000), (0.500000, 0.500000, 0.500000), (1.000000, 0.000000, 0.000000) ) } cm = mpl.colors.LinearSegmentedColormap('my_map', ccm) from numpy import outer, arange, ones a = outer(arange(0, 1, 0.01), ones(10)) plt.imshow(a, cmap=cm) plt.show() ======================================== |
|
From: Phil E. <pel...@gm...> - 2012-11-05 21:26:55
|
Hi Brad,
I didn't quite follow what it was that you were trying to achieve, but the
following example may be of interest to you:
import matplotlib.pyplot as plt
from matplotlib.patches import Ellipse, Circle
import matplotlib.transforms as mtrans
fig = plt.figure()
ax1 = fig.add_subplot(111)
x_in_axes_coords, y_in_axes_coords = 0.5, 0.5
radius_in_axes = 0.3
coords = [[x_in_axes_coords, y_in_axes_coords],
[x_in_axes_coords + radius_in_axes, y_in_axes_coords]]
coords = ax1.transAxes.transform(coords)
x_device, y_device = coords[0, :]
radius = coords[1, 0] - x_device
circle = Circle((x_device, y_device), radius,
transform=mtrans.IdentityTransform())
fig.artists.append(circle)
plt.show()
Clearly, you will always have circles with this approach (the circle is
defined in device coordinates, i.e. pixels),
but with the way this is implemented, it does not behave in the same way as
axes coordinates do when you resize your window.
> I am trying to plot some small circles in my plotting window, in addition
to the curves I'm already plotting.
I wonder if you would mind expanding on that sentence? Does the example I
provide do what you want?
Thanks,
Phil
On 5 November 2012 20:51, Brad Malone <bra...@gm...> wrote:
> Hello,
>
> I am trying to plot some small circles in my plotting window, in addition
> to the curves I'm already plotting. If I don't want to set my x- and y-
> axis scales equal to each other, a naive drawing of a circle results in an
> ellipse. To fix this problem I found some nice example code online here :
> http://stackoverflow.com/questions/9230389/why-is-matplotlib-plotting-my-circles-as-ovals,
> which solves the problem by basically plotting an ellipse, but an ellipse
> which will look like a circle in the display window.
>
> That works all fine for me, but then, if I change my xlim or ylim using
> ax1.set_xlim((something1,something2)) then the solution no longer works,
> and I get an ellipse.
>
> A minimal example showing the breaking behavior can be seen below.
>
>
>
> import matplotlib.pyplot as plt
>> from matplotlib.patches import Ellipse, Circle
>>
>> fig = plt.figure()
>> ax1 = fig.add_subplot(111)
>> # uncomment the following line to see it break
>> #ax1.set_xlim((0.2,1))
>>
>> # calculate asymmetry of x and y axes:
>> x0, y0 = ax1.transAxes.transform((0, 0)) # lower left in pixels
>> x1, y1 = ax1.transAxes.transform((1, 1)) # upper right in pixes
>> dx = x1 - x0
>> dy = y1 - y0
>> maxd = max(dx, dy)
>> width = .15 * maxd / dx
>> height = .15 * maxd / dy
>> # a circle you expect to be a circle, but it is not
>> ax1.add_artist(Circle((.5, .5), .15))
>> # an ellipse you expect to be an ellipse, but it's a circle
>> ax1.add_artist(Ellipse((.75, .75), width, height))
>>
>> plt.show()
>
>
> I suppose the problem is that ax1.transAxes.transform commands return the
> same numbers, regardless of whether I've changed the limits or not. Is
> there an easy and clean way to fix this (perhaps a different command for
> getting x0,y0,x1, and y1)?
>
> Thanks for the help!
>
> Best,
> Brad
>
>
>
> ------------------------------------------------------------------------------
> LogMeIn Central: Instant, anywhere, Remote PC access and management.
> Stay in control, update software, and manage PCs from one command center
> Diagnose problems and improve visibility into emerging IT issues
> Automate, monitor and manage. Do more in less time with Central
> http://p.sf.net/sfu/logmein12331_d2d
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
|
|
From: Benjamin R. <ben...@ou...> - 2012-11-05 21:26:12
|
On Mon, Nov 5, 2012 at 4:22 PM, Jason Grout <jas...@cr...>wrote: > On 11/5/12 3:19 PM, Benjamin Root wrote: > > > > > > On Mon, Nov 5, 2012 at 3:51 PM, Brad Malone <bra...@gm... > > <mailto:bra...@gm...>> wrote: > > > > Hello, > > > > I am trying to plot some small circles in my plotting window, in > > addition to the curves I'm already plotting. If I don't want to set > > my x- and y- axis scales equal to each other, a naive drawing of a > > circle results in an ellipse. To fix this problem I found some nice > > example code online here : > > > http://stackoverflow.com/questions/9230389/why-is-matplotlib-plotting-my-circles-as-ovals > , > > which solves the problem by basically plotting an ellipse, but an > > ellipse which will look like a circle in the display window. > > > > That works all fine for me, but then, if I change my xlim or ylim > > using ax1.set_xlim((something1,something2)) then the solution no > > longer works, and I get an ellipse. > > > > A minimal example showing the breaking behavior can be seen below. > > > > > > I am probably gonna reply to that stackoverflow question with a better > > response... > > > > Essentially, you want a similar behavior to the markers in the scatter > > plots, right? As you zoom or resize the plot, the circle markers stay > > as circles and have the same size relative to the size of the figure. > > If that is what you want, the way to do that is very easy. > > > > ax1.scatter([0.5], [0.5], s=30) > > > > Or whatever size you want (units of points). > > I think the units are points^2, i.e., area of the circle... > > Thanks, > > Jason > > Right, thank you. I keep forgetting that. Ben Root |
|
From: Jason G. <jas...@cr...> - 2012-11-05 21:22:57
|
On 11/5/12 3:19 PM, Benjamin Root wrote: > > > On Mon, Nov 5, 2012 at 3:51 PM, Brad Malone <bra...@gm... > <mailto:bra...@gm...>> wrote: > > Hello, > > I am trying to plot some small circles in my plotting window, in > addition to the curves I'm already plotting. If I don't want to set > my x- and y- axis scales equal to each other, a naive drawing of a > circle results in an ellipse. To fix this problem I found some nice > example code online here : > http://stackoverflow.com/questions/9230389/why-is-matplotlib-plotting-my-circles-as-ovals, > which solves the problem by basically plotting an ellipse, but an > ellipse which will look like a circle in the display window. > > That works all fine for me, but then, if I change my xlim or ylim > using ax1.set_xlim((something1,something2)) then the solution no > longer works, and I get an ellipse. > > A minimal example showing the breaking behavior can be seen below. > > > I am probably gonna reply to that stackoverflow question with a better > response... > > Essentially, you want a similar behavior to the markers in the scatter > plots, right? As you zoom or resize the plot, the circle markers stay > as circles and have the same size relative to the size of the figure. > If that is what you want, the way to do that is very easy. > > ax1.scatter([0.5], [0.5], s=30) > > Or whatever size you want (units of points). I think the units are points^2, i.e., area of the circle... Thanks, Jason |
|
From: Benjamin R. <ben...@ou...> - 2012-11-05 21:20:16
|
On Mon, Nov 5, 2012 at 3:51 PM, Brad Malone <bra...@gm...> wrote: > Hello, > > I am trying to plot some small circles in my plotting window, in addition > to the curves I'm already plotting. If I don't want to set my x- and y- > axis scales equal to each other, a naive drawing of a circle results in an > ellipse. To fix this problem I found some nice example code online here : > http://stackoverflow.com/questions/9230389/why-is-matplotlib-plotting-my-circles-as-ovals, > which solves the problem by basically plotting an ellipse, but an ellipse > which will look like a circle in the display window. > > That works all fine for me, but then, if I change my xlim or ylim using > ax1.set_xlim((something1,something2)) then the solution no longer works, > and I get an ellipse. > > A minimal example showing the breaking behavior can be seen below. > I am probably gonna reply to that stackoverflow question with a better response... Essentially, you want a similar behavior to the markers in the scatter plots, right? As you zoom or resize the plot, the circle markers stay as circles and have the same size relative to the size of the figure. If that is what you want, the way to do that is very easy. ax1.scatter([0.5], [0.5], s=30) Or whatever size you want (units of points). I hope that helps! Ben Root |
|
From: Brad M. <bra...@gm...> - 2012-11-05 20:51:32
|
Hello, I am trying to plot some small circles in my plotting window, in addition to the curves I'm already plotting. If I don't want to set my x- and y- axis scales equal to each other, a naive drawing of a circle results in an ellipse. To fix this problem I found some nice example code online here : http://stackoverflow.com/questions/9230389/why-is-matplotlib-plotting-my-circles-as-ovals, which solves the problem by basically plotting an ellipse, but an ellipse which will look like a circle in the display window. That works all fine for me, but then, if I change my xlim or ylim using ax1.set_xlim((something1,something2)) then the solution no longer works, and I get an ellipse. A minimal example showing the breaking behavior can be seen below. import matplotlib.pyplot as plt > from matplotlib.patches import Ellipse, Circle > > fig = plt.figure() > ax1 = fig.add_subplot(111) > # uncomment the following line to see it break > #ax1.set_xlim((0.2,1)) > > # calculate asymmetry of x and y axes: > x0, y0 = ax1.transAxes.transform((0, 0)) # lower left in pixels > x1, y1 = ax1.transAxes.transform((1, 1)) # upper right in pixes > dx = x1 - x0 > dy = y1 - y0 > maxd = max(dx, dy) > width = .15 * maxd / dx > height = .15 * maxd / dy > # a circle you expect to be a circle, but it is not > ax1.add_artist(Circle((.5, .5), .15)) > # an ellipse you expect to be an ellipse, but it's a circle > ax1.add_artist(Ellipse((.75, .75), width, height)) > > plt.show() I suppose the problem is that ax1.transAxes.transform commands return the same numbers, regardless of whether I've changed the limits or not. Is there an easy and clean way to fix this (perhaps a different command for getting x0,y0,x1, and y1)? Thanks for the help! Best, Brad |
|
From: Marian J. <mja...@ta...> - 2012-11-05 20:35:00
|
Hi all, I am a newbie in matplotlib and I'd like to use colormap for z-axis. I can use in basic mode but would like to shift the existed colormap - binary - for using in this way: i would not like to set the white color for z=0.0 For describing: I would like to use the binary colormap but without the white color because this color I would like to leave for not-defined value for (x,y). Is it possible to do this? Maybe create new colormap on the basis of the "binary" but without the white color. Any suggestions? Thanks in advance for your help. best, Marian |
|
From: Hans B. <han...@ar...> - 2012-11-05 19:17:20
|
On Fri, 02 Nov 2012 16:45:22 +0100, <mat...@li...> wrote: > Message: 5 > Date: Fri, 2 Nov 2012 12:01:35 +0100 > From: Vlastimil Brom <vla...@gm...> > Subject: Re: [Matplotlib-users] Figures piling up in Tkinter GUI > (1.2.0rc2) > To: mat...@li... > Message-ID: > <CAH...@ma...> > Content-Type: text/plain; charset=ISO-8859-1 > 2012/11/1 Hans Bering <han...@ar...>: >> Hello everybody, >> >> I'm building a small Tkinter GUI using matplotlib, in which I have to >> change/update plots quite often depending on user input (with different >> contents & sizes, in different places in the GUI, etc.; but always only >> one figure at a time). >> >> As a first resort, I regenerated the figures with plt.figure(...) >> whenever necessary; unfortunately, the program happily accumulated >> memory with >> every new figure until the computer would no longer cooperate in a >> timely fashion. The following minimal script should demonstrate the >> tendency: >> > ... > > Hi, > I'd recommend to use an embedded plot and only clear and replace its > content [...] > I only roughly adapted that source to use your function and the memory > usage appears to be more effective (although there is some increase > too - as displayed in Process Explorer). Would some variation of the > following work for you? [...] Hi Vlastimil, thanks for your effort; I had tried the approach of clearing & replacing the plot myself, too. Unfortunately, that approach has a different problem: Because of the figure's size, I have to present it with scrollbars, and clearing & reusing the plot does not seem to work when resizing & scrolling the plot. I had posted that problem as a question at Stackoverflow (as http://stackoverflow.com/questions/13197469 ), since I hoped it might be "easier"; i.e., just a misunderstanding on my part of how to wire together the scrollbars/canvas/figure. Please note that, while I also use plt.figure(...) in the post at Stackoverflow, the effect remains the same when using Figure(...) and ax.plot(...). So basically I'm stuck between a rock and a hard place - I can either have the memory issue reported previously; or the plot won't behave properly with scrolling+resizing. I am wondering: Should repeatedly creating Figures in a Tkinter GUI work, and could this be a Matplotlib bug worth mentioning on some bug tracker? Thanks & Regards Hans |
|
From: Bob K. <rnk...@ya...> - 2012-11-05 03:24:52
|
It looks like I have found a solution. I work for many hours on a problem
before posting so I am surprised I found this only one day after posting my
original question. I went digging in places I am not sure I should and came
with this command that appears to be a solution to my focus problem. It
would be nice to know from an expert if this the recommended method for
forcing focus in Matplotlib.
The command:
fig.canvas.get_tk_widget().focus_force()
My original demo code with the new command showing the focus behavior I
want:
import matplotlib.pyplot as plt
plt.ion()
fig = plt.figure(figsize=(10,8))
ax = fig.add_axes([.15,.1,.8,.65])
ax.plot([1,2,3])
ax.set_title('Fisrt Plot')
fig.canvas.get_tk_widget().focus_force()
raw_input('Enter to close and Continue: ')
#plt.close(fig)
fig2 = plt.figure(figsize=(10,8))
ax = fig2.add_axes([.15,.1,.8,.65])
ax.plot([1,2,3])
ax.set_title('Second Plot')
fig2.canvas.get_tk_widget().focus_force()
raw_input('Enter to close and Continue: ')
#plt.close(fig2)
fig.canvas.get_tk_widget().focus_force()
raw_input('Enter to close and Continue: ')
Bob Kestner
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Force-focus-on-Figure-tp39652p39654.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
|