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
(38) |
2
(31) |
3
(9) |
|
4
(13) |
5
(24) |
6
(11) |
7
(8) |
8
(14) |
9
(7) |
10
(4) |
|
11
(7) |
12
(11) |
13
(16) |
14
(19) |
15
(11) |
16
(9) |
17
(3) |
|
18
(4) |
19
(47) |
20
(28) |
21
(9) |
22
(9) |
23
(11) |
24
|
|
25
|
26
(12) |
27
(22) |
28
(20) |
29
(16) |
30
(19) |
|
|
From: Friedrich R. <fri...@gm...> - 2010-04-11 13:27:10
|
2010/4/11 tom...@gm... <tom...@gm...>: > can someone help me to plot a polygon in matplotlib? > I have been reading about the axes.patches.Polygon class and I have defined > the > Polygon object that has a preset lw and points. How do I plot it? Here http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.add_artist maybe helps? > I'm confused because the Axes documentation states that this class holds > most of > the figure objects like Rectangle, Line2D, and then the website states that > the Line2D > is a return object from the plt.plot() invocation. What if I create my own > set of Rectangle > (Polygon) objects and want to create a list of them and plot them? afaik, the artist, or whatever, is retured to make its properties adjustable later. > Also, I'm using this sequence of commands to work in OO mode interactively > (just to learn) but when I execute plt.draw() no figure appears. > > import numpy as np > import matplotlib.pyplot as plt > > myFig = plt.figure() > > myAx = myFig.add_axes() # I have tried myFig.add_subplot(1,1,1) but it > didn't help > > x = np.arange(0,np.pi, 0.01) > > myAx.plot (x, np.sin(x)) > > plt.draw() # nothing happens As your oo Figure is not registered to the plt module, since you created it via api, this should be normal. Maybe have a look at http://matplotlib.sourceforge.net/examples/user_interfaces/index.html , I think you have to embed your api-created Figure in a widget manager of your choice. > These commands are executed within an interactive ipython session but if I > start ipython > > with ipython -pylab, plt.draw() draws a figure I can see. I'm running Arch > linux and Openbox > > as a window manager, the system is 64 bit. I think you can use Tk via the Tkinter Python package. On linux I heard it's looking a bit weird, but as a starting points it's easy enough. But maybe try also the other widget managers, like Gtk. There are certainly some people around which have more knowledge on Gtk and so on than me having with Tkinter. hth, Friedrich |
|
From: <tom...@gm...> - 2010-04-11 12:18:37
|
Hi everyone, can someone help me to plot a polygon in matplotlib? I have been reading about the axes.patches.Polygon class and I have defined the Polygon object that has a preset lw and points. How do I plot it? I'm confused because the Axes documentation states that this class holds most of the figure objects like Rectangle, Line2D, and then the website states that the Line2D is a return object from the plt.plot() invocation. What if I create my own set of Rectangle (Polygon) objects and want to create a list of them and plot them? Also, I'm using this sequence of commands to work in OO mode interactively (just to learn) but when I execute plt.draw() no figure appears. import numpy as np import matplotlib.pyplot as plt myFig = plt.figure() myAx = myFig.add_axes() # I have tried myFig.add_subplot(1,1,1) but it didn't help x = np.arange(0,np.pi, 0.01) myAx.plot (x, np.sin(x)) plt.draw() # nothing happens These commands are executed within an interactive ipython session but if I start ipython with ipython -pylab, plt.draw() draws a figure I can see. I'm running Arch linux and Openbox as a window manager, the system is 64 bit. |
|
From: Jae-Joon L. <lee...@gm...> - 2010-04-10 19:12:31
|
See these examples. bbox works in a same way for the text and the annotation. http://matplotlib.sourceforge.net/examples/pylab_examples/fancytextbox_demo.html http://matplotlib.sourceforge.net/examples/pylab_examples/annotation_demo2.html And, the annotation guide my help. http://matplotlib.sourceforge.net/users/annotations_guide.html But they do not support a circle (or ellipse), although implementing it should be straight forward. Regards, -JJ On Fri, Apr 9, 2010 at 9:12 PM, Nico Schlömer <nic...@gm...> wrote: > Hi all, > > is there any way to encircle a text annotation? > Looking at > > http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.annotate > > suggests tinkering with bbox I guess, but I haven't had any success with it. > Hints? > > Cheers, > Nico > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: arsbbr <ar...@gm...> - 2010-04-10 14:36:15
|
Hi,
by putting
rc('text', usetex=True)
rc('text.latex',preamble='\usepackage[bitstream-charter]{mathdesign}')
in my plot source I was trying to get a consistent fontface, but it doesn't
work.
I know since preamble is not officially supported in matplotlib I didn't
really expect it to work so easily.
But because Bitstream Charter is officially supported and selectable for
normal text, I was wondering why the font package is not loaded with
mathdesign? Is it possible to load the mathdesign package somewhere
manually?
Thanks.
--
View this message in context: http://old.nabble.com/LaTeX-Mathdesign-Fonts-patch--tp28202319p28202319.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
|
|
From: konstellationen <kon...@gm...> - 2010-04-10 01:15:38
|
For future reference, the solution proposed by Gökhan and Diakronik is to
replace the Latex tick-labels with strings:
>import matplotlib.pyplt as plt
>tick_locs = range(start, stop, increment)
>plt.xticks(tick_locs, [r"$\mathbf{%s}$" % x for x in tick_locs])
If you have twin x or y axes (my case), the solution I found was:
(Note: this solution is essentially the same as the one above, with the
distinction that every entry is set manually, which allows for more
flexibility, but requires more work)
>from mpl_toolkits.axes_grid.parasite_axes import SubplotHost
>from matplotlib.pylab import * # For plotting graphs.
>from matplotlib.pyplot import *
>fig=figure(1)
>host= SubplotHost(fig,111)
>fig.add_subplot(host)
>par=host.twiny()
>host.axis["bottom"]
>par.axis["top"]
>hostv=[1e-14,1e-4,-1.5,1.5]
>host.axis(hostv)
>parv=[1e-8,1e2,-1.5,0.5]
>par.axis(parv)
>host.set_xticks([1e-14, ... ,1e-4])
>x_labels = [r'\boldmath $10^{-14} $', ... ,r'\boldmath $ $']
>host.set_xticklabels(x_labels)
>par.set_xticks([1e-8, ... ,1e2])
>parx_labels = [ r'\boldmath $10^{-8}$', ... ,r'\boldmath $ $' ]
>par.set_xticklabels(parx_labels)
>host.set_yticks([-1,0])
>y_labels = [r'\boldmath $-1$', r'\boldmath $0$']
>host.set_yticklabels(y_labels)
Result:
http://old.nabble.com/file/p28199345/Picture%2B7.png
--
View this message in context: http://old.nabble.com/Bold-Latex-Tick-Labels-tp28037900p28199345.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
|
|
From: Nico S. <nic...@gm...> - 2010-04-10 01:12:52
|
Hi all,
is there any way to encircle a text annotation?
Looking at
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.annotate
suggests tinkering with bbox I guess, but I haven't had any success with it.
Hints?
Cheers,
Nico
|
|
From: Friedrich R. <fri...@gm...> - 2010-04-09 19:39:11
|
I think the Figure you create may be not registered in the pylab framework, and indeed I think this is not a bug. The --pylab switch tries to obtain the active figure, but because there is no active pyplot-Figure, it gets None from get_active() in your traceback. Then it fails. I think --pylab is only intended for pure pyplot usage, when you use the oo framework, be prepared to make it fail. Does this help? Friedrich 2010/4/8 Mathew Yeates <mat...@gm...>: > The following works without the --pylab switch but not with it. The error I > get is some how related to a call to get the active figure which returns > None. > C:\Python26\lib\site-packages\mpl_toolkits\basemap\__init__.pyc in > set_axes_limi > ts(self, ax) > 2531 if is_interactive(): > 2532 figManager = _pylab_helpers.Gcf.get_active() > -> 2533 figManager.canvas.draw() > AttributeError: 'NoneType' object has no attribute 'canvas'. > In the following code. the error happens at > m.drawcoastlines() > Help? > =============================================== > from mpl_toolkits.basemap import Basemap, shiftgrid > import numpy as np > import matplotlib.pyplot as plt > from matplotlib.backends.backend_gtkagg import \ > FigureCanvasGTKAgg as FigureCanvas > import gtk > # create new figure > #fig=plt.figure() > from matplotlib.figure import Figure > fig = Figure(figsize=(5,5), dpi=100) > canvas = FigureCanvas(fig) > window = gtk.Window(gtk.WINDOW_TOPLEVEL) > window.add(canvas) > # setup cylindrical equidistant map projection (global domain). > ax = fig.add_axes([0.1,0.1,0.7,0.7]) > m = Basemap(llcrnrlon=-180.,llcrnrlat=-90,urcrnrlon=180.,urcrnrlat=90.,\ > resolution='c',area_thresh=10000.,projection='cyl',ax=ax) > m.drawcoastlines() > m.tissot(-117,34,10,10) > #plt.show() > canvas.show() > window.show() |
|
From: Mathew Y. <mat...@gm...> - 2010-04-09 16:44:07
|
Can anyone verify this? If so, I'll submit it to the tracker.
The following works without the --pylab switch but not with it. The error I
get is some how related to a call to get the active figure which returns
None.
C:\Python26\lib\site-packages\mpl_toolkits\basemap\__init__.pyc in
set_axes_limi
ts(self, ax)
2531 if is_interactive():
2532 figManager = _pylab_helpers.Gcf.get_active()
-> 2533 figManager.canvas.draw()
AttributeError: 'NoneType' object has no attribute 'canvas'.
In the following code. the error happens at
m.drawcoastlines()
Help?
===============================================
from mpl_toolkits.basemap import Basemap, shiftgrid
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.backends.backend_gtkagg import \
FigureCanvasGTKAgg as FigureCanvas
import gtk
# create new figure
#fig=plt.figure()
from matplotlib.figure import Figure
fig = Figure(figsize=(5,5), dpi=100)
canvas = FigureCanvas(fig)
window = gtk.Window(gtk.WINDOW_TOPLEVEL)
window.add(canvas)
# setup cylindrical equidistant map projection (global domain).
ax = fig.add_axes([0.1,0.1,0.7,0.7])
m = Basemap(llcrnrlon=-180.,llcrnrlat=-90,urcrnrlon=180.,urcrnrlat=90.,\
resolution='c',area_thresh=10000.,projection='cyl',ax=ax)
m.drawcoastlines()
m.tissot(-117,34,10,10)
#plt.show()
canvas.show()
window.show()
|
|
From: Ryan M. <rm...@gm...> - 2010-04-09 14:34:17
|
On Fri, Apr 9, 2010 at 12:16 AM, Peter Butterworth <bu...@gm...> wrote:
> Hi,
>
> I'm having trouble getting some properties that are easily set :
>
>
> leg=legend(loc=0)
> is there a way to retrieve the legend location ?
leg._loc
I'm not sure why it's given a leading '_' to signal a private
variable, since it's implemented as a property. I'd probably still use
it.
> In a similar vein :
> axis('scaled')
> is there a way to retrieve the "scaled" property ?
Not really, since scaled isn't stored, but is merely a helper for
self.set_aspect('equal', adjustable='box', anchor='C')
self.set_autoscale_on(False)
You can get all of these properties individually:
ax = plt.gca()
ax.get_aspect()
ax.get_adjustable()
ax.get_anchor()
ax.get_autoscale_on()
Ryan
--
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
|
|
From: KrishnaPribadi <Kri...@ha...> - 2010-04-09 13:01:21
|
Here my screen shot. Notice the red and green line merging then turning brown... -- View this message in context: http://old.nabble.com/2-lines%2C-2-diff-colors%2C-when-converged%2C-gets-3rd-color...-tp28182679p28190837.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: Peter B. <bu...@gm...> - 2010-04-09 05:16:08
|
Hi,
I'm having trouble getting some properties that are easily set :
leg=legend(loc=0)
is there a way to retrieve the legend location ?
In a similar vein :
axis('scaled')
is there a way to retrieve the "scaled" property ?
If no methods/properties are available in the default API is it
possible to implement them easily ?
|
|
From: Rachel-Mikel A. J. <Rac...@HM...> - 2010-04-09 04:03:17
|
Hello everyone, I'm working with hexbin() and I'd like the output to be shifted towards the red end of the spectrum. Does anyone know if there's a way to shift how the colors are output? Thanks! Rachel |
|
From: ericyosho <eri...@gm...> - 2010-04-09 00:06:04
|
Yes, Thanks, Friedrich. :-) This is exactly what I want. By now I know we have to plot over a uniformly sampled plane any way at the end of the day, no matter whether our original data is uniformly sampled or not. Zhe Yao On Thu, Apr 8, 2010 at 6:07 PM, Friedrich Romstedt <fri...@gm...> wrote: > 2010/4/4 ericyosho <eri...@gm...>: >> Year, I think we could do unsorted scatter plot as well, however I'm >> still not satisfied with the book tracking routines I have to check >> when doing the surface plotting. > > What do you mean with "book tracking routines"? > > Anyway, maybe griddata would help you: > http://matplotlib.sourceforge.net/api/mlab_api.html#matplotlib.mlab.griddata > > Friedrich > |
|
From: Friedrich R. <fri...@gm...> - 2010-04-08 22:07:23
|
2010/4/4 ericyosho <eri...@gm...>: > Year, I think we could do unsorted scatter plot as well, however I'm > still not satisfied with the book tracking routines I have to check > when doing the surface plotting. What do you mean with "book tracking routines"? Anyway, maybe griddata would help you: http://matplotlib.sourceforge.net/api/mlab_api.html#matplotlib.mlab.griddata Friedrich |
|
From: Friedrich R. <fri...@gm...> - 2010-04-08 21:54:17
|
2010/4/3 ms <dev...@gm...>: > I am trying to use griddata to plot some (irregularly) spaced data as a > contour plot, but sometimes ALL the grid it outputs is masked: so no plot. > > In the docs I read: > "A masked array is returned if any grid points are outside convex hull > defined by input data (no extrapolation is done)." > > but I have no real idea of what does it mean. > Any suggestion to troubleshoot / understand what's going on? When you do trinangulation, the lines between all pairs of points define an inner region and an outer region, I guess, the inner region is meant by "outside convex hull". I furthermore guess, that all your interpolation points are outside this hull, i.e., your interpolation spacing is of comparable order of magnitude as your input data extent? Friedrich |
|
From: Michael D. <md...@st...> - 2010-04-08 18:44:24
|
The default behavior should be for the lines not to blend. Can you provide a short example script that illustrates what you're seeing? Or an image? Mike KrishnaPribadi wrote: > I'm plotting 2 lines with 2 colors. The lines are binary so they are somewhat > square. When the lines converge on a same value for a period, their colors > combine and turn into a 3rd color.... > > Is there a way to force the plotting to not "blend" the 2 colors together? I > just want the 2nd line to lay on top of the 1st line. > > Any suggestions? > -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA |
|
From: KrishnaPribadi <Kri...@ha...> - 2010-04-08 18:30:54
|
I'm plotting 2 lines with 2 colors. The lines are binary so they are somewhat square. When the lines converge on a same value for a period, their colors combine and turn into a 3rd color.... Is there a way to force the plotting to not "blend" the 2 colors together? I just want the 2nd line to lay on top of the 1st line. Any suggestions? -- View this message in context: http://old.nabble.com/2-lines%2C-2-diff-colors%2C-when-converged%2C-gets-3rd-color...-tp28182679p28182679.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: Mathew Y. <mat...@gm...> - 2010-04-08 17:33:48
|
The following works without the --pylab switch but not with it. The error I
get is some how related to a call to get the active figure which returns
None.
C:\Python26\lib\site-packages\mpl_toolkits\basemap\__init__.pyc in
set_axes_limi
ts(self, ax)
2531 if is_interactive():
2532 figManager = _pylab_helpers.Gcf.get_active()
-> 2533 figManager.canvas.draw()
AttributeError: 'NoneType' object has no attribute 'canvas'.
In the following code. the error happens at
m.drawcoastlines()
Help?
===============================================
from mpl_toolkits.basemap import Basemap, shiftgrid
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.backends.backend_gtkagg import \
FigureCanvasGTKAgg as FigureCanvas
import gtk
# create new figure
#fig=plt.figure()
from matplotlib.figure import Figure
fig = Figure(figsize=(5,5), dpi=100)
canvas = FigureCanvas(fig)
window = gtk.Window(gtk.WINDOW_TOPLEVEL)
window.add(canvas)
# setup cylindrical equidistant map projection (global domain).
ax = fig.add_axes([0.1,0.1,0.7,0.7])
m = Basemap(llcrnrlon=-180.,llcrnrlat=-90,urcrnrlon=180.,urcrnrlat=90.,\
resolution='c',area_thresh=10000.,projection='cyl',ax=ax)
m.drawcoastlines()
m.tissot(-117,34,10,10)
#plt.show()
canvas.show()
window.show()
|
|
From: KrishnaPribadi <Kri...@ha...> - 2010-04-08 16:09:35
|
Thanks Tony. That helps clean up the code. Now that I think about it more, I actaually had 2 questions. The first you answered well. The second question relates to my problem when using this method in that it produces line colors where some colors are too similar. In other words, there isn't enough of a stark differnece in color between the lines. Can someone suggest a different method (or something that may already be built in) of coming up with 12 or more line colors (more than the built in 8) that are stark? (I know I'm nit-picking and can probably just pick out my own colors but it's an interesting excersize). -- View this message in context: http://old.nabble.com/custom-color-cycle-from-cmap-tp28177653p28180731.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: Friedrich R. <fri...@gm...> - 2010-04-08 14:46:53
|
2010/4/8 Filipe Fernandes <oc...@gm...>:
> BTW: What I meant by limitation is the fact that Agg has no GUI like the
> nice QT window I was using before. The users of this script have no
> experience with scripting languages and enjoyed choosing the format and
> filename using a GUI interface.
I'm quite convinced that you can have the figure in multiple Canvases
at the same time. Or create the FigureCanvasAgg or the call to
.savefig() only on save time. In every widget framework, it should be
fairly easy to build a custom gui having a customised "Save ..."
button, I guess?
> In addition, PIL's show() use an external linux program "xv". In the end
> I wanted to eliminate one external linux program (Imagemagik convert)
> but ended up with another one...
When using Tkinter, you can use ImageTk:
im = {some PIL Image} # Some image to be shown
canvas = {some Tkinter.Canvas} # For drawing graphics
viewport = ImageTk.PhotoImage(im)
canvas.create_image((0, 0), image = viewport, anchor = 'nw') # Put
the image on the Tkinter.Canvas. Modify according your needs.
# Now the PIL Image has been rendered on the canvas.
# Maybe do canvas.update() or call the master's .update(),
# or call some .mainloop() entry function. For instance, use the
# Tkinter.Tk instance's method .mainloop().
When renewing the graphics, don't forget to canvas.delete({tag}) using
the {tag} returned by canvas.create_image(), otherwise you will
probably loose perfomance.
There are examples on matplotlib.sourceforge.net how to use Tkinter
with matplotlib.
hth,
Friedrich
|
|
From: Tony S Yu <ts...@gm...> - 2010-04-08 13:35:54
|
On Apr 8, 2010, at 8:13 AM, KrishnaPribadi wrote: > > Hi, > I'm trying to plot a set of lines, 12 to be exact, and the default color > cycle only supports 8 or 9 distinct colors. That said, I looked up the color > maps and segmented it using 12 constant intervals with the hope of getting > 12 distinct colors. > > The problem I'm running in to is that some of the line colors I get are too > close to each other. This is because come shades in the colormap have a > broader spectrum than others. > > Here is my code to set my custom default color cycle: > > import matplotlib as mpl > cmap = mpl.cm.get_cmap(name='spectral') #I gues we can also use > "hsv" or "gist_rainbow" > nColors = 12 #number of colors > incr = 0.9 / nColors > > self.mycolors = [] > for i in np.arange(0,0.9,incr): > self.mycolors.append(cmap(i)) you could replace the loop with a list comprehension: >>> mycolors = [cmap(i) for i in np.arange(0,0.9,incr)] Also, arange may not be a great fit for this task; maybe linspace would work better: >>> mycolors = [cmap(i) for i in np.linspace(0, 0.9, nColors)] This allows you to eliminate the assignment of `incr`. Note: the above colormap is different than that created by arange because linspace includes the endpoint, while arange doesn't. Hope that helps, -Tony > > mpl.axes.set_default_color_cycle(self.mycolors) > > Can anyone suggest a cleaner method? Or is there perhaps an existing class > to provide distinct color lines? > > Thanks, > Krishna |
|
From: Filipe F. <oc...@gm...> - 2010-04-08 12:55:26
|
Sorry, my bad. I always hit reply without checking... it is not the
first time did that,
Here is the solution for the list sake:
""" trim image """
import StringIO, Image
imgdata = StringIO.StringIO()
fig.savefig(imgdata, dpi=300, format='png')
imgdata.seek(0)
im = Image.open(imgdata)
def trim(im, border):
from PIL import ImageChops
bg = Image.new(im.mode, im.size, border)
diff = ImageChops.difference(im, bg)
bbox = diff.getbbox()
if bbox:
return im.crop(bbox)
else:
# found no content
raise ValueError("cannot trim; image was empty")
im = trim(im,'white')
im.show()
The StringIO trick is a copy-and-paste from the matplotlib faq. And the
trim function I got from here:
http://mail.python.org/pipermail/image-sig/2008-July/005092.html
Thanks for the discussion, I learned a lot abouth the Agg backend.
BTW: What I meant by limitation is the fact that Agg has no GUI like the
nice QT window I was using before. The users of this script have no
experience with scripting languages and enjoyed choosing the format and
filename using a GUI interface.
In addition, PIL's show() use an external linux program "xv". In the end
I wanted to eliminate one external linux program (Imagemagik convert)
but ended up with another one...
Best, Filipe
On 04/06/2010 05:01 PM, Friedrich Romstedt wrote:
> 2010/4/5 Filipe Fernandes <oc...@gm...>:
>> Thanks a lot. In the end the "StringIO-solution" worked fine. The only
>> limitation is that this works only for the Agg backend.
>> [...]
>
> I'm happy to hear this. As far as I know, using the Agg backend is
> not a limitation, because it provides fully anti-aliased output.
> Besides being available on all platforms (?).
>
> Let me make a small hint: The matplotlib-users mailing list is
> configured that by default replies go to the sender only, not to
> matplotlib-users, so maybe you want to let the list know about your
> solution?
>
> Anyway I'm happy for your Thanks,
> so thanks too,
> Friedrich
|
|
From: KrishnaPribadi <Kri...@ha...> - 2010-04-08 12:13:26
|
Hi,
I'm trying to plot a set of lines, 12 to be exact, and the default color
cycle only supports 8 or 9 distinct colors. That said, I looked up the color
maps and segmented it using 12 constant intervals with the hope of getting
12 distinct colors.
The problem I'm running in to is that some of the line colors I get are too
close to each other. This is because come shades in the colormap have a
broader spectrum than others.
Here is my code to set my custom default color cycle:
import matplotlib as mpl
cmap = mpl.cm.get_cmap(name='spectral') #I gues we can also use
"hsv" or "gist_rainbow"
nColors = 12 #number of colors
incr = 0.9 / nColors
self.mycolors = []
for i in np.arange(0,0.9,incr):
self.mycolors.append(cmap(i))
mpl.axes.set_default_color_cycle(self.mycolors)
Can anyone suggest a cleaner method? Or is there perhaps an existing class
to provide distinct color lines?
Thanks,
Krishna
--
View this message in context: http://old.nabble.com/custom-color-cycle-from-cmap-tp28177653p28177653.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
|
|
From: Jeff W. <js...@fa...> - 2010-04-08 01:45:58
|
Mathew Yeates wrote: > lets say I want to shade the area with lat/lon corners 34.-117 and > 35,-116 > > but my map was created with projection='aeqd' > > The shade area will not be a rectangle. In fact the edges will be > curved. See the basemap code for "tissot". I think every point on the > boundary of the lat/lon box has to projected to a line segment. The > collection of resulting segments forms an irregular polygon. > > Mathew Mathew: Right - it will only be a rectangle in a cylindrical projection. The question remains - what do you want? If you want a rectangle in map projection coordinates, just specify the vertices of a rectangle in map projection coordinates. If you really want a polygon with vertices corresponding to those lat/on values, a polygon with curved sides is the right answer for that map projection. -Jeff > > > > > On Wed, Apr 7, 2010 at 6:24 PM, Jeff Whitaker <js...@fa... > <mailto:js...@fa...>> wrote: > > Mathew Yeates wrote: > > I think this will only work with some projections but not all. > I looked at the code for tissot. It's pretty hairy but it > almost does what I want. (It draws projected circles > instead of projected rectangles. > > Mathew: > > You said you wanted a NxN degree polygon - that's what I gave you. > What exactly do you want? A rectangle in map projection > coordinates? A rectangle in lat/lon coordinates? A circle? > > -Jeff > > > > On Wed, Apr 7, 2010 at 1:54 PM, Jeff Whitaker > <js...@fa... <mailto:js...@fa...> > <mailto:js...@fa... <mailto:js...@fa...>>> wrote: > > Yeates, Mathew C (388D) wrote: > > > > > > > > Hi > > > > What is the simplest way to fill in a 1 degree by 1 degree > rectangle > > on a basemap projection? > > > > > > > > Mathew > > > > Mathew: Try this (for a 10x10 rectangle, but you get the idea) > > from matplotlib.patches import Polygon > import matplotlib.pyplot as plt > from mpl_toolkits.basemap import Basemap > map = Basemap(projection='moll',lon_0=0) > x1,y1 = map(-10,-10) > x2,y2 = map(-10,10) > x3,y3 = map(10,10) > x4,y4 = map(10,-10) > p = Polygon([(x1,y1),(x2,y2),(x3,y3),(x4,y4)],\ > facecolor='red',edgecolor='blue',linewidth=2) > plt.gca().add_patch(p) > map.drawcoastlines() > map.drawmapboundary() > plt.show() > > -Jeff > > > > > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, > find bugs > proactively, and fine-tune applications for parallel > performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > <mailto:Mat...@li...> > <mailto:Mat...@li... > <mailto:Mat...@li...>> > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > |
|
From: Mathew Y. <mat...@gm...> - 2010-04-08 01:39:49
|
lets say I want to shade the area with lat/lon corners 34.-117 and 35,-116 but my map was created with projection='aeqd' The shade area will not be a rectangle. In fact the edges will be curved. See the basemap code for "tissot". I think every point on the boundary of the lat/lon box has to projected to a line segment. The collection of resulting segments forms an irregular polygon. Mathew On Wed, Apr 7, 2010 at 6:24 PM, Jeff Whitaker <js...@fa...> wrote: > Mathew Yeates wrote: > >> I think this will only work with some projections but not all. I looked at >> the code for tissot. It's pretty hairy but it almost does what I want. (It >> draws projected circles >> instead of projected rectangles. >> > Mathew: > > You said you wanted a NxN degree polygon - that's what I gave you. What > exactly do you want? A rectangle in map projection coordinates? A > rectangle in lat/lon coordinates? A circle? > > -Jeff > >> >> >> On Wed, Apr 7, 2010 at 1:54 PM, Jeff Whitaker <js...@fa...<mailto: >> js...@fa...>> wrote: >> >> Yeates, Mathew C (388D) wrote: >> > >> > >> > >> > Hi >> > >> > What is the simplest way to fill in a 1 degree by 1 degree >> rectangle >> > on a basemap projection? >> > >> > >> > >> > Mathew >> > >> >> Mathew: Try this (for a 10x10 rectangle, but you get the idea) >> >> from matplotlib.patches import Polygon >> import matplotlib.pyplot as plt >> from mpl_toolkits.basemap import Basemap >> map = Basemap(projection='moll',lon_0=0) >> x1,y1 = map(-10,-10) >> x2,y2 = map(-10,10) >> x3,y3 = map(10,10) >> x4,y4 = map(10,-10) >> p = Polygon([(x1,y1),(x2,y2),(x3,y3),(x4,y4)],\ >> facecolor='red',edgecolor='blue',linewidth=2) >> plt.gca().add_patch(p) >> map.drawcoastlines() >> map.drawmapboundary() >> plt.show() >> >> -Jeff >> > >> >> >> >> ------------------------------------------------------------------------------ >> Download Intel® Parallel Studio Eval >> Try the new software tools for yourself. Speed compiling, find bugs >> proactively, and fine-tune applications for parallel performance. >> See why Intel Parallel Studio got high marks during beta. >> http://p.sf.net/sfu/intel-sw-dev >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> <mailto:Mat...@li...> >> >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> >> > |