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
(6) |
3
(5) |
4
(5) |
5
|
6
|
7
|
8
(2) |
9
|
10
(1) |
11
(4) |
12
(1) |
13
|
14
(2) |
15
(1) |
16
(3) |
17
(5) |
18
|
19
(7) |
20
(1) |
21
(1) |
22
|
23
(2) |
24
(4) |
25
(5) |
26
(3) |
27
|
28
(3) |
29
(3) |
30
(5) |
|
|
|
|
|
Sent from my iPhone > On Sep 19, 2013, at 9:58, Sterling > Separately, if your blue data are so quantized, you might use the blue data to choose a color for an axvspan (or axhspan, I forget which is which) to indicate how certain regions of time have different values of blue data. Then you would only need one set of axes, and your x,y labels would indicate what you want. Or perhaps colour the line segments based on the discrete value. Cheers. Jody > -Sterling > >> On Sep 19, 2013, at 7:46AM, Skip Montanaro wrote: >> >> I have a plot which uses both the left and right y axes. See >> attached. Note that the feedback in the lower right-hand corner >> displays the value on the right y axis (the blue plot). That's not a >> very interesting value though. How can I control which value is >> displayed as I move the cursor around the graph? Is it something >> control interactively with a modifier key? I tried a few, but saw no >> change. I'm currently using matplotlib v 1.1.0 (alas, something which >> is also out of my control). >> >> Thanks, >> >> Skip >> <axes.png>------------------------------------------------------------------------------ >> LIMITED TIME SALE - Full Year of Microsoft Training For Just 49ドル.99! >> 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint >> 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes >> Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. >> http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk_______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > ------------------------------------------------------------------------------ > LIMITED TIME SALE - Full Year of Microsoft Training For Just 49ドル.99! > 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint > 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes > Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. > http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Hello list, I am creating a series of plots automatically. During the first 10 of them, I gradually zoom in to a specific area, while during the last 10 I zoom out to the original axes limits. The problem is, I am only changing the x/y limits of the axes, not their position. However, when savefig is called on the figure, the actual axes position changes (even thought I specifically give the axes position myself at every iteration). I am attaching a sample application which demonstrates the problem. This is on Windows 7, Python 2.7.3, WXAgg, Matplotlib 1.2.0. The output I get for the axes bbox is as follow (from the attached script): Reached date: 01-Jan-2010 Bbox('array([[ 0.52953281, 0.062 ],\n [ 0.90046719, 0.93 ]])') Reached date: 01-Feb-2010 Bbox('array([[ 0.5314989, 0.062 ],\n [ 0.8985011, 0.93 ]])') Reached date: 01-Mar-2010 Bbox('array([[ 0.53257326, 0.062 ],\n [ 0.89742674, 0.93 ]])') Reached date: 01-Apr-2010 Bbox('array([[ 0.53371628, 0.062 ],\n [ 0.89628372, 0.93 ]])') Reached date: 01-May-2010 Bbox('array([[ 0.53493477, 0.062 ],\n [ 0.89506523, 0.93 ]])') Reached date: 01-Jun-2010 Bbox('array([[ 0.53623645, 0.062 ],\n [ 0.89376355, 0.93 ]])') Reached date: 01-Jul-2010 Bbox('array([[ 0.53763013, 0.062 ],\n [ 0.89236987, 0.93 ]])') Reached date: 01-Aug-2010 Bbox('array([[ 0.53912594, 0.062 ],\n [ 0.89087406, 0.93 ]])') Reached date: 01-Sep-2010 Bbox('array([[ 0.54073553, 0.062 ],\n [ 0.88926447, 0.93 ]])') Reached date: 01-Oct-2010 Bbox('array([[ 0.54247238, 0.062 ],\n [ 0.88752762, 0.93 ]])') Reached date: 01-Nov-2010 Bbox('array([[ 0.54247238, 0.062 ],\n [ 0.88752762, 0.93 ]])') Does anyone see what I may be doing wrong? Thank you in advance for your help. -- Andrea. "Imagination Is The Only Weapon In The War Against Reality." http://www.infinity77.net # ------------------------------------------------------------- # def ask_mailing_list_support(email): if mention_platform_and_version() and include_sample_app(): send_message(email) else: install_malware() erase_hard_drives() # ------------------------------------------------------------- #
2013年9月19日 Mark Bakker <ma...@gm...>: > Hello List, > > When I use datestr2num('2010-05') it nicely converts that to a number > representing the date. > When I convert that number back with num2date, it turns out it sets the day > to the 19th of the month. The dime is 0:00:00. > Any reason it is set to the 19th instead of the first? > Maybe because today it the 19th, or is that just a coincidence? datestr2num calls dateutil.parser.parse, which by default uses the current date at 00:00:00 for missing fields. The dateutil function also can use a "default" argument to change this bahavoir but it is not available in datestr2num. http://labix.org/python-dateutil#head-a23e8ae0a661d77b89dfb3476f85b26f0b30349c Goyo
Hello List, When I use datestr2num('2010-05') it nicely converts that to a number representing the date. When I convert that number back with num2date, it turns out it sets the day to the 19th of the month. The dime is 0:00:00. Any reason it is set to the 19th instead of the first? Maybe because today it the 19th, or is that just a coincidence? Thanks, Mark
On Sep 19, 2013, at 10:14AM, Skip Montanaro wrote: > >> Separately, if your blue data are so quantized, you might use the blue data to choose a color for an axvspan (or axhspan, I forget which is which) to indicate how certain regions of time have different values of blue data. Then you would only need one set of axes, and your x,y labels would indicate what you want. > > This also works, though I (and anyone looking at the graph) would have > to remember the mapping between color and numeric value. If I was a > synethete this might work, but I doubt most people would automatically > recall the mapping. :-) No assumption of super-human recollection or inference abilities . I would add a figure or axes legend with proxy artists for the appropriate color mappings, or even just a bunch of text boxes with the text label colored appropriately. You may be interested in my answer to a stackoverflow question [1]. -Sterling [1] http://stackoverflow.com/questions/17086847/box-around-text-in-matplotlib/17092777#17092777
> I assume that you are using a twinx call to get the second y axis. I think that this question has come up before, and I think the solution was to switch which data are put on the second set of axes. (Of course to keep the same visual layout you would have to play with the y axis spine locations.) Good point. I just changed the command line options so the plot whose Y values are of interest are plotted on the right Y axis. > Separately, if your blue data are so quantized, you might use the blue data to choose a color for an axvspan (or axhspan, I forget which is which) to indicate how certain regions of time have different values of blue data. Then you would only need one set of axes, and your x,y labels would indicate what you want. This also works, though I (and anyone looking at the graph) would have to remember the mapping between color and numeric value. If I was a synethete this might work, but I doubt most people would automatically recall the mapping. :-) Thx, Skip
Skip, I assume that you are using a twinx call to get the second y axis. I think that this question has come up before, and I think the solution was to switch which data are put on the second set of axes. (Of course to keep the same visual layout you would have to play with the y axis spine locations.) Separately, if your blue data are so quantized, you might use the blue data to choose a color for an axvspan (or axhspan, I forget which is which) to indicate how certain regions of time have different values of blue data. Then you would only need one set of axes, and your x,y labels would indicate what you want. -Sterling On Sep 19, 2013, at 7:46AM, Skip Montanaro wrote: > I have a plot which uses both the left and right y axes. See > attached. Note that the feedback in the lower right-hand corner > displays the value on the right y axis (the blue plot). That's not a > very interesting value though. How can I control which value is > displayed as I move the cursor around the graph? Is it something > control interactively with a modifier key? I tried a few, but saw no > change. I'm currently using matplotlib v 1.1.0 (alas, something which > is also out of my control). > > Thanks, > > Skip > <axes.png>------------------------------------------------------------------------------ > LIMITED TIME SALE - Full Year of Microsoft Training For Just 49ドル.99! > 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint > 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes > Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. > http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk_______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
I have a plot which uses both the left and right y axes. See attached. Note that the feedback in the lower right-hand corner displays the value on the right y axis (the blue plot). That's not a very interesting value though. How can I control which value is displayed as I move the cursor around the graph? Is it something control interactively with a modifier key? I tried a few, but saw no change. I'm currently using matplotlib v 1.1.0 (alas, something which is also out of my control). Thanks, Skip
Hi all, I am trying to plot the time evolution of a probability distribution, but I don't know how to use it. I have a different histogram for each time step. I tried plt.ion() but I'm not sure how to use it. I'm sure it must be a simple solution, but I haven't really found out how to do it! If I use plt.show() as written below, I have to close the window every time for it to reopen. Here is my code, can you help me? import matplotlib.pyplot as plt import numpy import math def p(N, Na, fa, fb): return float(Na)*fa/(Na*fa + (N-Na)*fb) def binomial(n,k): if k > n-k: k = n-k accum = 1 for i in range(1,k+1): accum *= (n - (k - i)) accum /= i return accum def pk(N, k, p): return binomial(N, k)*math.pow(p,k)*math.pow((1-p),(N-k)) def expected(N, dist): soma = 0 for k in range(N + 1): soma += k*dist[k] return soma def drawhist(menMeans): N = len(menMeans) ind = numpy.arange(N) width = 1.0 plt.clf() plt.ylabel('Probability') plt.xlabel('k') plt.xlim(0.0,N) plt.ylim(0.0,1.0) plt.bar(ind, menMeans, width) plt.draw() plt.show() N = 100 Na = 50 fa = 10 fb = 5 pks = [0]*(N+1) pks[Na] = 1 pkst = [0]*(N+1) expect = [Na] drawhist(pks) p = [p(N, n, fa, fb) for n in range(N + 1)] for t in range(5): for Na in range(N + 1): for k in range(N + 1): pkst[k] += pks[Na]*pk(N, k, p[Na]) drawhist(pkst) pks = pkst pkst = [0]*(N+1) expect.append(expected(N, pks))
On Tue, Sep 17, 2013 at 11:55 AM, Chad Kidder <cck...@gm...> wrote: > I'm following the MPL Qt4 example given at > http://matplotlib.org/examples/user_interfaces/embedding_in_qt4.html and > it looks like I am timing out somewhere in the setup. The error I am > getting is: > > RuntimeError: super-class __init__() of type MyDynamicMplCanvas was never > called > > It's timing out on a function that goes and talks to a piece of test > equipment to get some data to plot. That function takes on the order of a > second to complete and is located in compute_initial_figure(self): for the > previously mentioned class. I will need to make these calls whenever I go > into the update routine and they may take a few seconds to update. > > First, where is the "timeout" that I am violating? Second, how do I fix > this? Thanks for your help. > > > --Chad Kidder > > Hi Chad, I think the timeout is right over here: class MyDynamicMplCanvas(MyMplCanvas): """A canvas that updates itself every second with a new plot.""" def __init__(self, *args, **kwargs): MyMplCanvas.__init__(self, *args, **kwargs) timer = QtCore.QTimer(self) QtCore.QObject.connect(timer, QtCore.SIGNAL("timeout()"), self.update_figure) timer.start(1000) My suspicion would be to either bump up that timer to take more than a second, or come up with a different signal function to more intelligently handle refreshes. Cheers! Ben Root
I'm following the MPL Qt4 example given at http://matplotlib.org/examples/user_interfaces/embedding_in_qt4.html and it looks like I am timing out somewhere in the setup. The error I am getting is: RuntimeError: super-class __init__() of type MyDynamicMplCanvas was never called It's timing out on a function that goes and talks to a piece of test equipment to get some data to plot. That function takes on the order of a second to complete and is located in compute_initial_figure(self): for the previously mentioned class. I will need to make these calls whenever I go into the update routine and they may take a few seconds to update. First, where is the "timeout" that I am violating? Second, how do I fix this? Thanks for your help. --Chad Kidder
Hi Ben, It works for me. Thank you very much ! Best wishes Nils On Tue, Sep 17, 2013 at 3:25 PM, Benjamin Root <ben...@ou...> wrote: > > > > On Tue, Sep 17, 2013 at 4:25 AM, Nils Wagner <ni...@go...>wrote: > >> Hi all, >> >> How can I modify the grid linewidth and grid line color of an Axes3D >> object ? >> is it possible to use white instead of gray for the background color ? >> >> The following snippet doesn't show the desired effect. >> >> from mpl_toolkits.mplot3d import Axes3D >> import matplotlib.pyplot as plt >> fig = plt.figure(figsize=(10,8)) >> ax = fig.gca(projection='3d') >> ax.grid(color='r',linestyle='-',linewdith=2) >> >> > A (somewhat) undocumented feature (and is not guaranteed to work in the > future!) is the axis's _axinfo dictionary. > > # This is a temporary member variable. > # Do not depend on this existing in future releases! > self._axinfo = self._AXINFO[adir].copy() > self._axinfo.update({'label' : {'space_factor': 1.6, > 'va': 'center', > 'ha': 'center'}, > 'tick' : {'inward_factor': 0.2, > 'outward_factor': 0.1}, > 'ticklabel': {'space_factor': 0.7}, > 'axisline': {'linewidth': 0.75, > 'color': (0, 0, 0, 1)}, > 'grid' : {'color': (0.9, 0.9, 0.9, 1), > 'linewidth': 1.0}, > }) > > where _AXINFO is a class-level attribute defined as: > # Some properties for the axes > _AXINFO = { > 'x': {'i': 0, 'tickdir': 1, 'juggled': (1, 0, 2), > 'color': (0.95, 0.95, 0.95, 0.5)}, > 'y': {'i': 1, 'tickdir': 0, 'juggled': (0, 1, 2), > 'color': (0.90, 0.90, 0.90, 0.5)}, > 'z': {'i': 2, 'tickdir': 0, 'juggled': (0, 2, 1), > 'color': (0.925, 0.925, 0.925, 0.5)}, > } > > This information used to be hard-coded throughout the axis3d.py module. I > consolidated it all into this dictionary for each Axis3D instance. So, you > should be able to create your Axes3D object, and then do something like the > following: > > ax = fig.gca(projection='3d') > ax.xaxis._axinfo['grid'].update({'color': 'r', 'linewidth': 2}) > ax.xaxis._axinfo['color'] = 'white' > > (Note: untested code!) I don't think the linestyle can be specified, > though. At some point, I probably should get the Axes3D.grid() function > defined to mess around with this _axinfo modify the _axinfo dictionary. > > I hope that helps! > Ben Root >
On Tue, Sep 17, 2013 at 4:25 AM, Nils Wagner <ni...@go...> wrote: > Hi all, > > How can I modify the grid linewidth and grid line color of an Axes3D > object ? > is it possible to use white instead of gray for the background color ? > > The following snippet doesn't show the desired effect. > > from mpl_toolkits.mplot3d import Axes3D > import matplotlib.pyplot as plt > fig = plt.figure(figsize=(10,8)) > ax = fig.gca(projection='3d') > ax.grid(color='r',linestyle='-',linewdith=2) > > A (somewhat) undocumented feature (and is not guaranteed to work in the future!) is the axis's _axinfo dictionary. # This is a temporary member variable. # Do not depend on this existing in future releases! self._axinfo = self._AXINFO[adir].copy() self._axinfo.update({'label' : {'space_factor': 1.6, 'va': 'center', 'ha': 'center'}, 'tick' : {'inward_factor': 0.2, 'outward_factor': 0.1}, 'ticklabel': {'space_factor': 0.7}, 'axisline': {'linewidth': 0.75, 'color': (0, 0, 0, 1)}, 'grid' : {'color': (0.9, 0.9, 0.9, 1), 'linewidth': 1.0}, }) where _AXINFO is a class-level attribute defined as: # Some properties for the axes _AXINFO = { 'x': {'i': 0, 'tickdir': 1, 'juggled': (1, 0, 2), 'color': (0.95, 0.95, 0.95, 0.5)}, 'y': {'i': 1, 'tickdir': 0, 'juggled': (0, 1, 2), 'color': (0.90, 0.90, 0.90, 0.5)}, 'z': {'i': 2, 'tickdir': 0, 'juggled': (0, 2, 1), 'color': (0.925, 0.925, 0.925, 0.5)}, } This information used to be hard-coded throughout the axis3d.py module. I consolidated it all into this dictionary for each Axis3D instance. So, you should be able to create your Axes3D object, and then do something like the following: ax = fig.gca(projection='3d') ax.xaxis._axinfo['grid'].update({'color': 'r', 'linewidth': 2}) ax.xaxis._axinfo['color'] = 'white' (Note: untested code!) I don't think the linestyle can be specified, though. At some point, I probably should get the Axes3D.grid() function defined to mess around with this _axinfo modify the _axinfo dictionary. I hope that helps! Ben Root
Hi all, How can I modify the grid linewidth and grid line color of an Axes3D object ? is it possible to use white instead of gray for the background color ? The following snippet doesn't show the desired effect. from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt fig = plt.figure(figsize=(10,8)) ax = fig.gca(projection='3d') ax.grid(color='r',linestyle='-',linewdith=2) Nils
On Sat, Sep 14, 2013 at 2:45 PM, Alexandre Voitenok < avo...@ac...> wrote: > Hi > I am trying to figure out how to change font color (as opposed to the fill > color) in select cells in Table. Is there a way to do this? > Below is an example: > > import matplotlib.pyplot as plt > import numpy as np > import pandas as pd > from matplotlib.table import Table > def main(): > data = pd.DataFrame(np.random.random((12,8)), > columns=['A','B','C','D','E','F','G','H']) > returnsTable(data) > plt.show() > > def returnsTable(data, fmt='{:.2f}/{:.1f}'): > fig=plt.figure(figsize=(8,5)) > ax=plt.subplot(111) > ax.set_axis_off() > tb = Table(ax, bbox=[0,0,1,1]) > tb.auto_set_font_size(False) > > colorDict={-3:"#D00000",-2:"#FF5050",-1:"#FFBFBF",0:"#FFFFFF",1:"#D0FFD0",2:"#40FF40",3:"#00C000"} > > nrows, ncols = data.shape > width, height = 1.0 / ncols, 1.0 / nrows > > dArray=data.values.reshape(np.product(data.shape)) > # mean&sigma.. > mean=np.average(dArray) > sigma=np.std(dArray) > > # Add cells > for (i,j), val in np.ndenumerate(data): > z=(val-mean)/sigma > idx = 0 if int(z)==0 else (max((int(z),-3)) if z<0 else > min((int(z),3))) > color = colorDict[idx] > > ############################################## > ## IS THERE A WAY TO ALSO CHANGE FONT COLOR? > tb.add_cell(i+1, j+1, width, height, text=fmt.format(val,z), > loc='center', facecolor=color) > > > # Row labels in cells themselves > # use -1 with edgecolor='none' for outside the grid > for i, label in enumerate(data.index): > tb.add_cell(i+1, 0, width*2, height, text=label, loc='right', > facecolor='none') > > > # Column Labels... > for j, label in enumerate(data.columns): > tb.add_cell(0, j+1, width, height/2, text=label, loc='center', > facecolor='none') > tb.set_fontsize(8) > ax.add_table(tb) > return fig > > main() > > > Hmm, it doesn't look like you can do it from the add_cell() function. It creates a Cell object, which in turn creates a Text object, but provides no means of passing much down to that Text object. The Table object has a dictionary of Cell objects: self._cells[(row, col)] = cell, keyed by the tuple of row and column numbers. You could do something like this: tb._cells[(i+1, j+1)]._text.set_color('yellow') Note, I did not test the above line, but I suspect that should work. Cheers! Ben Root
On Sun, Sep 15, 2013 at 11:59 PM, C M <cmp...@gm...> wrote: > Just a follow-up on this problem... > > I've found now that the index is only off if the plot is zoomed, and in > the following way. When I zoom, the first point that is visible in the > plot window will have index = 0, the next point will have index = 1, and so > forth. If I zoom another section of the points, the indices are "reset" in > this same way. > > What's really bizarre is that this is only occurring on one plot. When I > try to reproduce the problem on other plots (so far at least), I can't. > > Any suggestions for how to chase this down would be very welcome. > > Thanks. > > That is a very useful observation. I am not very familiar with the artist picking code, but if I have to guess, I would wonder if indices are being determined from a path created *after* clip_to_rect() is used internally. Given that you are having difficulties in reproducing this issue in other plots, I would suggest trying to pare down your badly behaving code as much as you can and post it here. Furthermore, it would also be useful to determine if the issue still occurs in v1.3 or in the master branch. Cheers! Ben Root
Just a follow-up on this problem... I've found now that the index is only off if the plot is zoomed, and in the following way. When I zoom, the first point that is visible in the plot window will have index = 0, the next point will have index = 1, and so forth. If I zoom another section of the points, the indices are "reset" in this same way. What's really bizarre is that this is only occurring on one plot. When I try to reproduce the problem on other plots (so far at least), I can't. Any suggestions for how to chase this down would be very welcome. Thanks. On Sun, Sep 15, 2013 at 5:30 PM, C M <cmp...@gm...> wrote: > I have Matplotlib 1.1.0, and am doing point picking (using the OO approach > to Matplotlib, and embedded in wxPython). My relevant code is as follows: > > #connect the pick event to the pick event handler: > self.cid = self.canvas.mpl_connect('pick_event', self.on_pick) > > #This is the relevant part of the pick event handler: > def on_pick(self, event): > if isinstance(event.artist, Line2D): > ind = event.ind > print 'ind is: ', str(ind) > > This had been working in some cases, but I've found a case in which it > appears to be giving me a value for ind that doesn't make sense. For > example, I have a plot with two lines on it (and two y axes), each with > over 50 points. When I pick one of the points right near the end, I expect > the ind here will be about 50. However, it prints ind is: 3. In other > words, the wrong index value. This is a serious issue for me, because I > then use that index to look up information about that point. > > What could be going on here? > > Thanks, > Che >
I have Matplotlib 1.1.0, and am doing point picking (using the OO approach to Matplotlib, and embedded in wxPython). My relevant code is as follows: #connect the pick event to the pick event handler: self.cid = self.canvas.mpl_connect('pick_event', self.on_pick) #This is the relevant part of the pick event handler: def on_pick(self, event): if isinstance(event.artist, Line2D): ind = event.ind print 'ind is: ', str(ind) This had been working in some cases, but I've found a case in which it appears to be giving me a value for ind that doesn't make sense. For example, I have a plot with two lines on it (and two y axes), each with over 50 points. When I pick one of the points right near the end, I expect the ind here will be about 50. However, it prints ind is: 3. In other words, the wrong index value. This is a serious issue for me, because I then use that index to look up information about that point. What could be going on here? Thanks, Che
Hi I am trying to figure out how to change font color (as opposed to the fill color) in select cells in Table. Is there a way to do this? Below is an example: import matplotlib.pyplot as plt import numpy as np import pandas as pd from matplotlib.table import Table def main(): data = pd.DataFrame(np.random.random((12,8)), columns=['A','B','C','D','E','F','G','H']) returnsTable(data) plt.show() def returnsTable(data, fmt='{:.2f}/{:.1f}'): fig=plt.figure(figsize=(8,5)) ax=plt.subplot(111) ax.set_axis_off() tb = Table(ax, bbox=[0,0,1,1]) tb.auto_set_font_size(False) colorDict={-3:"#D00000",-2:"#FF5050",-1:"#FFBFBF",0:"#FFFFFF",1:"#D0FFD0",2:"#40FF40",3:"#00C000"} nrows, ncols = data.shape width, height = 1.0 / ncols, 1.0 / nrows dArray=data.values.reshape(np.product(data.shape)) # mean&sigma.. mean=np.average(dArray) sigma=np.std(dArray) # Add cells for (i,j), val in np.ndenumerate(data): z=(val-mean)/sigma idx = 0 if int(z)==0 else (max((int(z),-3)) if z<0 else min((int(z),3))) color = colorDict[idx] ############################################## ## IS THERE A WAY TO ALSO CHANGE FONT COLOR? tb.add_cell(i+1, j+1, width, height, text=fmt.format(val,z), loc='center', facecolor=color) # Row labels in cells themselves # use -1 with edgecolor='none' for outside the grid for i, label in enumerate(data.index): tb.add_cell(i+1, 0, width*2, height, text=label, loc='right', facecolor='none') # Column Labels... for j, label in enumerate(data.columns): tb.add_cell(0, j+1, width, height/2, text=label, loc='center', facecolor='none') tb.set_fontsize(8) ax.add_table(tb) return fig main() This e-Mail and any attachments contain privileged and confidential information of Acadian and may be accessed and read only by the intended recipients. Any further distribution or reproduction of this material by recipients, or use for any purpose not authorized by Acadian, is strictly prohibited. If you are not the intended recipient and this e-mail and attachments have been sent or passed on to you in error, please destroy the same and contact us immediately. Confidentiality and privilege are not lost by this transmission having been sent or passed on to you in error. Acadian is not liable for any damage that may be caused by viruses or transmission errors. Acadian Asset Management LLC is registered as an investment adviser with the U.S. Securities and Exchange Commission. Registered Office: 260 Franklin Street, Boston, Massachusetts 02110. Acadian Asset Management (UK) Limited is a private limited company incorporated in England, number 05644066, and is authorised and regulated by the Financial Conduct Authority of the United Kingdom. Registered office: 36-38 Cornhill, London, EC3V3ND, United Kingdom. Acadian Asset Management (Singapore) Pte Ltd. (Registration Number: 199902125D) is a private company limited by shares organized under Singapore law and is authorized by the Monetary Authority of Singapore. Registered office: 8 Shenton Way, #37-02, Singapore 068811. [AAM_2010_v1.3] ________________________________
Hello Finally (after long time) I managed to get time and courage to make my first PR with this little modification https://github.com/matplotlib/matplotlib/pull/2417 Federico On Tue, Mar 13, 2012 at 3:17 PM, John Hunter <jd...@gm...> wrote: > > > On Tue, Mar 13, 2012 at 1:20 PM, Federico Ariza <ari...@gm...>wrote: > >> Hi >> >> That is exactly what I am doing, but I thought it was kept somewhere. >> >> I like the idea of upstream modification of relim. >> >> > It would be trivial to add a kwarg to relim: > > include_invisible=True > > which defaults to the current behavior. > def relim(self, include_invisible=True): > """ > Recompute the data > limits based on current artists. If you want to exclude > invisible artists from the calculation, set > `include_invisible=False` > > At present, :class:`~matplotlib.collections.Collection` > instances are not supported. > """ > # Collections are deliberately not supported (yet); see > # the TODO note in artists.py. > self.dataLim.ignore(True) > self.ignore_existing_data_limits = True > for line in self.lines: > if include_invisible or line.get_visible(): > self._update_line_limits(line) > > for p in self.patches: > if include_invisible or p.get_visible(): > self._update_patch_limits(p) > > > But include_invisible isn't the most intuitive name... > > JDH > > > > -- Y yo que culpa tengo de que ellas se crean todo lo que yo les digo? -- Antonio Alducin --
I tried rendering some TeX in a figure today but it didn't work. I realized, text.usetex in the matplotlibrc file was set to False. When I add rc('text', usetex=True) to my script, the axis labels are rendered as TeX as well which is undesirable. I don't remember ever having to set this before matplotlib 1.3.0 and I definitely don't remember any difficulty rendering TeX. Anyone else experiencing this behavior? Example: import matplotlib.patheffects as PathEffects # matplotlib.rc('text', usetex=True) fig = plt.figure(figsize=(4,4)) ax = fig.add_axes([0,0,0.9,1]) ax.imshow(randn(20,20)) txt = ax.text(0.1, 0.5, r"Some \LaTeX\ $\alpha=\beta$", transform=ax.transAxes,fontsize=16) txt.set_path_effects([PathEffects.Stroke(linewidth=3, foreground="w"), PathEffects.Normal()]) Produces: Uncommenting the `matplotlib.rc('text', usetex=True)' line, produces:
Hi all, I'm trying to refresh a map within a gtk application everytime a button is pressed. But whatever I do, it doesn't work. Somehow I need to clear the axes. But even that doesn't work. A short hint what I'm missing would be great. Here comes the reduced code: #!/usr/bin/env python import pygtk import gtk from matplotlib.figure import Figure from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as FigureCanvas from mpl_toolkits.basemap import Basemap class BGui: def destroy(self, widget, data=None): gtk.main_quit() def change_zoom(self,button,zoom): self.plot_map(zoom) def __init__(self): self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.connect("destroy", self.destroy) self.zoom = 1. self.table = gtk.Table(2,1,True) self.window.add(self.table) self.plot_map(self.zoom) self.table.attach(self.canvasMap, 0,1,0,1) self.button = gtk.Button("Change Zoom") self.button.connect("clicked", self.change_zoom, self.zoom+1.) self.table.attach(self.button,0,1,1,2) self.window.show_all() def plot_map(self,zoom): print "plot_map called with zoom:" , zoom w = 1.2e6/zoom h = 1.2e6/zoom self.figMap = Figure() self.canvasMap = FigureCanvas(self.figMap) # a gtk.DrawingArea self.canvasMap.set_size_request(200, 200) self.axMap = self.figMap.add_axes([0.02, 0.02, 0.96, 0.96]) #if hasattr(self,'map'): #print "clearing axes" #del(self.map) self.map = Basemap(projection='tmerc', resolution='c',\ lat_0=52., lon_0=9.5, width=w,height=h,ax=self.axMap) self.map.fillcontinents(color='green') self.canvasMap.draw() self.canvasMap.Refresh(True) if __name__ == "__main__": bah = BGui() gtk.main() Thanks in advance. Cheers Mario -- Dr. Mario Mech Institute for Geophysics and Meteorology University of Cologne Zuelpicher Str. 49a 50674 Cologne Germany t: +49 (0)221 - 470 - 1776 f: +49 (0)221 - 470 - 5198 e: me...@me... w: http://www.uni-koeln.de/~mmech/
Hi! I'm having problem with data plotting in matplotlib. Tried versions, 1.2.0 and 1.3.0 too, the same thing occurs except the error message. On 1.2.0 the error message is Agg complexity exceeded on 1.3.0 it is Allocated too many blocks. The data i need to plot is 1M pts long and it's a bit complex (have a lot of big changes). data = [] for a in range(0,1000000): data.append(int(random.random()*256)) I can catch the Overflow excepton, and i recover the matplotlib widget by resetting the renderer, but the memory allocated by the previous plot is still allocated until i close the app. Is there a way to find where that memory leaked and how could i free it up? Tried to clear the variables where i store the data, also cleared the figure with .clear(), .clf(), .close() the memory is still used. -- View this message in context: http://matplotlib.1069221.n5.nabble.com/Agg-complexity-exceeded-or-allocated-too-many-blocks-tp41998.html Sent from the matplotlib - users mailing list archive at Nabble.com.
> Sourav Chatterjee <mailto:sr...@gm...> > September 11, 2013 3:48 AM > I am using 'spstere' for polar stereo graphic projection over > Antarctica. The specifications llcrnrlat, llcrnrlon etc are specified > in a python module. When I am doing it over north pole it is okay. But > in South pole the latitude circles are not appearing. Can anyone tell > where is the fault? > > Thanks in advance Sample code please? -Jeff > > -- > Sourav Chatterjee > ------------------------------------------------------------------------------ > How ServiceNow helps IT people transform IT departments: > 1. Consolidate legacy IT systems to a single system of record for IT > 2. Standardize and globalize service processes across IT > 3. Implement zero-touch automation to replace manual, redundant tasks > http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > ------------------------------------------------------------------------
I am using 'spstere' for polar stereo graphic projection over Antarctica. The specifications llcrnrlat, llcrnrlon etc are specified in a python module. When I am doing it over north pole it is okay. But in South pole the latitude circles are not appearing. Can anyone tell where is the fault? Thanks in advance -- Sourav Chatterjee