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
(16) |
4
(22) |
5
(7) |
6
|
7
(9) |
8
(2) |
9
|
10
(7) |
11
(15) |
12
(7) |
13
(4) |
14
(7) |
15
(3) |
16
(6) |
17
(20) |
18
(18) |
19
(15) |
20
(27) |
21
(14) |
22
|
23
(1) |
24
(18) |
25
(22) |
26
(36) |
27
(17) |
28
(6) |
29
(2) |
30
(3) |
31
(6) |
|
|
|
|
|
On Wed, May 12, 2010 at 5:58 AM, Yannick Copin <yan...@la...> wrote: > gs = gridspec.GridSpec(3, 3) > ax1 = gs[0, :] > I'm inclined to leave the GridSpec as it is and I prefer to have a separate class for this (if we go for it). My inclination is to modify subplot2grid to return such an instance. e.g., grid = gridspec.subplot2grid((2,2)) ax1 = grid[0,:] Regards, -JJ
On Tue, May 11, 2010 at 1:38 PM, John Hunter <jd...@gm...> wrote: > This looks sufficiently general and useful that we may simply want it > to live in the main tree (not as a toolkit) and have subplot2grd > helper functionality available directly from pyplot. > Okay. I'll merge this into the main tree and commit. Regards, -JJ
Hi, Jae-Joon Lee <lee.j.joon@...> writes: > gridspec is a module that implements matplotlib’s Subplot slightly > differently. Current matplotlib’s Subplot only allows a Subplot to > occupy a single cell of the n x m grid. gridspec enables a Subplot to > occupy multiple cells. Very interesting indeed. If I may comment on the usability, I wish function gridspec.subplot could become directly a method of Gridspec. The current example: gs = gridspec.GridSpec(3, 3) ax1 = gridspec.subplot(gs[0, :]) ax2 = gridspec.subplot(gs[1,:-1]) ax3 = gridspec.subplot(gs[1:, -1]) ax4 = gridspec.subplot(gs[-1,0]) ax5 = gridspec.subplot(gs[-1,-2]) could be written in a much simpler way then, such as: gs = gridspec.GridSpec(3, 3) ax1 = gs[0, :] ax2 = gs[1,:-1] ax3 = gs[1:, -1] ax4 = gs[-1,0] ax5 = gs[-1,-2] I would LOVE it! +1 for getting these functionnalities straight in matplotlib: subplot management always take a decent part of my scripts... Cheers,
> -----Original Message----- > From: Jae-Joon Lee [mailto:lee...@gm...] > Sent: Tuesday, May 11, 2010 8:58 AM > To: Matplotlib Users > Subject: [Matplotlib-users] introducing mpl_toolkits.gridspec > > Hi, > > gridspec is a module that implements matplotlib’s Subplot slightly > differently. Current matplotlib’s Subplot only allows a Subplot to > occupy a single cell of the n x m grid. gridspec enables a Subplot to > occupy multiple cells. > > http://leejjoon.github.com/mpl_toolkits-gridspec/ This is really awesome! Thanks for all the time and hard work, JJ. -paul
Hi folks, I just created a tiny prototype of an 'oscilloscope'. I get live data from a robot via UDP. My network class calls the update() of the oscilloscope. The oscilloscope is part of an existing GTK app which runs on an Ubuntu. I have three questions: 1) Since it's my first animation with matplotlib I'm not sure if this is really the best way to do it (probably not :)). I especially dislike the creation of np.array which could take a bit once I have a lot of data. 2) Is the integration in a GTK app like it is now ok or is there a better way? I don't want to loose the zoom and move ability of the standard plot figure though. And I need fast results so I don't want to spent to much time tweaking this. 3) I get a *weird* X error when calling the update method from the network class which probably doesn't have to do anything with matplotlib but I'm asking anyway :) robocup@robocup2-laptop:~/fumanoid/Desktop-Debug-YUV422$ ../install.py /usr/lib/pymodules/python2.6/matplotlib/backends/backend_gtk.py:621: DeprecationWarning: Use the new widget gtk.Tooltip test from 0: 254/508 The program 'install.py' received an X Window System error. This probably reflects a bug in the program. The error was 'RenderBadPicture (invalid Picture parameter)'. (Details: serial 11627 error_code 158 request_code 148 minor_code 7) (Note to programmers: normally, X errors are reported asynchronously; that is, you will receive the error a while after causing it. To debug your program, run it with the --sync command line option to change this behavior. You can then get a meaningful backtrace from your debugger if you break on the gdk_x_error() function.) Sometimes it crashes instantly, sometimes it works for a few calls. Calling update() from the interactive shell works fine though and displays everything. So I don't know if it's really X like the error message suggests or what. Did anybody of you experience something like this? This is the oscilloscope: import numpy as np import matplotlib #matplotlib.use('GTKAgg') # do this before importing pylab # does not really change anything import pylab import matplotlib.pyplot as plt class Oscilloscope(): def __init__(self): # var for a moving window; not implemented yet self.NO_OF_DATA_TO_PLOT = 0 plt.ion() self.fig = plt.figure() self.ax = self.fig.add_subplot(111) self.ax.grid() # list of raw data self.raw_data_x = [] self.raw_data_y = [] self.graph_lim = dict(x_min=None, x_max=None, y_min=None, y_max=None) # get line of data to be able to extend it later self.line, = self.ax.plot(np.array(self.raw_data_x), np.array(self.raw_data_y)) # open the figure window self.fig.canvas.draw() def update(self, x, y): """Draw new data consisting of x and y.""" print 'in update' self.raw_data_x.append(x) self.raw_data_y.append(y) # add new data self.line.set_xdata(np.array( self.raw_data_x)) self.line.set_ydata(np.array(self.raw_data_y)) # redraw the canvas self._limit_plot(x, y) self.fig.canvas.draw() Best, Stefan
It is version 0.99.1.2. On 05/11/2010 12:54 PM, Michael Droettboom wrote: > Is this with matplotlib 0.99.1.2, or SVN trunk? 0.99.1.2 has a known > bug in the path simplification algorithm. > > Mike > > Lane Brooks wrote: >> I am seeing a problem with the path.simplify rcParam. When it is >> enabled, I see spikes in my plots appear and disappear when I resize >> the plotting window. When it is disabled, this does not happen. >> Attached are pictures showing the effect. In the first image, there >> is no spike at x=2559. In the second plot, I resized the window >> slightly and the spike appears. >> >> Is this the expected behavior or is this a bug? >> >> Thanks, >> Lane >> >> ------------------------------------------------------------------------ >> >> >> ------------------------------------------------------------------------ >> >> ------------------------------------------------------------------------ >> >> ------------------------------------------------------------------------------ >> >> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >
Is this with matplotlib 0.99.1.2, or SVN trunk? 0.99.1.2 has a known bug in the path simplification algorithm. Mike Lane Brooks wrote: > I am seeing a problem with the path.simplify rcParam. When it is > enabled, I see spikes in my plots appear and disappear when I resize > the plotting window. When it is disabled, this does not happen. > Attached are pictures showing the effect. In the first image, there is > no spike at x=2559. In the second plot, I resized the window slightly > and the spike appears. > > Is this the expected behavior or is this a bug? > > Thanks, > Lane > > ------------------------------------------------------------------------ > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > > > ------------------------------------------------------------------------ > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA
I am seeing a problem with the path.simplify rcParam. When it is enabled, I see spikes in my plots appear and disappear when I resize the plotting window. When it is disabled, this does not happen. Attached are pictures showing the effect. In the first image, there is no spike at x=2559. In the second plot, I resized the window slightly and the spike appears. Is this the expected behavior or is this a bug? Thanks, Lane
On Tue, May 11, 2010 at 11:39 AM, Jae-Joon Lee <lee...@gm...> wrote: >> 2) Do you plan on checking this into mpl trunk (still as a mpl_toolkit module)? This looks sufficiently general and useful that we may simply want it to live in the main tree (not as a toolkit) and have subplot2grd helper functionality available directly from pyplot. JDH
Le mardi 11 mai 2010 à 12:39 -0400, Jae-Joon Lee a écrit : > > 2) Do you plan on checking this into mpl trunk (still as a > mpl_toolkit module)? > Not at this moment. But, will consider if there is enough interest. +1
On 5/11/2010 11:57 AM, Jae-Joon Lee wrote: > http://leejjoon.github.com/mpl_toolkits-gridspec/ Yea! Thanks! Alan Isaac
On Tue, May 11, 2010 at 12:10 PM, Ryan May <rm...@gm...> wrote: > 1) How does this relate to the functionality present in your axes_grid toolkit? axes_grid toolkit is more flexible and is mainly meant to work with axes with images. gridspec is more for normal axes. As a matter of fact, the multiple axes created by axes_grid toolkit usually occupies the area of a single subplot. So, to me, axes_grid toolkit is something that allows me to divide the area of a single subplot for multiple images, and gridspec is a replacement of the subplot. > 2) Do you plan on checking this into mpl trunk (still as a mpl_toolkit module)? Not at this moment. But, will consider if there is enough interest. Regards, -JJ
On Tue, May 11, 2010 at 10:57 AM, Jae-Joon Lee <lee...@gm...> wrote: > gridspec is a module that implements matplotlib’s Subplot slightly > differently. Current matplotlib’s Subplot only allows a Subplot to > occupy a single cell of the n x m grid. gridspec enables a Subplot to > occupy multiple cells. > > http://leejjoon.github.com/mpl_toolkits-gridspec/ > > The code is hosted in the github repo > > http://github.com/leejjoon/mpl_toolkits-gridspec > > and the source can be downloaded from > > http://github.com/leejjoon/mpl_toolkits-gridspec/downloads > > This is motivated from the discussion in the mailing list a while ago. > > http://sourceforge.net/mailarchive/message.php?msg_id=4A0DA94E.1040500%40american.edu > > I originally prepared this as a patch for matplotlib > (http://article.gmane.org/gmane.comp.python.matplotlib.general/19097), > but never committed. Instead, it is packaged as a mpl_tookit module. Looks interesting, I'll have to take a look when I get a chance. Two early questions: 1) How does this relate to the functionality present in your axes_grid toolkit? 2) Do you plan on checking this into mpl trunk (still as a mpl_toolkit module)? Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma
Hi, gridspec is a module that implements matplotlib’s Subplot slightly differently. Current matplotlib’s Subplot only allows a Subplot to occupy a single cell of the n x m grid. gridspec enables a Subplot to occupy multiple cells. http://leejjoon.github.com/mpl_toolkits-gridspec/ The code is hosted in the github repo http://github.com/leejjoon/mpl_toolkits-gridspec and the source can be downloaded from http://github.com/leejjoon/mpl_toolkits-gridspec/downloads This is motivated from the discussion in the mailing list a while ago. http://sourceforge.net/mailarchive/message.php?msg_id=4A0DA94E.1040500%40american.edu I originally prepared this as a patch for matplotlib (http://article.gmane.org/gmane.comp.python.matplotlib.general/19097), but never committed. Instead, it is packaged as a mpl_tookit module. Regards, -JJ
Folks, Is there a way to "unpick" data that was previously "picked"? The issue is that pick, is very precise. I cannot depend on a identical click, in the exact same location, to create the "unpick" tool and behavior that I am looking for. It occurs to me that it is possible to create an "unpick" event by creating a matrix of data that surrounds the unpick location and then if the picked data point is within this matrix of data, I can process and remove the originally picked point from the location I am storing the original pick locations. Maybe Pygame or a collision tool might work also, but I have to study to find out. Is there another preferred way that you see? or can recommend? Thank You and Best Regards, Michael Frauens
Hi all, When creating a new colormap, with a script based on the example given here: http://www.scipy.org/Cookbook/Matplotlib/Show_colormaps When plotting the data, and when adding the colobar, I get this error: In [27]: Exception in Tkinter callback Traceback (most recent call last): File "/usr/lib/python2.6/lib-tk/Tkinter.py", line 1413, in __call__ return self.func(*args) File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_tkagg.py", line 212, in resize self.show() File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_tkagg.py", line 215, in draw FigureCanvasAgg.draw(self) File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_agg.py", line 314, in draw self.figure.draw(self.renderer) File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 46, in draw_wrapper draw(artist, renderer, *kl) File "/usr/lib/pymodules/python2.6/matplotlib/figure.py", line 774, in draw for a in self.axes: a.draw(renderer) File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 46, in draw_wrapper draw(artist, renderer, *kl) File "/usr/lib/pymodules/python2.6/matplotlib/axes.py", line 1721, in draw a.draw(renderer) File "/usr/lib/pymodules/python2.6/matplotlib/collections.py", line 699, in draw return Collection.draw(self, renderer) File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 46, in draw_wrapper draw(artist, renderer, *kl) File "/usr/lib/pymodules/python2.6/matplotlib/collections.py", line 201, in draw self.update_scalarmappable() File "/usr/lib/pymodules/python2.6/matplotlib/collections.py", line 477, in update_scalarmappable self._facecolors = self.to_rgba(self._A, self._alpha) File "/usr/lib/pymodules/python2.6/matplotlib/cm.py", line 167, in to_rgba x = self.cmap(x, alpha=alpha, bytes=bytes) File "/usr/lib/pymodules/python2.6/matplotlib/colors.py", line 488, in __call__ if not self._isinit: self._init() File "/usr/lib/pymodules/python2.6/matplotlib/colors.py", line 632, in _init self._lut[:-3, 2] = makeMappingArray(self.N, self._segmentdata['blue']) File "/usr/lib/pymodules/python2.6/matplotlib/colors.py", line 416, in makeMappingArray raise TypeError("data must be convertable to an array") TypeError: data must be convertable to an array When I don't change the example from the cookbook, I still get the same error, and no image. Previously, I didn't get this error. I'm using Python 2.6 and MPL 0.99.0 on Ubuntu 9.10. Any help would be great! Marius.
On 5/10/10 2:21 PM, Michael Hearne wrote: > I have found a (possible) bug in Basemap - when using basemap.fillcontinents(), I see the chosen continent color only when the map I create includes some ocean. If I am in the interior of a continent (I've tested with North America and Asia), the continent color is white. > Michael: If there are no continent boundaries inside the map projection region, basemap does not draw anything (hence you see the axis background color). In that case, you should just set the axis background color to whatever you wanted the continent color to be. -Jeff > A code sample is below. My version information: > Basemap: 0.99.4 > Matplotlib: 0.99.1.1 > numpy: 1.4.0 > Python: 2.6.4 > > To replicate my results, please try the following: > ./maptest.py 37.894507 -121.816406 #map center is somewhere in the Bay Area in California > ./maptest.py 41.880332 -100.47821 #map center is somewhere in Nebraska > > The script creates a file called "output.png" in the calling directory. In the California case, I see the ocean as blue, and the land as a sort of annoying salmon color. In the Nebraska case, I see white with blue denoting the various rivers and lakes in the area. > > Am I mis-using the basemap method calls in some way? > > Thanks, > > Mike > > -------------------------------------------------------------------- > #!/usr/bin/env python > > import matplotlib > #use the non-interactive matplotlib setting > matplotlib.use('agg') > from mpl_toolkits.basemap import Basemap > import numpy as np > from pylab import * > import sys > > clat = float(sys.argv[1]) > clon = float(sys.argv[2]) > > figwidth = 5.4 > > > bounds = (clon-4, clon+4, clat-4, clat+4) > dx = (bounds[1] - bounds[0])*111191 * np.cos(clat * np.pi/180) > dy = (bounds[3] - bounds[2])*111191 > aspect = dy/dx > figheight = aspect * figwidth > > fig = figure(figsize=(figwidth,figheight),edgecolor='g',facecolor='g') > ax1 = fig.add_axes([0,0,1.0,1.0]) > mapcontour = Basemap(llcrnrlon=bounds[0],llcrnrlat=bounds[2], > urcrnrlon=bounds[1],urcrnrlat=bounds[3], > resolution='h',projection='merc',lat_ts=clat) > water_color = [.47,.60,.81] > mapcontour.drawrivers(color=water_color) > mapcontour.drawcountries(color='k',linewidth=2.0) > mapcontour.drawcoastlines() > mapcontour.fillcontinents(color=[1.0,0.8,0.8],lake_color=water_color) > > plt.savefig('output.png') > -------------------------------------------------------------------- > > > ------------------------------------------------------------------------------ > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >
I have found a (possible) bug in Basemap - when using basemap.fillcontinents(), I see the chosen continent color only when the map I create includes some ocean. If I am in the interior of a continent (I've tested with North America and Asia), the continent color is white. A code sample is below. My version information: Basemap: 0.99.4 Matplotlib: 0.99.1.1 numpy: 1.4.0 Python: 2.6.4 To replicate my results, please try the following: ./maptest.py 37.894507 -121.816406 #map center is somewhere in the Bay Area in California ./maptest.py 41.880332 -100.47821 #map center is somewhere in Nebraska The script creates a file called "output.png" in the calling directory. In the California case, I see the ocean as blue, and the land as a sort of annoying salmon color. In the Nebraska case, I see white with blue denoting the various rivers and lakes in the area. Am I mis-using the basemap method calls in some way? Thanks, Mike -------------------------------------------------------------------- #!/usr/bin/env python import matplotlib #use the non-interactive matplotlib setting matplotlib.use('agg') from mpl_toolkits.basemap import Basemap import numpy as np from pylab import * import sys clat = float(sys.argv[1]) clon = float(sys.argv[2]) figwidth = 5.4 bounds = (clon-4, clon+4, clat-4, clat+4) dx = (bounds[1] - bounds[0])*111191 * np.cos(clat * np.pi/180) dy = (bounds[3] - bounds[2])*111191 aspect = dy/dx figheight = aspect * figwidth fig = figure(figsize=(figwidth,figheight),edgecolor='g',facecolor='g') ax1 = fig.add_axes([0,0,1.0,1.0]) mapcontour = Basemap(llcrnrlon=bounds[0],llcrnrlat=bounds[2], urcrnrlon=bounds[1],urcrnrlat=bounds[3], resolution='h',projection='merc',lat_ts=clat) water_color = [.47,.60,.81] mapcontour.drawrivers(color=water_color) mapcontour.drawcountries(color='k',linewidth=2.0) mapcontour.drawcoastlines() mapcontour.fillcontinents(color=[1.0,0.8,0.8],lake_color=water_color) plt.savefig('output.png') --------------------------------------------------------------------
It seems to be failing on the minus signs in the text, due to a recent (incorrect) change to declared encoding of the postscript file. This has been corrected in r8305. You didn't mention which version of matplotlib you are running... I'm not sure this bug would be in the latest released version, only SVN trunk. Mike afancy wrote: > Hi, > > Could anybody help me to take a look my following code? When I save it > to eps format, the eps file is corrupted. But i can save as pdf format > successfully instead. > > Regards > tommy > > > from matplotlib.font_manager import FontProperties > data = ((16.31, 76.35, 62.62, 135.2), > (6.4, 12.64, 87, 124.8 ), > (6.08,60.18,75.2,100.59)) > > color=('b','r','g','y') > width = 0.2 > fig = plt.figure() > fig.set_size_inches((4.2,4.2)) > > ax = fig.add_axes((0.2,0.1,0.75,0. > 8)) > rects=[] > xticks=[] > patterns = ('...','//','xx', '\\\\') > > for i in range(len(data)): > row = data[i] > for j in range(len(row)): > rect, = ax.bar(i+width*j, row[j], width,fill=False, > edgecolor='black', hatch=patterns[j]) > rect.set_hatch(patterns[j]) > rect.set_fill(False) > if i==0: > rects.append(rect) > xticks.append(i+2*width) > > ax.set_xticks(xticks) > ax.set_xticklabels(('Q1(s,p1,*)','Q2(s,p2,*)','Q3(s,p3,*)')) > ax.set_ylabel('Resp. time (ms)') > lg=fig.legend(rects, > ('3XL-Array','3XL-MP','Jena2(db-based)','Jena2(file-based)'), > loc=(0.65,0.7), prop=FontProperties(size=9)) > lg.draw_frame(False) > draw() > fig.savefig("4b.eps", format="eps", bbox_inches='tight') # Failed > to save, the eps is corrupted > #fig.savefig("4b.pdf", format="pdf", bbox_inches='tight') # pdf > format can be save correctly. > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > > > ------------------------------------------------------------------------ > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA
Hi, Could anybody help me to take a look my following code? When I save it to eps format, the eps file is corrupted. But i can save as pdf format successfully instead. Regards tommy from matplotlib.font_manager import FontProperties data = ((16.31, 76.35, 62.62, 135.2), (6.4, 12.64, 87, 124.8 ), (6.08,60.18,75.2,100.59)) color=('b','r','g','y') width = 0.2 fig = plt.figure() fig.set_size_inches((4.2,4.2)) ax = fig.add_axes((0.2,0.1,0.75,0. 8)) rects=[] xticks=[] patterns = ('...','//','xx', '\\\\') for i in range(len(data)): row = data[i] for j in range(len(row)): rect, = ax.bar(i+width*j, row[j], width,fill=False, edgecolor='black', hatch=patterns[j]) rect.set_hatch(patterns[j]) rect.set_fill(False) if i==0: rects.append(rect) xticks.append(i+2*width) ax.set_xticks(xticks) ax.set_xticklabels(('Q1(s,p1,*)','Q2(s,p2,*)','Q3(s,p3,*)')) ax.set_ylabel('Resp. time (ms)') lg=fig.legend(rects, ('3XL-Array','3XL-MP','Jena2(db-based)','Jena2(file-based)'), loc=(0.65,0.7), prop=FontProperties(size=9)) lg.draw_frame(False) draw() fig.savefig("4b.eps", format="eps", bbox_inches='tight') # Failed to save, the eps is corrupted #fig.savefig("4b.pdf", format="pdf", bbox_inches='tight') # pdf format can be save correctly.
I just noticed something else now: When tick labels are explicitly supplied, that may not actually reflect in the return result of get_ticks. Specifically, I set the tick labels in a color bar, but get_ticklabels() returns a list of empty text objects Text(0,0,''). For regular axes, that seems to work better. Bug? Cheers, Nico On Sat, May 8, 2010 at 10:36 AM, Nico Schlömer <nic...@gm...> wrote: > Hi, > > say, is there a way to query an axis object whether or not the tick > labels are drawn? > > I looked at -- one the x-axis -- get_xticks( and get_xticklabels() > which in two different situations would spit out a list of doubles > (the tick positions) and a list of text entries of the form > Text(0,0,''). In one plot, though, the tick labels are drawn, not in > the other one. > > Cheers, > Nico >
You may also try saving as SVG and then loading in Inkscape and using its various "artistic" vector plugins to achieve similar results. Mike John Hunter wrote: > On Fri, May 7, 2010 at 1:09 PM, Eric Firing <ef...@ha...> wrote: > >> On 05/06/2010 08:02 PM, oyster wrote: >> >>> I know matplotlib mimics matlab, which offers scientific look. >>> but can we use matplotlib to get a skecth(in other words, >>> hand-drawing) style for bar/pie/etc in none formalist paper? for >>> example, http://teethgrinder.co.uk/open-flash-chart/gallery-bar-7.php >>> thanks >>> >> With a considerable effort you could use mpl's capabilities to program >> this sort of thing, but it will not be added as an option. >> > > JJ's demo_ribbon_box is pretty close -- you just need to create a base > image you want stretched to the bar height. > > import matplotlib.pyplot as plt > import numpy as np > from matplotlib.image import BboxImage > > from matplotlib._png import read_png > import matplotlib.colors > from matplotlib.cbook import get_sample_data > > class RibbonBox(object): > > original_image = read_png(get_sample_data("Minduka_Present_Blue_Pack.png", > asfileobj=False)) > cut_location = 70 > b_and_h = original_image[:,:,2] > color = original_image[:,:,2] - original_image[:,:,0] > alpha = original_image[:,:,3] > nx = original_image.shape[1] > > def __init__(self, color): > rgb = matplotlib.colors.colorConverter.to_rgb(color) > > im = np.empty(self.original_image.shape, > self.original_image.dtype) > > > im[:,:,:3] = self.b_and_h[:,:,np.newaxis] > im[:,:,:3] -= self.color[:,:,np.newaxis]*(1.-np.array(rgb)) > im[:,:,3] = self.alpha > > self.im = im > > > def get_stretched_image(self, stretch_factor): > stretch_factor = max(stretch_factor, 1) > ny, nx, nch = self.im.shape > ny2 = int(ny*stretch_factor) > > stretched_image = np.empty((ny2, nx, nch), > self.im.dtype) > cut = self.im[self.cut_location,:,:] > stretched_image[:,:,:] = cut > stretched_image[:self.cut_location,:,:] = \ > self.im[:self.cut_location,:,:] > stretched_image[-(ny-self.cut_location):,:,:] = \ > self.im[-(ny-self.cut_location):,:,:] > > self._cached_im = stretched_image > return stretched_image > > > > class RibbonBoxImage(BboxImage): > zorder = 1 > > def __init__(self, bbox, color, > cmap = None, > norm = None, > interpolation=None, > origin=None, > filternorm=1, > filterrad=4.0, > resample = False, > **kwargs > ): > > BboxImage.__init__(self, bbox, > cmap = cmap, > norm = norm, > interpolation=interpolation, > origin=origin, > filternorm=filternorm, > filterrad=filterrad, > resample = resample, > **kwargs > ) > > self._ribbonbox = RibbonBox(color) > self._cached_ny = None > > > def draw(self, renderer, *args, **kwargs): > > bbox = self.get_window_extent(renderer) > stretch_factor = bbox.height / bbox.width > > ny = int(stretch_factor*self._ribbonbox.nx) > if self._cached_ny != ny: > arr = self._ribbonbox.get_stretched_image(stretch_factor) > self.set_array(arr) > self._cached_ny = ny > > BboxImage.draw(self, renderer, *args, **kwargs) > > > if 1: > from matplotlib.transforms import Bbox, TransformedBbox > from matplotlib.ticker import ScalarFormatter > > fig = plt.gcf() > fig.clf() > ax = plt.subplot(111) > > years = np.arange(2004, 2009) > box_colors = [(0.8, 0.2, 0.2), > (0.2, 0.8, 0.2), > (0.2, 0.2, 0.8), > (0.7, 0.5, 0.8), > (0.3, 0.8, 0.7), > ] > heights = np.random.random(years.shape) * 7000 + 3000 > > fmt = ScalarFormatter(useOffset=False) > ax.xaxis.set_major_formatter(fmt) > > for year, h, bc in zip(years, heights, box_colors): > bbox0 = Bbox.from_extents(year-0.4, 0., year+0.4, h) > bbox = TransformedBbox(bbox0, ax.transData) > rb_patch = RibbonBoxImage(bbox, bc, interpolation="bicubic") > > ax.add_artist(rb_patch) > > ax.annotate(r"%d" % (int(h/100.)*100), > (year, h), va="bottom", ha="center") > > patch_gradient = BboxImage(ax.bbox, > interpolation="bicubic", > zorder=0.1, > ) > gradient = np.zeros((2, 2, 4), dtype=np.float) > gradient[:,:,:3] = [1, 1, 0.] > gradient[:,:,3] = [[0.1, 0.3],[0.3, 0.5]] # alpha channel > patch_gradient.set_array(gradient) > ax.add_artist(patch_gradient) > > > ax.set_xlim(years[0]-0.5, years[-1]+0.5) > ax.set_ylim(0, 10000) > > fig.savefig('ribbon_box.png') > plt.show() > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > > ------------------------------------------------------------------------ > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA
I believe there's only a handful of characters available as sub/superscript in Unicode: http://www.unicode.org/charts/PDF/U2070.pdf Mike Gökhan Sever wrote: > Hello, > > I have tendency to use unicode strings for my simple units e.g. > plt.xlabel(u"Concentration (# cm−3)") > > Wondering if it is possible to subscript and/or superscript any > character in unicode strings? In other words could the following be > done via unicode only? > > plt.title(r"N$_{ccn} = C s^k$") > > > Thanks. > > Gökhan > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > > > ------------------------------------------------------------------------ > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA
Hello, I have tendency to use unicode strings for my simple units e.g. plt.xlabel(u"Concentration (# cm−3)") Wondering if it is possible to subscript and/or superscript any character in unicode strings? In other words could the following be done via unicode only? plt.title(r"N$_{ccn} = C s^k$") Thanks. Gökhan
Hi, say, is there a way to query an axis object whether or not the tick labels are drawn? I looked at -- one the x-axis -- get_xticks( and get_xticklabels() which in two different situations would spit out a list of doubles (the tick positions) and a list of text entries of the form Text(0,0,''). In one plot, though, the tick labels are drawn, not in the other one. Cheers, Nico