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
(17) |
2
(3) |
3
(2) |
|
4
(11) |
5
(8) |
6
(22) |
7
(16) |
8
(9) |
9
(14) |
10
(1) |
|
11
(8) |
12
(5) |
13
(7) |
14
(10) |
15
(28) |
16
(8) |
17
(20) |
|
18
(6) |
19
(5) |
20
(15) |
21
(8) |
22
(7) |
23
(14) |
24
(10) |
|
25
(6) |
26
(8) |
27
(9) |
28
(11) |
29
(13) |
30
(20) |
|
|
From: Jeffrey S. <jef...@gm...> - 2011-09-05 18:15:22
|
You can use dpi=600 as a parameter to increase the resolution but I'm not sure if that's what you mean. If you mean the actual compression strategy used like to Jpeg2000 per se. Might have to do that after saving the file with an image library (for example, PIL). Cheers, Jeff On 09/06/2011 03:21 AM, Frank Breitling wrote: > Hi, > > I am using matplotlib.savefig to save my figures as JPEG files. > Now I need to reduce the JPG compression ratio. > How can I do this? > > Any hint is appreciated. > > Frank > > ------------------------------------------------------------------------------ > Special Offer -- Download ArcSight Logger for FREE! > Finally, a world-class log management solution at an even better > price-free! And you'll get a free "Love Thy Logs" t-shirt when you > download Logger. Secure your free ArcSight Logger TODAY! > http://p.sf.net/sfu/arcsisghtdev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
From: Frank B. <fbr...@ai...> - 2011-09-05 17:48:56
|
Hi, I am using matplotlib.savefig to save my figures as JPEG files. Now I need to reduce the JPG compression ratio. How can I do this? Any hint is appreciated. Frank |
|
From: Lynn O. <ray...@gm...> - 2011-09-05 06:46:56
|
I don't know about changing backends, but I do need to use TkAgg. I finally got it working. The instructions from the original email below are what worked, but first I had to uninstall Tcl8.6 (manually). The first time I tried it I deleted something that I shouldn't have, and ended up with a mess that I cleaned up by doing a full erase/reinstall of Lion. Then I restored the system from a backup, carefully removed Tcl8.6 manually (the uninstall script is broken), removed most of the remnants of macports, reinstalled a few things that were broken by the reinstall of Lion (XCode, XQuartz, WingIDE, TextWrangler), uninstalled and reinstalled Python 2.7.2, reinstalled Tcl8.5, and rebuilt matplotlib per the instructions. Hopefully it will go much smoother when I set up the new system in a few days. Thanks for your help... Lynn On Sep 4, 2011, at 12:55 AM, Michiel de Hoon wrote: > What happens if you use the MacOSX backend instead of TkAgg? Or do you have to use TkAgg? > > --Michiel. > > --- On Sun, 9/4/11, Lynn Oliver <ray...@gm...> wrote: > > From: Lynn Oliver <ray...@gm...> > Subject: Re: [Matplotlib-users] problems installing matplotlib on OS X Lion > To: "Bryan K Woods" <bw...@ae...> > Cc: "mat...@li..." <mat...@li...> > Date: Sunday, September 4, 2011, 3:38 AM > > Bryan, thanks for the response. > > I installed macports and the environment settings seem to be correct, but when I try "port help selfupdate" I get: > /opt/local/bin/port: line 4: /usr/bin/tclsh: No such file or directory > /opt/local/bin/port: line 4: exec: /usr/bin/tclsh: cannot execute: No such file or directory > > I removed the installation of Tcl 8.6 and reinstalled ActiveTcl 8.5.10, but still get the same warnings. > > Matplotlib is now complaining about the missing Tcl8.6: > > ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/_tkagg.so, 2): Library not loaded: /Library/Frameworks/Tcl.framework/Versions/8.6/Tcl. > > I am assuming that your unsuccessful install via macports was after you had macports working; do you know what version of Tcl was installed? > > Macports fails with the same warnings after putting a link to tclsh8.5 in /usr/bin/tchsh. > > I still seem to be running in circles. > > Lynn > > > > > On Sep 3, 2011, at 10:46 PM, Bryan K Woods wrote: > >> I had a problem getting with Lion as well. I was able to work around it by: >> 1) unsuccessfully trying to install matplotlib for python 2.7 via macports >> 2) then using easy_install to install matplotlib >> >> Bryan K. Woods, Ph.D. >> Staff Scientist >> Atmospheric & Environmental Research, Inc. >> bw...@ae... >> >> On Sep 4, 2011, at 1:06 AM, Lynn Oliver <ray...@gm...> wrote: >> >>> After many unsuccessful attempts at getting matplotlib installed on OS X Lion, I ran across this page: >>> Installing Matplotlib on OS X 10.7 with Homebrew « Random Musings for the Digital Age >>> >>> Following these instructions got me the closest I have been: >>> >>> $ brew install python >>> $ brew install gfortran >>> $ brew install pkg-config >>> $ easy_install pip >>> $ pip install numpy >>> $ cd $HOME >>> $ git clone https://github.com/matplotlib/matplotlib.git >>> $ cd matplotlib >>> $ python setup.py build >>> $ python setup.py install >>> >>> At the moment, I'm trying to get a script that was working on EPD 7.1 to work on Python 2.7.2. I'm using the TkAgg backend. >>> >>> The first messages I see when running the script are: >>> >>> objc[68962]: Class TKApplication is implemented in both /Library/Frameworks/Tk.framework/Versions/8.5/Tk and /Library/Frameworks/Tk.framework/Versions/8.6/Tk. One of the two will be used. Which one is undefined. >>> objc[68962]: Class TKMenu is implemented in both /Library/Frameworks/Tk.framework/Versions/8.5/Tk and /Library/Frameworks/Tk.framework/Versions/8.6/Tk. One of the two will be used. Which one is undefined. >>> objc[68962]: Class TKContentView is implemented in both /Library/Frameworks/Tk.framework/Versions/8.5/Tk and /Library/Frameworks/Tk.framework/Versions/8.6/Tk. One of the two will be used. Which one is undefined. >>> objc[68962]: Class TKWindow is implemented in both /Library/Frameworks/Tk.framework/Versions/8.5/Tk and /Library/Frameworks/Tk.framework/Versions/8.6/Tk. One of the two will be used. Which one is undefined. >>> >>> For both Tk and Tcl, ../Versions/Current points to 8.6. >>> >>> From there, everything is fine until it executes show(), when I get the following messages: >>> >>> Exception in Tkinter callback >>> Traceback (most recent call last): >>> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 1410, in __call__ >>> return self.func(*args) >>> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 236, in resize >>> self.show() >>> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 240, in draw >>> tkagg.blit(self._tkphoto, self.renderer._renderer, colormode=2) >>> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/tkagg.py", line 19, in blit >>> tk.call("PyAggImagePhoto", photoimage, id(aggimage), colormode, id(bbox_array)) >>> TclError >>> >>> Can anyone suggest how to resolve this problem? >>> >>> Thanks, >>> Lynn >>> ------------------------------------------------------------------------------ >>> Special Offer -- Download ArcSight Logger for FREE! >>> Finally, a world-class log management solution at an even better >>> price-free! And you'll get a free "Love Thy Logs" t-shirt when you >>> download Logger. Secure your free ArcSight Logger TODAY! >>> http://p.sf.net/sfu/arcsisghtdev2dev >>> _______________________________________________ >>> Matplotlib-users mailing list >>> Mat...@li... >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > -----Inline Attachment Follows----- > > ------------------------------------------------------------------------------ > Special Offer -- Download ArcSight Logger for FREE! > Finally, a world-class log management solution at an even better > price-free! And you'll get a free "Love Thy Logs" t-shirt when you > download Logger. Secure your free ArcSight Logger TODAY! > http://p.sf.net/sfu/arcsisghtdev2dev > > -----Inline Attachment Follows----- > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
From: Ryan N. <rne...@gm...> - 2011-09-05 04:27:00
|
Hello all, I noticed some unusual behavior with specific combinations of axes.twinx and pyplot.xticks. It seems that under certain conditions, the pyplot.xticks command can cause an x offset of the plots. Here's a relatively short example (as written, this works fine): import numpy as np import matplotlib.pyplot as plt x = np.linspace(-np.pi, np.pi, 1000) fig = plt.figure() ax1 = plt.axes() ax1.plot(x, np.sin(x)+1) plt.ylim(-1,2) ax2 = ax1.twinx() ax2.plot(x, np.sin(x) ) plt.ylim(-1,2) plt.xlim(-np.pi, np.pi) ts = np.linspace(-1, 3, 5) #ts = np.linspace(-1, 4, 5) plt.xticks( ts, ['%.2f'%i for i in ts] ) plt.show() However, if the comment on the 'ts' array creation code is reversed, the second plot appears offset from the original. I realize it is idiotic to put ticks outside the axis range, but this caused some problems when I inadvertently did it once (or more...). I've tried this with Matplotlib 1.0.1/Python 2.6.6 (Python x,y) on Windows 7 and Matplotlib 1.0.1/Python 2.7.1 on Gentoo Linux. Thanks Ryan |
|
From: Ryan N. <rne...@gm...> - 2011-09-05 03:49:37
|
Rob,
Have you tried the zorder argument. It is an integer that controls the
relative 'height' of a plotting element: higher numbers are plotted over
lower numbers. For example, the following code plots the scatter points on
top of the plotted line (even though scatter was called first):
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(-1, 1, 10)
y = np.random.rand(10)
plt.scatter(x, y, s=50, zorder=2)
plt.plot(x, y, 'r', lw=2, zorder=1)
plt.show()
Also, looking over your code, I noticed you had a for loop for your plot
commands. The plot command can take two dimensional arrays for x and y as
well. In this case, the x and y data for each individual plot are the
columns of the 2D arrays. For your problem in particular, you may find
Numpy's 'tile' command to be useful as well. Here's some code that does
something similar to what you are doing (I think).
import numpy as np
import matplotlib.pyplot as plt
z = np.tile( range(5), (5,1) )
plt.plot(z, np.random.rand(5, 5), 'o')
plt.show()
This may not make a big difference in your code, but if you have a lot of
data, it may speed things up a little. (As I understand it, the Python for
loops can be a little slow.)
Hope this helps a little.
Ryan
Date: Fri, 02 Sep 2011 14:18:39 -0230
> From: Rob Briggs <rdb...@mu...>
> Subject: [Matplotlib-users] order of plotting for 'layer' of data
> To: mat...@li...
> Message-ID: <131...@lo...>
> Content-Type: text/plain; charset="us-ascii"
>
> Hello,
>
> I'm not sure of the correct way to ask this question.....I'm trying to
> create a plot that has a number of layers. I plot a standard plot, then
> a scatterplot over that. See attachment. I expected the scatter plot to
> 'render/draw' after the standard plot command, but the scatter plot data
> is buried under the standard command.
>
> I tried changing the order, i.e. scatterplot first but that had no
> effect. How do I ensure the scatterplot data is plotted above/over the
> other data?
>
> The following code extract is after all the data has been read and
> sorted.
>
> # start plotting
> plt.close()
>
> # first EAIS data
> stitle = 'plot showing cumulative paleoHmodel and paleoHscore for EAIS'
> # set up index range for plotting
> il=0 # index for lower bound to plot
> iu=idx_splt # index for upper bound to plot
>
> fig = plt.figure(5,figsize=(18,12))
> ax1 = fig.add_subplot(111)
> plt.title(stitle, fontsize=16)
> plt.xlabel("paleoH data point")
> plt.ylabel("thickness [m]")
>
> ii=np.empty(num_rows)
> # plot the model results
> for i in range(il,iu):
> ii[:] = i+1
> plt.plot(ii,a[:,i],'o',color='0.9')
>
> # set axis limits
> ymin=-1800
> ymin=-500
> ax1.set_xlim(il,iu+1)
> top = 3000
> bottom=-500
> ax1.set_ylim(bottom, top)
>
> # plot the labels
> for i in range(il,iu):
> plt.text(i+1,ymin,datn[i], horizontalalignment='center',
> fontsize=10,rotation='vertical', verticalalignment='bottom')
>
>
> #cmap = cm.get_cmap('PRGn', 10)
> #cmap = cm.get_cmap('autumn_r', 100)
> #cmap = cm.get_cmap('gray', 100)
>
> #plt.scatter(obs[il:iu,0],obs[il:iu,1],c=time[il:iu],marker='s',s=50,cmap=cmap)
> plt.scatter(obs[il:iu,0], obs[il:iu,1], c=time[il:iu],marker='s',s=100)
> plt.colorbar()
>
> # plot the observation dp with error bars
> #plt.errorbar(obs[il:iu,0], obs[il:iu,1], yerr=obs[il:iu,2], fmt='r.')
>
> plt.grid(which='both')
> fname="scoreVSpaleoHsite.png"
> plt.savefig(fname)
> plt.show()
>
>
> Regards
>
> Rob
>
>
> This electronic communication is governed by the terms and conditions at
> http://www.mun.ca/cc/policies/electronic_communications_disclaimer_2011.php
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: scoreVSpaleoHsite.png
> Type: image/png
> Size: 223292 bytes
> Desc: not available
>
>
|
|
From: Eric F. <ef...@ha...> - 2011-09-04 22:40:54
|
On 09/04/2011 12:08 PM, Adam Davis wrote: > Eric, > > Thank you for the reply. > > Yes, eliminating sharex and sharey does solve that problem. But then my > plot axes (which are scatter plots of each orthogonal view of a vector > space) are not correspondingly scaled. > > Is there a way to: > > - force scaling across specified axes without using sharex/y (and > without disrupting imshow)? You can manually get and set the axes limits with ax.get_ylim, ax.set_ylim, etc. > > - have subplots within subplots so that I can have the plot() calls in > one set of axes within a subplot (using sharex/y) and the imshow() calls > in another subplot? You just need to create the subplots one-by-one instead of using the subplots convenience function: fig = plt.figure() ax1 = fig.add_subplot(2,2,1) ax2 = fig.add_subplot(2,2,2, sharex=ax1, sharey=ax1) ax3 = fig.add_subplot(2,2,3, sharex=ax1, sharey=ax1) ax4 = fig.add_subplot(2,2,4) Now the first three axes are locked together, and the 4th is independent. Eric > > -Adam > > On Sun, Sep 4, 2011 at 10:34 PM, Eric Firing <ef...@ha... > <mailto:ef...@ha...>> wrote: > > On 09/04/2011 11:12 AM, Adam Davis wrote: > > I have a figure with a number of plots that analyze a source image. I > > wish to show the plots along side the image. Unfortunately whichever > > method I call last clobbers (leaves blank axes) for the previously > > called method. > > > > To illustrate: > > > > fig, axs = pylab.subplots(10, 4, sharex=True, sharey=True) > > > > for i in range(10): > > > > axs[i,0].plot(some_data) > > axs[i,1].plot(some_data) > > axs[i,2].plot(some_data) > > > > axs[i,3].imshow(some_image) > > > > #===== > > > > The above shows only the images in the fourth column. If, however, I > > call imshow() first, followed by the call to plot(), then only > the plot > > axes appear and the images disappear. > > > > Is there a way to both plot and display images in the same figure? > > I suspect the problem here is your sharex and sharey kwargs. Try > leaving them out. > > Eric > > > > > -Adam > > ------------------------------------------------------------------------------ > Special Offer -- Download ArcSight Logger for FREE! > Finally, a world-class log management solution at an even better > price-free! And you'll get a free "Love Thy Logs" t-shirt when you > download Logger. Secure your free ArcSight Logger TODAY! > http://p.sf.net/sfu/arcsisghtdev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > <mailto:Mat...@li...> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |
|
From: Adam D. <ada...@gm...> - 2011-09-04 22:08:32
|
Eric, Thank you for the reply. Yes, eliminating sharex and sharey does solve that problem. But then my plot axes (which are scatter plots of each orthogonal view of a vector space) are not correspondingly scaled. Is there a way to: - force scaling across specified axes without using sharex/y (and without disrupting imshow)? - have subplots within subplots so that I can have the plot() calls in one set of axes within a subplot (using sharex/y) and the imshow() calls in another subplot? -Adam On Sun, Sep 4, 2011 at 10:34 PM, Eric Firing <ef...@ha...> wrote: > On 09/04/2011 11:12 AM, Adam Davis wrote: > > I have a figure with a number of plots that analyze a source image. I > > wish to show the plots along side the image. Unfortunately whichever > > method I call last clobbers (leaves blank axes) for the previously > > called method. > > > > To illustrate: > > > > fig, axs = pylab.subplots(10, 4, sharex=True, sharey=True) > > > > for i in range(10): > > > > axs[i,0].plot(some_data) > > axs[i,1].plot(some_data) > > axs[i,2].plot(some_data) > > > > axs[i,3].imshow(some_image) > > > > #===== > > > > The above shows only the images in the fourth column. If, however, I > > call imshow() first, followed by the call to plot(), then only the plot > > axes appear and the images disappear. > > > > Is there a way to both plot and display images in the same figure? > > I suspect the problem here is your sharex and sharey kwargs. Try > leaving them out. > > Eric > > > > > -Adam > > > ------------------------------------------------------------------------------ > Special Offer -- Download ArcSight Logger for FREE! > Finally, a world-class log management solution at an even better > price-free! And you'll get a free "Love Thy Logs" t-shirt when you > download Logger. Secure your free ArcSight Logger TODAY! > http://p.sf.net/sfu/arcsisghtdev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: Eric F. <ef...@ha...> - 2011-09-04 21:34:51
|
On 09/04/2011 11:12 AM, Adam Davis wrote: > I have a figure with a number of plots that analyze a source image. I > wish to show the plots along side the image. Unfortunately whichever > method I call last clobbers (leaves blank axes) for the previously > called method. > > To illustrate: > > fig, axs = pylab.subplots(10, 4, sharex=True, sharey=True) > > for i in range(10): > > axs[i,0].plot(some_data) > axs[i,1].plot(some_data) > axs[i,2].plot(some_data) > > axs[i,3].imshow(some_image) > > #===== > > The above shows only the images in the fourth column. If, however, I > call imshow() first, followed by the call to plot(), then only the plot > axes appear and the images disappear. > > Is there a way to both plot and display images in the same figure? I suspect the problem here is your sharex and sharey kwargs. Try leaving them out. Eric > > -Adam |
|
From: Adam D. <ada...@gm...> - 2011-09-04 21:12:55
|
I have a figure with a number of plots that analyze a source image. I wish to show the plots along side the image. Unfortunately whichever method I call last clobbers (leaves blank axes) for the previously called method. To illustrate: fig, axs = pylab.subplots(10, 4, sharex=True, sharey=True) for i in range(10): axs[i,0].plot(some_data) axs[i,1].plot(some_data) axs[i,2].plot(some_data) axs[i,3].imshow(some_image) #===== The above shows only the images in the fourth column. If, however, I call imshow() first, followed by the call to plot(), then only the plot axes appear and the images disappear. Is there a way to both plot and display images in the same figure? -Adam |
|
From: Neal B. <ndb...@gm...> - 2011-09-04 14:40:41
|
surfcast23 wrote: > > I am fairly new to programing and have a question regarding matplotlib. I > wrote a python script that reads in data from the outfile of another program > then prints out the data from one column. > > f = open( 'myfile.txt','r') > for line in f: > if line != ' ': > line = line.strip() # Strips end of line character > columns = line.split() # Splits into coloumn > mass = columns[8] # Column which contains mass values > print(mass) > > What I now need to do is have matplotlib take the values printed in 'mass' > and plot number versus mean mass. I have read the documents on the > matplotlib website, but they don't really address how to get data from a > script(or I just did not see it) If anyone can point me to some > documentation that explains how I do this it would be really appreciated. > Thanks in advance > What I always do, is in my script I pickle the parameters used to run the script, and the results. Usually I save a pair of dicts, one of the parameters, and one of the results. Then to plot, just unpickle them and have at it. |
|
From: Michiel de H. <mjl...@ya...> - 2011-09-04 07:55:13
|
What happens if you use the MacOSX backend instead of TkAgg? Or do you have to use TkAgg? --Michiel. --- On Sun, 9/4/11, Lynn Oliver <ray...@gm...> wrote: From: Lynn Oliver <ray...@gm...> Subject: Re: [Matplotlib-users] problems installing matplotlib on OS X Lion To: "Bryan K Woods" <bw...@ae...> Cc: "mat...@li..." <mat...@li...> Date: Sunday, September 4, 2011, 3:38 AM Bryan, thanks for the response. I installed macports and the environment settings seem to be correct, but when I try "port help selfupdate" I get:/opt/local/bin/port: line 4: /usr/bin/tclsh: No such file or directory/opt/local/bin/port: line 4: exec: /usr/bin/tclsh: cannot execute: No such file or directory I removed the installation of Tcl 8.6 and reinstalled ActiveTcl 8.5.10, but still get the same warnings. Matplotlib is now complaining about the missing Tcl8.6: ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/_tkagg.so, 2): Library not loaded: /Library/Frameworks/Tcl.framework/Versions/8.6/Tcl. I am assuming that your unsuccessful install via macports was after you had macports working; do you know what version of Tcl was installed? Macports fails with the same warnings after putting a link to tclsh8.5 in /usr/bin/tchsh. I still seem to be running in circles. Lynn On Sep 3, 2011, at 10:46 PM, Bryan K Woods wrote: I had a problem getting with Lion as well. I was able to work around it by:1) unsuccessfully trying to install matplotlib for python 2.7 via macports2) then using easy_install to install matplotlib Bryan K. Woods, Ph.D.Staff ScientistAtmospheric & Environmental Research, Inc...@ae... On Sep 4, 2011, at 1:06 AM, Lynn Oliver <ray...@gm...> wrote: After many unsuccessful attempts at getting matplotlib installed on OS X Lion, I ran across this page:Installing Matplotlib on OS X 10.7 with Homebrew « Random Musings for the Digital Age Following these instructions got me the closest I have been: $ brew install python$ brew install gfortran$ brew install pkg-config$ easy_install pip$ pip install numpy$ cd $HOME$ git clone https://github.com/matplotlib/matplotlib.git$ cd matplotlib$ python setup.py build$ python setup.py install At the moment, I'm trying to get a script that was working on EPD 7.1 to work on Python 2.7.2. I'm using the TkAgg backend. The first messages I see when running the script are: objc[68962]: Class TKApplication is implemented in both /Library/Frameworks/Tk.framework/Versions/8.5/Tk and /Library/Frameworks/Tk.framework/Versions/8.6/Tk. One of the two will be used. Which one is undefined.objc[68962]: Class TKMenu is implemented in both /Library/Frameworks/Tk.framework/Versions/8.5/Tk and /Library/Frameworks/Tk.framework/Versions/8.6/Tk. One of the two will be used. Which one is undefined.objc[68962]: Class TKContentView is implemented in both /Library/Frameworks/Tk.framework/Versions/8.5/Tk and /Library/Frameworks/Tk.framework/Versions/8.6/Tk. One of the two will be used. Which one is undefined.objc[68962]: Class TKWindow is implemented in both /Library/Frameworks/Tk.framework/Versions/8.5/Tk and /Library/Frameworks/Tk.framework/Versions/8.6/Tk. One of the two will be used. Which one is undefined. For both Tk and Tcl, ../Versions/Current points to 8.6. >From there, everything is fine until it executes show(), when I get the following messages: Exception in Tkinter callbackTraceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 1410, in __call__ return self.func(*args) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 236, in resize self.show() File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 240, in draw tkagg.blit(self._tkphoto, self.renderer._renderer, colormode=2) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/tkagg.py", line 19, in blit tk.call("PyAggImagePhoto", photoimage, id(aggimage), colormode, id(bbox_array))TclError Can anyone suggest how to resolve this problem? Thanks,Lynn------------------------------------------------------------------------------ Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free "Love Thy Logs" t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev_______________________________________________ Matplotlib-users mailing list Mat...@li... https://lists.sourceforge.net/lists/listinfo/matplotlib-users -----Inline Attachment Follows----- ------------------------------------------------------------------------------ Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free "Love Thy Logs" t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev -----Inline Attachment Follows----- _______________________________________________ Matplotlib-users mailing list Mat...@li... https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
From: Michiel de H. <mjl...@ya...> - 2011-09-04 07:55:09
|
What happens if you use the MacOSX backend instead of TkAgg? Or do you have to use TkAgg? --Michiel. --- On Sun, 9/4/11, Lynn Oliver <ray...@gm...> wrote: From: Lynn Oliver <ray...@gm...> Subject: Re: [Matplotlib-users] problems installing matplotlib on OS X Lion To: "Bryan K Woods" <bw...@ae...> Cc: "mat...@li..." <mat...@li...> Date: Sunday, September 4, 2011, 3:38 AM Bryan, thanks for the response. I installed macports and the environment settings seem to be correct, but when I try "port help selfupdate" I get:/opt/local/bin/port: line 4: /usr/bin/tclsh: No such file or directory/opt/local/bin/port: line 4: exec: /usr/bin/tclsh: cannot execute: No such file or directory I removed the installation of Tcl 8.6 and reinstalled ActiveTcl 8.5.10, but still get the same warnings. Matplotlib is now complaining about the missing Tcl8.6: ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/_tkagg.so, 2): Library not loaded: /Library/Frameworks/Tcl.framework/Versions/8.6/Tcl. I am assuming that your unsuccessful install via macports was after you had macports working; do you know what version of Tcl was installed? Macports fails with the same warnings after putting a link to tclsh8.5 in /usr/bin/tchsh. I still seem to be running in circles. Lynn On Sep 3, 2011, at 10:46 PM, Bryan K Woods wrote: I had a problem getting with Lion as well. I was able to work around it by:1) unsuccessfully trying to install matplotlib for python 2.7 via macports2) then using easy_install to install matplotlib Bryan K. Woods, Ph.D.Staff ScientistAtmospheric & Environmental Research, Inc...@ae... On Sep 4, 2011, at 1:06 AM, Lynn Oliver <ray...@gm...> wrote: After many unsuccessful attempts at getting matplotlib installed on OS X Lion, I ran across this page:Installing Matplotlib on OS X 10.7 with Homebrew « Random Musings for the Digital Age Following these instructions got me the closest I have been: $ brew install python$ brew install gfortran$ brew install pkg-config$ easy_install pip$ pip install numpy$ cd $HOME$ git clone https://github.com/matplotlib/matplotlib.git$ cd matplotlib$ python setup.py build$ python setup.py install At the moment, I'm trying to get a script that was working on EPD 7.1 to work on Python 2.7.2. I'm using the TkAgg backend. The first messages I see when running the script are: objc[68962]: Class TKApplication is implemented in both /Library/Frameworks/Tk.framework/Versions/8.5/Tk and /Library/Frameworks/Tk.framework/Versions/8.6/Tk. One of the two will be used. Which one is undefined.objc[68962]: Class TKMenu is implemented in both /Library/Frameworks/Tk.framework/Versions/8.5/Tk and /Library/Frameworks/Tk.framework/Versions/8.6/Tk. One of the two will be used. Which one is undefined.objc[68962]: Class TKContentView is implemented in both /Library/Frameworks/Tk.framework/Versions/8.5/Tk and /Library/Frameworks/Tk.framework/Versions/8.6/Tk. One of the two will be used. Which one is undefined.objc[68962]: Class TKWindow is implemented in both /Library/Frameworks/Tk.framework/Versions/8.5/Tk and /Library/Frameworks/Tk.framework/Versions/8.6/Tk. One of the two will be used. Which one is undefined. For both Tk and Tcl, ../Versions/Current points to 8.6. >From there, everything is fine until it executes show(), when I get the following messages: Exception in Tkinter callbackTraceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 1410, in __call__ return self.func(*args) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 236, in resize self.show() File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 240, in draw tkagg.blit(self._tkphoto, self.renderer._renderer, colormode=2) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/tkagg.py", line 19, in blit tk.call("PyAggImagePhoto", photoimage, id(aggimage), colormode, id(bbox_array))TclError Can anyone suggest how to resolve this problem? Thanks,Lynn------------------------------------------------------------------------------ Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free "Love Thy Logs" t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev_______________________________________________ Matplotlib-users mailing list Mat...@li... https://lists.sourceforge.net/lists/listinfo/matplotlib-users -----Inline Attachment Follows----- ------------------------------------------------------------------------------ Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free "Love Thy Logs" t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev -----Inline Attachment Follows----- _______________________________________________ Matplotlib-users mailing list Mat...@li... https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
From: Lynn O. <ray...@gm...> - 2011-09-04 07:38:26
|
Bryan, thanks for the response. I installed macports and the environment settings seem to be correct, but when I try "port help selfupdate" I get: /opt/local/bin/port: line 4: /usr/bin/tclsh: No such file or directory /opt/local/bin/port: line 4: exec: /usr/bin/tclsh: cannot execute: No such file or directory I removed the installation of Tcl 8.6 and reinstalled ActiveTcl 8.5.10, but still get the same warnings. Matplotlib is now complaining about the missing Tcl8.6: ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/_tkagg.so, 2): Library not loaded: /Library/Frameworks/Tcl.framework/Versions/8.6/Tcl. I am assuming that your unsuccessful install via macports was after you had macports working; do you know what version of Tcl was installed? Macports fails with the same warnings after putting a link to tclsh8.5 in /usr/bin/tchsh. I still seem to be running in circles. Lynn On Sep 3, 2011, at 10:46 PM, Bryan K Woods wrote: > I had a problem getting with Lion as well. I was able to work around it by: > 1) unsuccessfully trying to install matplotlib for python 2.7 via macports > 2) then using easy_install to install matplotlib > > Bryan K. Woods, Ph.D. > Staff Scientist > Atmospheric & Environmental Research, Inc. > bw...@ae... > > On Sep 4, 2011, at 1:06 AM, Lynn Oliver <ray...@gm...> wrote: > >> After many unsuccessful attempts at getting matplotlib installed on OS X Lion, I ran across this page: >> Installing Matplotlib on OS X 10.7 with Homebrew « Random Musings for the Digital Age >> >> Following these instructions got me the closest I have been: >> >> $ brew install python >> $ brew install gfortran >> $ brew install pkg-config >> $ easy_install pip >> $ pip install numpy >> $ cd $HOME >> $ git clone https://github.com/matplotlib/matplotlib.git >> $ cd matplotlib >> $ python setup.py build >> $ python setup.py install >> >> At the moment, I'm trying to get a script that was working on EPD 7.1 to work on Python 2.7.2. I'm using the TkAgg backend. >> >> The first messages I see when running the script are: >> >> objc[68962]: Class TKApplication is implemented in both /Library/Frameworks/Tk.framework/Versions/8.5/Tk and /Library/Frameworks/Tk.framework/Versions/8.6/Tk. One of the two will be used. Which one is undefined. >> objc[68962]: Class TKMenu is implemented in both /Library/Frameworks/Tk.framework/Versions/8.5/Tk and /Library/Frameworks/Tk.framework/Versions/8.6/Tk. One of the two will be used. Which one is undefined. >> objc[68962]: Class TKContentView is implemented in both /Library/Frameworks/Tk.framework/Versions/8.5/Tk and /Library/Frameworks/Tk.framework/Versions/8.6/Tk. One of the two will be used. Which one is undefined. >> objc[68962]: Class TKWindow is implemented in both /Library/Frameworks/Tk.framework/Versions/8.5/Tk and /Library/Frameworks/Tk.framework/Versions/8.6/Tk. One of the two will be used. Which one is undefined. >> >> For both Tk and Tcl, ../Versions/Current points to 8.6. >> >> From there, everything is fine until it executes show(), when I get the following messages: >> >> Exception in Tkinter callback >> Traceback (most recent call last): >> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 1410, in __call__ >> return self.func(*args) >> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 236, in resize >> self.show() >> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 240, in draw >> tkagg.blit(self._tkphoto, self.renderer._renderer, colormode=2) >> File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/tkagg.py", line 19, in blit >> tk.call("PyAggImagePhoto", photoimage, id(aggimage), colormode, id(bbox_array)) >> TclError >> >> Can anyone suggest how to resolve this problem? >> >> Thanks, >> Lynn >> ------------------------------------------------------------------------------ >> Special Offer -- Download ArcSight Logger for FREE! >> Finally, a world-class log management solution at an even better >> price-free! And you'll get a free "Love Thy Logs" t-shirt when you >> download Logger. Secure your free ArcSight Logger TODAY! >> http://p.sf.net/sfu/arcsisghtdev2dev >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
From: Lynn O. <ray...@gm...> - 2011-09-04 05:06:16
|
After many unsuccessful attempts at getting matplotlib installed on OS X Lion, I ran across this page: Installing Matplotlib on OS X 10.7 with Homebrew « Random Musings for the Digital Age Following these instructions got me the closest I have been: $ brew install python $ brew install gfortran $ brew install pkg-config $ easy_install pip $ pip install numpy $ cd $HOME $ git clone https://github.com/matplotlib/matplotlib.git $ cd matplotlib $ python setup.py build $ python setup.py install At the moment, I'm trying to get a script that was working on EPD 7.1 to work on Python 2.7.2. I'm using the TkAgg backend. The first messages I see when running the script are: objc[68962]: Class TKApplication is implemented in both /Library/Frameworks/Tk.framework/Versions/8.5/Tk and /Library/Frameworks/Tk.framework/Versions/8.6/Tk. One of the two will be used. Which one is undefined. objc[68962]: Class TKMenu is implemented in both /Library/Frameworks/Tk.framework/Versions/8.5/Tk and /Library/Frameworks/Tk.framework/Versions/8.6/Tk. One of the two will be used. Which one is undefined. objc[68962]: Class TKContentView is implemented in both /Library/Frameworks/Tk.framework/Versions/8.5/Tk and /Library/Frameworks/Tk.framework/Versions/8.6/Tk. One of the two will be used. Which one is undefined. objc[68962]: Class TKWindow is implemented in both /Library/Frameworks/Tk.framework/Versions/8.5/Tk and /Library/Frameworks/Tk.framework/Versions/8.6/Tk. One of the two will be used. Which one is undefined. For both Tk and Tcl, ../Versions/Current points to 8.6. From there, everything is fine until it executes show(), when I get the following messages: Exception in Tkinter callback Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 1410, in __call__ return self.func(*args) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 236, in resize self.show() File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 240, in draw tkagg.blit(self._tkphoto, self.renderer._renderer, colormode=2) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/tkagg.py", line 19, in blit tk.call("PyAggImagePhoto", photoimage, id(aggimage), colormode, id(bbox_array)) TclError Can anyone suggest how to resolve this problem? Thanks, Lynn |
|
From: C M <cmp...@gm...> - 2011-09-04 03:58:56
|
On Sat, Sep 3, 2011 at 7:32 PM, mdekauwe <mde...@gm...> wrote:
>
> So you do want a histogram then? I assume you have all of this sorted then,
> the histogram function is very good.
I don't think he's describing a histogram, because he is not plotting
frequency of observations on the y axis, but data values (means of
each bin). I think what surfcast23 wants is just a bar graph.
So, surfcast23, I'd suggest you break it down into your two steps.
First, how will you average your values by bin? You can probably
figure that out by writing it out on paper in pseudo-code and then
just putting it in Python. Then you'll have a list of means, and you
will pass that to the bar function in matplotlib, something like:
from pylab import *
ax = subplot(111)
x = arange(4)
your_list_of_means = [4,5,7,11] #computed earlier
bar(x, your_list_of_means)
xticks( x + 0.5, ('Bin1', 'Bin2', 'Bin3', 'Bin4') )
show()
Che
|
|
From: mdekauwe <mde...@gm...> - 2011-09-03 23:32:40
|
So you do want a histogram then? I assume you have all of this sorted then, the histogram function is very good. Cheers, Martin -- View this message in context: http://old.nabble.com/How-do-you-Plot-data-generated-by-a-python-script--tp32328822p32394062.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: surfcast23 <sur...@gm...> - 2011-09-03 18:11:04
|
Hi Martin, Sorry I am just responding. I have been busy getting ready for the semester. What I need to do is first sort the values contained in the column and assign them to bins. I then have to plot the number of bins by the mean value in each bin. mdekauwe wrote: > > Can you describe what you want to do? So you now want a histogram? > > > surfcast23 wrote: >> >> Sorry everyone I totally missed something very important. What I need to >> do is first bin the masses(which I don't know how to do). >> >> Chelonian wrote: >>> >>> On Thu, Aug 25, 2011 at 10:01 PM, surfcast23 <sur...@gm...> >>> wrote: >>>> >>>> Hi, >>>> >>>> there is only one column. so I want a plot of y and x. With y taking >>>> values running from 0 to n or 7 in my example and x as the average of >>>> the >>>> values that are contained in the rows in my example it was 5.57. >>> >>> It seems to me that, as described, you want a plot that in which all >>> the bars are the same height (or width if it is a sideways bar chart), >>> in this case, 5.57. That makes no sense. >>> >>> What information is this plot is intended to provide the viewer? >>> >>> ------------------------------------------------------------------------------ >>> EMC VNX: the world's simplest storage, starting under $10K >>> The only unified storage solution that offers unified management >>> Up to 160% more powerful than alternatives and 25% more efficient. >>> Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev >>> _______________________________________________ >>> Matplotlib-users mailing list >>> Mat...@li... >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>> >>> >> >> > > -- View this message in context: http://old.nabble.com/How-do-you-Plot-data-generated-by-a-python-script--tp32328822p32393079.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: Rob B. <rdb...@mu...> - 2011-09-02 16:48:48
|
Hello,
I'm not sure of the correct way to ask this question.....I'm trying to
create a plot that has a number of layers. I plot a standard plot, then
a scatterplot over that. See attachment. I expected the scatter plot to
'render/draw' after the standard plot command, but the scatter plot data
is buried under the standard command.
I tried changing the order, i.e. scatterplot first but that had no
effect. How do I ensure the scatterplot data is plotted above/over the
other data?
The following code extract is after all the data has been read and
sorted.
# start plotting
plt.close()
# first EAIS data
stitle = 'plot showing cumulative paleoHmodel and paleoHscore for EAIS'
# set up index range for plotting
il=0 # index for lower bound to plot
iu=idx_splt # index for upper bound to plot
fig = plt.figure(5,figsize=(18,12))
ax1 = fig.add_subplot(111)
plt.title(stitle, fontsize=16)
plt.xlabel("paleoH data point")
plt.ylabel("thickness [m]")
ii=np.empty(num_rows)
# plot the model results
for i in range(il,iu):
ii[:] = i+1
plt.plot(ii,a[:,i],'o',color='0.9')
# set axis limits
ymin=-1800
ymin=-500
ax1.set_xlim(il,iu+1)
top = 3000
bottom=-500
ax1.set_ylim(bottom, top)
# plot the labels
for i in range(il,iu):
plt.text(i+1,ymin,datn[i], horizontalalignment='center',
fontsize=10,rotation='vertical', verticalalignment='bottom')
#cmap = cm.get_cmap('PRGn', 10)
#cmap = cm.get_cmap('autumn_r', 100)
#cmap = cm.get_cmap('gray', 100)
#plt.scatter(obs[il:iu,0],obs[il:iu,1],c=time[il:iu],marker='s',s=50,cmap=cmap)
plt.scatter(obs[il:iu,0], obs[il:iu,1], c=time[il:iu],marker='s',s=100)
plt.colorbar()
# plot the observation dp with error bars
#plt.errorbar(obs[il:iu,0], obs[il:iu,1], yerr=obs[il:iu,2], fmt='r.')
plt.grid(which='both')
fname="scoreVSpaleoHsite.png"
plt.savefig(fname)
plt.show()
Regards
Rob
This electronic communication is governed by the terms and conditions at
http://www.mun.ca/cc/policies/electronic_communications_disclaimer_2011.php
|
|
From: Benjamin R. <ben...@ou...> - 2011-09-02 14:42:22
|
On Wed, Aug 31, 2011 at 5:34 AM, galorencom <gal...@gm...> wrote: > > Hello > I have an animation which shows 3D diffusion > I added color bar at the side > during the animation the colors changing but the scale at the colorbar of > the graph stay asame. > please help with that soon as you can! > Thanks! > Gal:working: > This entirely depends on how you create your colorbar and how you update your graphs. Generally, colorbars that are created use (implicitly or explicitly) a ScalarMappable such as a ContourSet (from contour()) or AxesImage (from imshow()). If you then create new objects instead of modifying the existing objects, then the colorbar will still be referencing the original scalarmappable. If you are still confuse, post a stand-alone example of what you have and we can help you out. Ben Root |
|
From: R. O'G. <ron...@ya...> - 2011-09-02 14:28:10
|
Jae-Joon, thanks for your reply.
There is a combination of effects that make my contour labels placed in unfortunate positions. Here is a self-contained example (somewhat different from issue I originally explained, but illustrates the fact clabels are not where I'd like them to be)
import numpy as np
import matplotlib as mpl
ff = 10
params = {
'text.usetex': True,
'axes.labelsize': ff,
'axes.fontsize': ff,
'legend.fontsize' : ff,
'xtick.labelsize' : ff,
'ytick.labelsize' : ff,
'figure.dpi': 150,
'figure.figsize' : [5,2],
}
mpl.rcParams.update(params)
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
gs = gridspec.GridSpec(1,2)
ax = plt.subplot(gs[0])
xi = np.linspace(0,0.4,100)
yi = np.linspace(0,0.4,100)
xx,yy = np.meshgrid(xi,yi)
zi = np.sin(5*xx*yy)
v = np.arange(0.0, 0.5, 0.1)
cplot = ax.contour(xi, yi, zi, v, linewidths=0.5, colors='k')
ax.clabel(cplot, v,
fontsize = 8,
inline=True,
fmt = "%0.2f",
)
ax.axis([np.min(xi),np.max(xi),np.min(yi),np.max(yi)])
plt.show()
The end result is that contour labels are placed almost outside of the grid, with most of the area in the center being blank. I am pretty sure it has to do with the way rcParams are set, but I have no idea why. Params I do need to set are text.usetex, figure.dpi, and figure.figsize. I am using matplotlib 1.0.1.
Thanks for your help,
----- Original Message -----
From: Jae-Joon Lee <lee...@gm...>
To: R. O'Gara <ron...@ya...>
Cc: "mat...@li..." <mat...@li...>
Sent: Monday, August 22, 2011 11:56 PM
Subject: Re: [Matplotlib-users] contour's clabels overlap each other in an ImageGrid
Can you post an simple self-contained script that reproduces your problem?
I just tried something similar but could not reproduces your problem.
Here is what I did,
Also, what version of matplotlb are you using?
Regards,
-JJ
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.axes_grid1 import ImageGrid
fig = plt.figure(1)
arr = np.arange(100).reshape((10, 10))
grid = ImageGrid(fig, 111, (2, 2))
cntr0 = grid[0].contour(arr)
cntr1 = grid[1].contour(arr)
cntr2 = grid[2].contour(arr)
cntr3 = grid[3].contour(arr)
plt.clabel(cntr0, manual=True)
plt.clabel(cntr1, manual=True)
plt.clabel(cntr2, manual=True)
plt.clabel(cntr3, manual=True)
On Thu, Aug 18, 2011 at 1:10 PM, R. O'Gara <ron...@ya...> wrote:
> Hey guys,
>
>
> I was hoping someone could provide a hint for how I should go about correcting this. As you can see, locations for the inline labels for
> contours in this image are unfortunately chosen, and they overlap with one another. If I set manual to 'True' then I get this weird behavior
> where I can only choose labels in the top left grid and nothing is shownin any of the other grids.
>
> I am using a 2x2 Image Grid (I get the same problem when using gridspec instead of image grid), and loadingcontour data (2x2 array) from a file.
>
> Thanks for your help,
> Ron
> ------------------------------------------------------------------------------
> Get a FREE DOWNLOAD! and learn more about uberSVN rich system,
> user administration capabilities and model configuration. Take
> the hassle out of deploying and managing Subversion and the
> tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
|
|
From: CompBio <rog...@CS...> - 2011-09-01 18:35:08
|
First, you folks respond faster than lightning -- I can't keep up!
Second, thanks for the tip -- that's definitely more elegant than my callow
approach.
John Hunter-4 wrote:
>
> On Thu, Sep 1, 2011 at 1:23 PM, CompBio <rog...@cs...> wrote:
>
>> BTW, the reason I specify a PDF backend is because I thought it would
>> tell
>> matplotlib not to try to use anything else "behind the scenes" such as an
>> X-window display. It's working the way I want now, so I assume that's
>> what
>> it's doing.
>
> But at others have pointed out, your code is unnecessarily complex. Just
> do
>
> import matplotlib
> matplotlib.use('agg')
> import pylab
>
> and when you call savefig, you can pass ps, eps, pdf, png or svg and
> the mpl code will choose the right backend, and never launch a GUI.
>
> JDH
>
> ------------------------------------------------------------------------------
> Special Offer -- Download ArcSight Logger for FREE!
> Finally, a world-class log management solution at an even better
> price-free! And you'll get a free "Love Thy Logs" t-shirt when you
> download Logger. Secure your free ArcSight Logger TODAY!
> http://p.sf.net/sfu/arcsisghtdev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
View this message in context: http://old.nabble.com/RuntimeError%3A-could-not-open-display-tp32380449p32381652.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
|
|
From: John H. <jd...@gm...> - 2011-09-01 18:27:53
|
On Thu, Sep 1, 2011 at 1:23 PM, CompBio <rog...@cs...> wrote:
> BTW, the reason I specify a PDF backend is because I thought it would tell
> matplotlib not to try to use anything else "behind the scenes" such as an
> X-window display. It's working the way I want now, so I assume that's what
> it's doing.
But at others have pointed out, your code is unnecessarily complex. Just do
import matplotlib
matplotlib.use('agg')
import pylab
and when you call savefig, you can pass ps, eps, pdf, png or svg and
the mpl code will choose the right backend, and never launch a GUI.
JDH
|
|
From: CompBio <rog...@CS...> - 2011-09-01 18:24:05
|
Thanks for your fast response -- faster than I could post a follow-up.
You're right about the stack trace. It occurred to me after I posted that I
should look to see exactly where the exception was triggered. As it turned
out, I'd added a new module a few days ago and wasn't careful about where I
added the import. Here at work it didn't make a difference, but launching
from home...
Once I reordered the new import the error disappeared.
BTW, the reason I specify a PDF backend is because I thought it would tell
matplotlib not to try to use anything else "behind the scenes" such as an
X-window display. It's working the way I want now, so I assume that's what
it's doing.
Benjamin Root-2 wrote:
>
> On Thursday, September 1, 2011, CompBio <rog...@cs...> wrote:
>>
>> I'm trying to get a script to work in batch mode to produce a large
>> number
> of
>> plots. I've got the following sequence of imports in a matplotlib Python
>> script:
>>
>> import matplotlib, os, sys
>> ...
>> if file_ext == 'png' :
>> sys.stderr.write('Using PNG output format\n')
>> matplotlib.use('agg')
>> elif file_ext == 'pdf' :
>> sys.stderr.write('Using PDF output format\n')
>> matplotlib.use('PDF')
>>
>> from pylab import *
>>
>> ... remainder of plotting code ...
>>
>> At first this appeared to work without any problems. I could kick off a
> job
>> in background, log off the machine and return later when all the graphs
> had
>> been produced.
>>
>> Now I get this RuntimeError exception. Is there anything else I need to
> do
>> to convince matplotlib that it doesn't need my local display?
>>
>> thanks!
>> --
>
> Without the stack trace, it would be hard to tell. Plus, there is already
> logic in the backends to switch to PDF and such for saving files. It
> should
> only be necessary to set the backend to AGG if you want a headless batch
> script.
>
> Ben Root
>
> ------------------------------------------------------------------------------
> Special Offer -- Download ArcSight Logger for FREE!
> Finally, a world-class log management solution at an even better
> price-free! And you'll get a free "Love Thy Logs" t-shirt when you
> download Logger. Secure your free ArcSight Logger TODAY!
> http://p.sf.net/sfu/arcsisghtdev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
View this message in context: http://old.nabble.com/RuntimeError%3A-could-not-open-display-tp32380449p32381582.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
|
|
From: Eric F. <ef...@ha...> - 2011-09-01 18:08:26
|
On 09/01/2011 05:37 AM, CompBio wrote:
>
> I'm trying to get a script to work in batch mode to produce a large number of
> plots. I've got the following sequence of imports in a matplotlib Python
> script:
Is the script being run standalone, from a shell, and are the following
the very first imports?
>
> import matplotlib, os, sys
> ...
> if file_ext == 'png' :
> sys.stderr.write('Using PNG output format\n')
> matplotlib.use('agg')
> elif file_ext == 'pdf' :
> sys.stderr.write('Using PDF output format\n')
> matplotlib.use('PDF')
As Ben notes, you don't need the above logic to choose between agg and
pdf; but you are correct in choosing a non-interactive backend before
any import of pylab or pyplot. That should be enough to prevent any
subsequent attempt to open a display.
I'll bet the problem is that when the code above is run, file_ext is
neither 'png' nor 'pdf', so matplotlib.use is not being executed.
>
> from pylab import *
>
And at this point pylab is simply setting the default (interactive) backend.
> ... remainder of plotting code ...
>
> At first this appeared to work without any problems. I could kick off a job
> in background, log off the machine and return later when all the graphs had
> been produced.
>
> Now I get this RuntimeError exception. Is there anything else I need to do
> to convince matplotlib that it doesn't need my local display?
No--you just have to make sure that a non-interactive backend is getting
set before the first pylab or pyplot import.
Eric
>
> thanks!
|
|
From: Benjamin R. <ben...@ou...> - 2011-09-01 17:39:19
|
On Thursday, September 1, 2011, CompBio <rog...@cs...> wrote:
>
> I'm trying to get a script to work in batch mode to produce a large number
of
> plots. I've got the following sequence of imports in a matplotlib Python
> script:
>
> import matplotlib, os, sys
> ...
> if file_ext == 'png' :
> sys.stderr.write('Using PNG output format\n')
> matplotlib.use('agg')
> elif file_ext == 'pdf' :
> sys.stderr.write('Using PDF output format\n')
> matplotlib.use('PDF')
>
> from pylab import *
>
> ... remainder of plotting code ...
>
> At first this appeared to work without any problems. I could kick off a
job
> in background, log off the machine and return later when all the graphs
had
> been produced.
>
> Now I get this RuntimeError exception. Is there anything else I need to
do
> to convince matplotlib that it doesn't need my local display?
>
> thanks!
> --
Without the stack trace, it would be hard to tell. Plus, there is already
logic in the backends to switch to PDF and such for saving files. It should
only be necessary to set the backend to AGG if you want a headless batch
script.
Ben Root
|