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
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
|
|
1
(2) |
2
(3) |
3
|
4
(3) |
5
(11) |
6
(3) |
7
(2) |
8
(6) |
9
(6) |
10
(8) |
11
(3) |
12
(7) |
13
(8) |
14
(5) |
15
(11) |
16
(11) |
17
(3) |
18
(2) |
19
(7) |
20
(11) |
21
(6) |
22
(5) |
23
(1) |
24
|
25
|
26
(6) |
27
(3) |
28
(8) |
29
(2) |
30
(1) |
|
Hi, I found when usetex is set to be True, \mathbb cannot return blackboard bold font. A minimum reproducing code of mine is: import matplotlib.pyplot as plt from matplotlib import rcParams params = { 'backend':'ps', 'ps.usedistiller':'xpdf', 'axes.labelsize':22, 'text.fontsize':20, 'legend.fontsize':20, 'xtick.labelsize':20, 'ytick.labelsize':20, 'text.usetex':True, 'latex.preamble':r'\usepackage{amsmath,amsfonts,amssymb}', 'figure.figsize':[8,6], 'font.family':'serif', 'font.serif':'Times New Roman' } rcParams.update(params) plt.plot([0,1],[0,1],'r-',lw=3,label=r"Using $\mathbb{D}^p$") plt.legend() plt.show() I want to keep my rcParams settings as unchanged as possible. Ning -- View this message in context: http://matplotlib.1069221.n5.nabble.com/use-mathbb-when-usetex-True-tp39887.html Sent from the matplotlib - users mailing list archive at Nabble.com.
2012年11月28日 Angus McMorland <am...@gm...> > I think your problem is with clipping. Try the no_clip function in > this thread [1] and see if that helps. > > [1] > http://matplotlib.1069221.n5.nabble.com/How-to-turn-off-all-clipping-td1813.html#a1814 > Hi Angus, I tried the no_clip function but it didn't worked: https://gist.github.com/4171341 Any idea? Thank you. -- Vilson Vieira vi...@vo... ((( http://automata.cc ))) ((( http://musa.cc ))) ((( http://labmacambira.sourceforge.net )))
Hi all, AFAIK it is currently not possible to modify the ticks of a plot within the "Figure options" window. Is it planned to add this feature to the "Figure options" window ? How can I modify the default path in the Navigation Toolbar if I launch the file save dialog by clicking the save button ? http://matplotlib.org/users/navigation_toolbar.html Nils
Sterling, Thanks - I ended up adding an extra y-tick with minor=True. Something along these lines: # Add Fermi line y = self._bandstructure.fermiLevel() self._axes.axhline(y=y, linestyle=':') # Add Fermi tick tick = self._axes.set_yticks([y], minor=True)[0] tick.label1On = False tick.label2On = True self._axes.set_yticklabels([r'$\epsilon_\mathrm{F}$'], minor=True, fontsize=font_size*1.19, verticalalignment='center') Evil? On 28/11/2012 17:35, Sterling Smith wrote: > Mads, > > I recommend trying a text object[1], with a transform which is a blended transform from a transform factory[2]. Also, you probably want the x coordinate in axes coordinates, with a left horizontal alignment. > > -Sterling > > [1] http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.text > [2] http://matplotlib.org/users/transforms_tutorial.html#blended-transformations > > > On Nov 28, 2012, at 4:27AM, Mads Ipsen wrote: > >> Hi, >> >> I would like to add a label or tick label for an axhline(), in such a way that the labels follows the location of the hline. >> >> The x-coordinate of the label should be in screen coordinates (a little to the right of the plot) - but the y-coordinate should be in data coordinates. >> >> Any good suggestions? >> >> Best regards, >> >> Mads >> >> -- >> +-----------------------------------------------------+ >> | Mads Ipsen | >> +----------------------+------------------------------+ >> | Gåsebæksvej 7, 4. tv | | >> | DK-2500 Valby | phone: +45-29716388 | >> | Denmark | email: >> mad...@gm... >> | >> +----------------------+------------------------------+ >> >> >> ------------------------------------------------------------------------------ >> Keep yourself connected to Go Parallel: >> INSIGHTS What's next for parallel hardware, programming and related areas? >> Interviews and blogs by thought leaders keep you ahead of the curve. >> http://goparallel.sourceforge.net_______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- +-----------------------------------------------------+ | Mads Ipsen | +----------------------+------------------------------+ | Gåsebæksvej 7, 4. tv | | | DK-2500 Valby | phone: +45-29716388 | | Denmark | email: mad...@gm... | +----------------------+------------------------------+
On 28 November 2012 15:28, Vilson Vieira <vi...@vo...> wrote: > Hi, > > I'm using matplotlib to draw some generative art works. I'm trying to hide > the axis but when I do that the lines that are over the axis are hidden as > well, like this example: http://i.imgur.com/hKqMi.png > > The code I'm using to generate those kind of random walk plots is here: > https://gist.github.com/4164025 > > I already tried subplots_adjust, and set_alpha/set_visible on axis and > spines but anything worked. I think your problem is with clipping. Try the no_clip function in this thread [1] and see if that helps. [1] http://matplotlib.1069221.n5.nabble.com/How-to-turn-off-all-clipping-td1813.html#a1814 Angus -- AJC McMorland Post-doctoral research fellow Neurobiology, University of Pittsburgh
Hi, I'm using matplotlib to draw some generative art works. I'm trying to hide the axis but when I do that the lines that are over the axis are hidden as well, like this example: http://i.imgur.com/hKqMi.png The code I'm using to generate those kind of random walk plots is here: https://gist.github.com/4164025 I already tried subplots_adjust, and set_alpha/set_visible on axis and spines but anything worked. Any help? Thank you so much. -- Vilson Vieira vi...@vo... ((( http://automata.cc ))) ((( http://musa.cc ))) ((( http://labmacambira.sourceforge.net )))
Mads, I recommend trying a text object[1], with a transform which is a blended transform from a transform factory[2]. Also, you probably want the x coordinate in axes coordinates, with a left horizontal alignment. -Sterling [1] http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.text [2] http://matplotlib.org/users/transforms_tutorial.html#blended-transformations On Nov 28, 2012, at 4:27AM, Mads Ipsen wrote: > Hi, > > I would like to add a label or tick label for an axhline(), in such a way that the labels follows the location of the hline. > > The x-coordinate of the label should be in screen coordinates (a little to the right of the plot) - but the y-coordinate should be in data coordinates. > > Any good suggestions? > > Best regards, > > Mads > > -- > +-----------------------------------------------------+ > | Mads Ipsen | > +----------------------+------------------------------+ > | Gåsebæksvej 7, 4. tv | | > | DK-2500 Valby | phone: +45-29716388 | > | Denmark | email: > mad...@gm... > | > +----------------------+------------------------------+ > > > ------------------------------------------------------------------------------ > Keep yourself connected to Go Parallel: > INSIGHTS What's next for parallel hardware, programming and related areas? > Interviews and blogs by thought leaders keep you ahead of the curve. > http://goparallel.sourceforge.net_______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Hi Folks- I'm working on a plot using an Aitoff projection, and I've noticed a couple of problems: 1. There seems a problem with the positioning of contour labels in some of the projections. In the Aitoff, Lambert, and Mollweide projections, the some of the contour labels appear to be shifted. In the Hammer projection of my example one of them (0.524) looks to be slightly off, but it's close enough. The polar projection is fine. 2. When saving the output in eps format, the Aitoff, Hammer, and Lambert projections are producing postscript that cannot be interpreted by ghostview. I've copied a minimal script to demonstrate the problem at the end of this email. Any ideas? Thanks in advance! --Chad import numpy as np from numpy import arccos, sin, cos, pi import matplotlib.pyplot as plt # setup the contour grid X = np.arange(-180.0,180.0, 1) * pi/180 Y = np.arange(-90.0,90.0, 1) * pi/180 Z = np.zeros([len(Y), len(X)]) # compute the contour field for x in range(0,360,1): for y in range(0,180,1): Z[y,x] = arccos(sin(pi/4)*sin(Y[y]) + cos(pi/4)*cos(Y[y])*cos(-90*pi/180 - X[x])) f=[]; ax=[]; for projection in ["hammer", "aitoff", "lambert", "mollweide", "polar"]: f.append(plt.figure()) ax.append(plt.subplot(111, projection=projection)) plt.grid("on") Cplot = plt.contour(X,Y,Z, np.array([30.0, 60, 90, 120, 150])*pi/180) plt.clabel(Cplot, inline=1) plt.savefig("contourLabels{}.png".format(projection)) plt.savefig("contourLabels{}.eps".format(projection))
Hi, I would like to add a label or tick label for an axhline(), in such a way that the labels follows the location of the hline. The x-coordinate of the label should be in screen coordinates (a little to the right of the plot) - but the y-coordinate should be in data coordinates. Any good suggestions? Best regards, Mads -- +-----------------------------------------------------+ | Mads Ipsen | +----------------------+------------------------------+ | Gåsebæksvej 7, 4. tv | | | DK-2500 Valby | phone: +45-29716388 | | Denmark | email: mad...@gm... | +----------------------+------------------------------+
Hi Phil, Le 28/11/2012 12:58, Phil Elson a écrit : > I've just submitted a pull request > (https://github.com/matplotlib/matplotlib/pull/1540) to get the mpl > docs to link to the nabble archive instead > (http://matplotlib.1069221.n5.nabble.com/matplotlib-users-f3.html > <http://matplotlib.1069221.n5.nabble.com/matplotlib-users-f3.html>). Great ! I'm not so familiar with the nabble archive service, but at first glance it looks way better than sourceforge (beyond the fact their archiving service is pretty dead ;-) ). Best, Pierre
Hi Pierre, Thanks for raising this (sorry we haven't got back to you sooner). The mailing list isn't dead, but the archiving link certainly makes it look like it is. I've just submitted a pull request ( https://github.com/matplotlib/matplotlib/pull/1540) to get the mpl docs to link to the nabble archive instead (http:// matplotlib.1069221.n5.nabble.com/matplotlib-users-f3.html). FYI There are a couple of topics related to this which I will raise in the mpl-devel mailing list sortly. Thanks, Phil On 4 October 2012 08:55, Pierre Haessig <pie...@cr...> wrote: > Hi, > > Is it just my web browser getting crazy or is there a real issue with > the ML archive on sourceforge: > http://sourceforge.net/mailarchive/forum.php?forum_name=matplotlib-users > > I only see email records until July 16th 2012 !! > > If there is another ML archive website in better shape, it would be > worth updating the link on matplotlib.org front page > ("Documentation/need help?" section) > > Best, > Pierre > > > > > > ------------------------------------------------------------------------------ > Don't let slow site performance ruin your business. Deploy New Relic APM > Deploy New Relic app performance management and know exactly > what is happening inside your Ruby, Python, PHP, Java, and .NET app > Try New Relic at no cost today and get our sweet Data Nerd shirt too! > http://p.sf.net/sfu/newrelic-dev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > >
Hi I just wanted to let you know that I did some work on tkinter to have a tabbed backend, It is in early stages but "it works" If you want to give it a try it is available on https://github.com/fariza/MPL-Experimental-Backend Let me know if you have any comments. Cheers Federico -- Y yo que culpa tengo de que ellas se crean todo lo que yo les digo? -- Antonio Alducin --
On Monday, November 26, 2012 14:10:31 Eric Firing wrote: > But how many colors can you actually distinguish on the screen, or in a > plot? My impression is that the problem is not lack of colors, but > rather mapping to the color you want. There is no reason that having a > value in your *data* of 1e10 has to affect how numbers in your data over > a "normal" range are mapped. > > You are trying to illustrate the problem with an example using 3 colors, > so how can the number of colors in the colormap be the fundamental > limitation? Ok, I understand. I think that my linear interpolation code has to somewhat be written in a norm instead. At some time, I have looked at examples on Matplotlib website, and at the code of pyshared/matplotlib/colors.py, but without having the "flash" to write the norm. The next time I will try to write a norm instead (I will put the code here of course). TP
On 2012年11月26日 12:18 PM, TP wrote: > On Monday, November 26, 2012 12:06:40 Eric Firing wrote: >> I'm glad you found a solution, but my sense is that the problem is that >> you are trying to make the colormap do the work of the norm. The >> colormap is just a set of discrete colors, with a linear mapping to the >> 0-1 scale (apart from the special under, over, and invalid values). The >> norm is for mapping your data to those colors, however you like, by >> mapping your data to the 0-1 range (again with possible under, over, and >> invalid values). Did you consider making a custom norm instead of >> modifying the colormap? > > Yes, I did. > The problem with the default colormap is that it has not enough colors. I have > found (I may be wrong) that no norm can change this state of affair. If you are > able to find a norm to make my example work, i.e. to obtain the middle point in > blue when large_value is for example 1e10, I am interested. But how many colors can you actually distinguish on the screen, or in a plot? My impression is that the problem is not lack of colors, but rather mapping to the color you want. There is no reason that having a value in your *data* of 1e10 has to affect how numbers in your data over a "normal" range are mapped. You are trying to illustrate the problem with an example using 3 colors, so how can the number of colors in the colormap be the fundamental limitation? Eric > > TP > > ------------------------------------------------------------------------------ > Monitor your physical, virtual and cloud infrastructure from a single > web console. Get in-depth insight into apps, servers, databases, vmware, > SAP, cloud infrastructure, etc. Download 30-day Free Trial. > Pricing starts from 795ドル for 25 servers or applications! > http://p.sf.net/sfu/zoho_dev2dev_nov > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >
On Monday, November 26, 2012 12:06:40 Eric Firing wrote: > I'm glad you found a solution, but my sense is that the problem is that > you are trying to make the colormap do the work of the norm. The > colormap is just a set of discrete colors, with a linear mapping to the > 0-1 scale (apart from the special under, over, and invalid values). The > norm is for mapping your data to those colors, however you like, by > mapping your data to the 0-1 range (again with possible under, over, and > invalid values). Did you consider making a custom norm instead of > modifying the colormap? Yes, I did. The problem with the default colormap is that it has not enough colors. I have found (I may be wrong) that no norm can change this state of affair. If you are able to find a norm to make my example work, i.e. to obtain the middle point in blue when large_value is for example 1e10, I am interested. TP
On Tue, Nov 20, 2012 at 8:12 PM, Stephen Gibson <Ste...@an...>wrote: > Ok. Adding an NaN as the last data point did not help. > > However, I notice that the return path is two segments that go through > (0,0). > > i.e. the baseline (or return) path may actually start/finish at (0,0) > > The attached image shows my data offset in y-direction by +1. The end > points > have been set to y=0.5. The baseline (or return path) is the line segment > that > starts at the first data point, passes through (x=0,y=0), and ends at the > last > data point. > > Steve. > > Actually, this might be related to a bug that was pointed out to me a while back that I just could not figure out. Having this example might help in narrowing down the cause. Essentially, the (0,0) vertex was being added even when it shouldn't have been. The key difference in this example is that zdir='y' is used, which causes the (0,0) vertex to refer to the x,z coordinate. Interesting... I will have to investigate further. Ben Root
On 2012年11月26日 11:37 AM, TP wrote: > On Thursday, November 22, 2012 23:51:08 TP wrote: >> Thus it seems to me that my dummy example given in the previous post covers >> exactly the problem encountered in my real-world imshow function. >> >> Is there a memory-efficient workaround in my dummy example (instead of >> increasing N)? > > I have modified LinearSegmentedColormap so as to solve my problem. The > difference is that I do not create an huge array in my test case, but instead I > interpolate linearly in the colormap. This is a quick and dirty code that > does work in my case, but which does not deal with all cases (no management of > transparency, no discontinuity in the colormap, etc.) I'm glad you found a solution, but my sense is that the problem is that you are trying to make the colormap do the work of the norm. The colormap is just a set of discrete colors, with a linear mapping to the 0-1 scale (apart from the special under, over, and invalid values). The norm is for mapping your data to those colors, however you like, by mapping your data to the 0-1 range (again with possible under, over, and invalid values). Did you consider making a custom norm instead of modifying the colormap? Eric > > ##################### > from __future__ import division > from pylab import * > from matplotlib.colors import LinearSegmentedColormap > from matplotlib.collections import CircleCollection > > from scipy.interpolate import interp1d > > > class ContinuousLinearSegmentedColormap( LinearSegmentedColormap ): > > def __init__(self, name, segmentdata, gamma=1.0): > > LinearSegmentedColormap.__init__( self > , name, segmentdata, gamma = gamma ) > > def _init(self): > > self.N = len( self._segmentdata['red'] ) > self._lut = np.ones((self.N, 5), np.float) > for i in range( self.N ): > self._lut[i, 0] = self._segmentdata['red'][i][0] > # 2 because I do not manage discontinuities in color > self._lut[i, 1] = self._segmentdata['red'][i][2] > self._lut[i, 2] = self._segmentdata['green'][i][2] > self._lut[i, 3] = self._segmentdata['blue'][i][2] > > self._isinit = True > > > def __call__(self, X, alpha=None, bytes=False): > > if not self._isinit: self._init() > mask_bad = None > if not cbook.iterable(X): > vtype = 'scalar' > xa = np.array([X]) > else: > vtype = 'array' > xma = ma.array(X, copy=False) > mask_bad = xma.mask > xa = xma.data.copy() # Copy here to avoid side effects. > del xma > > lut = self._lut.copy() > rgba = np.empty(shape=xa.shape+(4,), dtype=lut.dtype) > > # We construct interpolation functions. > fred = interp1d( lut[:,0], lut[:,1]) > fgreen = interp1d( lut[:,0], lut[:,2]) > fblue = interp1d( lut[:,0], lut[:,3]) > > rgba[:,3] = 1 # alpha=1 for the time being > for i in range( xa.shape[0] ): > rgba[i,0] = fred( xa[i] ) > rgba[i,1] = fgreen( xa[i] ) > rgba[i,2] = fblue( xa[i] ) > > if vtype == 'scalar': > rgba = tuple(rgba[0,:]) > return rgba > > > ioff() > > > large_value = 257 # blue above this value > large_value = 258 # black above this value > large_value = 1e8 > > cdict = { 'blue': [(0.0, 0.0, 0.0) > , (2*1/large_value, 1, 1) > , (1.0, 1.0, 1.0)] > , 'green': [(0.0, 0.0, 0.0) > , (2*1/large_value, 0, 0) > , (1.0, 1.0, 1.0)] > , 'red': [(0.0, 0.0, 0.0) > , (2*1/large_value, 0, 0) > , (1.0, 1.0, 1.0)] } > > measures= array( [[ 0.2, 0.3, 0], > [ 0.3, 0.4, 2], > [ 0.5, 0.6, large_value]] ) > > cmap = ContinuousLinearSegmentedColormap( "cmap foobar" > , cdict > ) > > fig = figure() > axes = fig.add_subplot(111) > ec = CircleCollection( [80] > , offsets = measures[:,:2] > , transOffset = axes.transData > ) > > ec.set_array( measures[:,2] ) > ec.set_cmap( cmap ) > axes.add_collection( ec ) > > show() > ##################### > > ------------------------------------------------------------------------------ > Monitor your physical, virtual and cloud infrastructure from a single > web console. Get in-depth insight into apps, servers, databases, vmware, > SAP, cloud infrastructure, etc. Download 30-day Free Trial. > Pricing starts from 795ドル for 25 servers or applications! > http://p.sf.net/sfu/zoho_dev2dev_nov > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >
On Thursday, November 22, 2012 23:51:08 TP wrote: > Thus it seems to me that my dummy example given in the previous post covers > exactly the problem encountered in my real-world imshow function. > > Is there a memory-efficient workaround in my dummy example (instead of > increasing N)? I have modified LinearSegmentedColormap so as to solve my problem. The difference is that I do not create an huge array in my test case, but instead I interpolate linearly in the colormap. This is a quick and dirty code that does work in my case, but which does not deal with all cases (no management of transparency, no discontinuity in the colormap, etc.) ##################### from __future__ import division from pylab import * from matplotlib.colors import LinearSegmentedColormap from matplotlib.collections import CircleCollection from scipy.interpolate import interp1d class ContinuousLinearSegmentedColormap( LinearSegmentedColormap ): def __init__(self, name, segmentdata, gamma=1.0): LinearSegmentedColormap.__init__( self , name, segmentdata, gamma = gamma ) def _init(self): self.N = len( self._segmentdata['red'] ) self._lut = np.ones((self.N, 5), np.float) for i in range( self.N ): self._lut[i, 0] = self._segmentdata['red'][i][0] # 2 because I do not manage discontinuities in color self._lut[i, 1] = self._segmentdata['red'][i][2] self._lut[i, 2] = self._segmentdata['green'][i][2] self._lut[i, 3] = self._segmentdata['blue'][i][2] self._isinit = True def __call__(self, X, alpha=None, bytes=False): if not self._isinit: self._init() mask_bad = None if not cbook.iterable(X): vtype = 'scalar' xa = np.array([X]) else: vtype = 'array' xma = ma.array(X, copy=False) mask_bad = xma.mask xa = xma.data.copy() # Copy here to avoid side effects. del xma lut = self._lut.copy() rgba = np.empty(shape=xa.shape+(4,), dtype=lut.dtype) # We construct interpolation functions. fred = interp1d( lut[:,0], lut[:,1]) fgreen = interp1d( lut[:,0], lut[:,2]) fblue = interp1d( lut[:,0], lut[:,3]) rgba[:,3] = 1 # alpha=1 for the time being for i in range( xa.shape[0] ): rgba[i,0] = fred( xa[i] ) rgba[i,1] = fgreen( xa[i] ) rgba[i,2] = fblue( xa[i] ) if vtype == 'scalar': rgba = tuple(rgba[0,:]) return rgba ioff() large_value = 257 # blue above this value large_value = 258 # black above this value large_value = 1e8 cdict = { 'blue': [(0.0, 0.0, 0.0) , (2*1/large_value, 1, 1) , (1.0, 1.0, 1.0)] , 'green': [(0.0, 0.0, 0.0) , (2*1/large_value, 0, 0) , (1.0, 1.0, 1.0)] , 'red': [(0.0, 0.0, 0.0) , (2*1/large_value, 0, 0) , (1.0, 1.0, 1.0)] } measures= array( [[ 0.2, 0.3, 0], [ 0.3, 0.4, 2], [ 0.5, 0.6, large_value]] ) cmap = ContinuousLinearSegmentedColormap( "cmap foobar" , cdict ) fig = figure() axes = fig.add_subplot(111) ec = CircleCollection( [80] , offsets = measures[:,:2] , transOffset = axes.transData ) ec.set_array( measures[:,2] ) ec.set_cmap( cmap ) axes.add_collection( ec ) show() #####################
In article <955...@gm...>, Ludwig Schwardt <lud...@gm...> wrote: > Pip works beautifully on the Mac since Lion, once you install pkg-config. > This allows matplotlib to pick up the dependencies from the system (i.e. > libpng, libfreetype and zlib).... I had not heard of pkg-config before. It looks very useful. >... > [1] For me the only downside of the installer is the use of Python.org Python > instead of the default "system" Python, as the latter makes more sense to me > for a standard installation (and avoids having multiple Pythons on your > system, which is a Good Thing). Python.org Python used to be a mandatory > install on older Mac systems such as Tiger / 10.3, but this is no longer a > compelling argument for me on newer systems. Simplicity is nice, and it's a shame there are so many 3rd party versions of python now (python.org, Enthought, ActiveState). Nonetheless, there are some good reasons for avoiding system python, including: - Apple rarely updates system python, so one does not get bug fixes - If the operating system uses python for anything then it's safest to leave it alone Regards, -- Russell
On Wed, Nov 21, 2012 at 6:00 PM, Jeffrey Melloy <jm...@gm...> wrote: > I'm currently using matplotlib to generate .PNG files, and the > javascript library flot to do point hover & zooming on the same data > (after click through). Flot is starting to show its age, and I'd like > a little more control. > > I'd like to get to only one library generating graphs, so I only have > to change code in one place. d3.js looks interesting & dynamic, but > I don't want to just replace one javascript library with another. I > may be able to use d3.js to generate the thumbnails. > > My other option is to use matplotlib for the clicking & zooming -- If > i use it to generate an svg and then do clicking, zooming, etc on the > svg, am I in for a world of hurt? I see an html5 backend, but that > hasn't been updated in a year. I also see the svg_histogram example, > but that didn't work cleanly for me. > > Thanks, > Jeff > > You might be interested in this experimental branch: https://github.com/matplotlib/matplotlib/pull/1426 Cheers! Ben Root
Hi, I wanted to share a little experiment of mine with you to see what you think and whether there are other ways (or better ways) to do that sort of thing. Here is my blog post on embedding matplotlib plots in Cocoa applications: http://www.streylab.com/blog/2012/11/22/matplotlib-running-in-cocoa-under-xcode.html Let me know what you think. Helmut Strey
On Monday, November 19, 2012 13:53:21 Eric Firing wrote: > It is not entirely clear to me what you are trying to do, but it sounds > like increasing N is not the right way to do it. Three things might help > you find a better way: > > 1) The colormap is intended to work with a norm that handles the > translation from your data numbers to the 0-1.0 range used to select > values from the colormap (with exceptions--see below). You can choose a > non-default norm, you can write your own, or you can set the parameters > (vmin, vmax) of the standard linear norm. > > 2) By creating a colormap and calling its set_under, set_over, and > set_invalid methods, you can control the colors assigned to data values > that your norm maps respectively to negative numbers, numbers greater > than 1, and masked values. See > http://matplotlib.org/examples/pylab_examples/contourf_demo.html for an > example of using set_under and set_over. See > http://matplotlib.org/examples/pylab_examples/image_masked.html for > another example, and for an example of controlling the norm parameters > or using an alternative norm. > > 3) It is also possible to index directly into the colormap if you use a > norm that returns an integer data type. An example of such is the > BoundaryNorm. > http://matplotlib.org/examples/pylab_examples/multicolored_line.html > > If all you need is a single assignment of a color to a "large value", > then using the set_over method will take care of it. > > Eric Thanks for your answer. My goal is to keep the correct color, i.e. blue, for the point located at (x=0.3, y=0.4), even if there are very large values of z on the plot. As I said, increasing N is not satisfying because it leads to large amounts of memory to be used. But for the time being, this is the only solution I have found. I cannot use the set_over method to do that, because the "large value" is not the only one. Indeed, what I want to do is an imshow plot, with a colorbar containing three different linear portions: * one portion for the values of z contained between the minimum and maximum value of z in some measure points. * one portion for the values of z below the minimum z in the measure points. * one portion for the values of z above the maximum z in the measure points. My problem is that I may have very large values on the plot in the range below or above the measures z. So I have exactly the problem shown in my dummy example of the previous post: all my measures have the same color, although they should not, because I have created a colormap that should handle this situation (three different linear portions in the map). The only workaround I have found is to increase the value of N, but in my case it has to be very large, such that the plot is very slow to display, or even can ask for huge amounts of memory. Thus it seems to me that my dummy example given in the previous post covers exactly the problem encountered in my real-world imshow function. Is there a memory-efficient workaround in my dummy example (instead of increasing N)? Thanks, TP
2012年11月4日 Brickle Macho <bri...@gm...>: > [...] When I show() a plot form within a Qt application I get the > following message printed on the console: > > QCoreApplication::exec: The event loop is already running > > I think I understand the error, obviously the application I calling form > control the even loop. I suppose I need to somehow supply a parent > window to pylab plot or the show() function. Is there a way to create > a plot and show so as not to use the main loop? Do not use show() in a GUI application. If you have a FigureCanvas instance embedded in your app, call its draw() method. If you use pyplot.figure() to create a matplotlib window from your app, call pyplot.draw(). Goyo
2012年11月22日 Jeffrey Melloy <jm...@gm...>: > I'm graphing data from a web service, and seem to have stumbled upon a > bug when dates are graphed without any values. > > Here's a minimum repro: > > import datetime > import matplotlib.pyplot as plt > > fig = plt.figure() > ax = fig.add_subplot(111) > > x = [] > st = datetime.datetime(2012,11,21) > while st < datetime.datetime(2012,11,21, 16, 00): > x.append(st) > st = st + datetime.timedelta(minutes=30) > y = [None] * len(x) > > ax.plot(x,y) > fig.autofmt_xdate() > plt.show() > > > The stack trace I get: > > Traceback (most recent call last): > File "min_mpl.py", line 15, in <module> > fig.autofmt_xdate() > File "c:\python26\lib\site-packages\matplotlib\figure.py", line 318, > in autofmt_xdate > for label in ax.get_xticklabels(): > File "c:\python26\lib\site-packages\matplotlib\axes.py", line 2507, > in get_xticklabels > self.xaxis.get_ticklabels(minor=minor)) > File "c:\python26\lib\site-packages\matplotlib\axis.py", line 1104, > in get_ticklabels > return self.get_majorticklabels() > File "c:\python26\lib\site-packages\matplotlib\axis.py", line 1088, > in get_majorticklabels > ticks = self.get_major_ticks() > File "c:\python26\lib\site-packages\matplotlib\axis.py", line 1186, > in get_major_ticks > numticks = len(self.get_major_locator()()) > File "c:\python26\lib\site-packages\matplotlib\dates.py", line 749, > in __call__ > self.refresh() > File "c:\python26\lib\site-packages\matplotlib\dates.py", line 758, in refresh > dmin, dmax = self.viewlim_to_dt() > File "c:\python26\lib\site-packages\matplotlib\dates.py", line 530, > in viewlim_to_dt > return num2date(vmin, self.tz), num2date(vmax, self.tz) > File "c:\python26\lib\site-packages\matplotlib\dates.py", line 289, > in num2date > if not cbook.iterable(x): return _from_ordinalf(x, tz) > File "c:\python26\lib\site-packages\matplotlib\dates.py", line 203, > in _from_ordinalf > dt = datetime.datetime.fromordinal(ix) > ValueError: ordinal must be >= 1 > > Adding a 0 & the current date stops getting the exception, but the > range seems wildly messed up. (2011 - 2014). I can't figure out what's going on here, the calls in the stack trace seem unrelated to Y data. As a quick and dirty workaround you can set the first and last Y values to 0 --won't work well if you use markers. Goyo
This may help you if I understand your basic problem. I use a lot of interactive plots. This is an example of the work around to show() that I use: 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') raw_input('Enter to close and Continue: ') plt.close(fig) When I use this method when connecting to the axes I re-draw the figure after updating using: fig.canvas.draw() I hope this was useful Regards, Bob -- View this message in context: http://matplotlib.1069221.n5.nabble.com/Is-there-a-way-to-create-a-plot-and-call-show-so-as-not-to-use-the-main-Qt-loop-tp39653p39846.html Sent from the matplotlib - users mailing list archive at Nabble.com.