SourceForge logo
SourceForge logo
Menu

matplotlib-users — Discussion related to using matplotlib

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
(4)
3
(16)
4
(4)
5
(15)
6
(16)
7
(6)
8
(4)
9
(9)
10
(5)
11
(8)
12
(14)
13
(19)
14
(21)
15
(8)
16
(6)
17
(10)
18
(22)
19
(15)
20
(7)
21
(21)
22
(1)
23
(6)
24
(16)
25
(12)
26
(11)
27
(27)
28
(7)
29
30
(4)
31
(5)





Showing 7 results of 7

From: David W. <dav...@do...> - 2011年01月20日 22:58:24
Hi folks
I am teaching myself Python by working 
through Hans Petter Langtangen's 
excellent book "Primer on Scientific 
Programming in Python".
The exercises in chapter 4 of the book 
require the student to use Python with 
the freely downloadable tools 
MatplotLib and SciTools to plot graphs 
of mathematical functions.
Despite downloading and installing 
numerous different versions of Python 
2.x, MatPlotLib and SciTools, I am 
unable to find a combination which 
will work together without crashing.
I'm currently using a Windows XP 
laptop with:
Python 2.6.6
IDLE 2.6.6
MatplotLib 0.99,3 win32 Py2.6
Scitools from 
scipy-0.80-win32-superpack-python 2.6
When I try to run a simple script to 
test the plotting functions, I get the 
error messages attached below.
I don't want to use Python 3, as there 
still seem to be some teething 
problems with this, and many of the 
modules that I've already written or 
need to use are not compatible with 
Python 3.x.
I've emailed the author, but have not 
yet had a reply.
I'd be very grateful if you could 
explain why I get the error messages 
shown below, what is a compatible 
combination of versions of Python 2.x, 
MatPlotLib and Scitools; and the URL 
of sites where I can download these.
Many thanks in anticipation
Dave
(UK)
=============================
Test script:
 1. from scitools.std import *
 2.
 3. def f(t):
 4. return t**2*exp(-t**2)
 5.
 6. t = linspace(0,3,51)
 7. y = zeros(len(t))
 8. for i in xrange(len(t)):
 9. y[i] = f(t[i])
 10.
 11. plot(t,y)
 12.
 13.
===============================
>>>
scitools.easyviz backend is matplotlib
Traceback (most recent call last):
File "C:\Python\Dave_Book 
Exercises4円_3_2 Plot test_DW.py", line 
11, in <module>
plot(t,y)
File 
"C:\Python26\lib\site-packages\scitools\easyviz\common.py", 
line 3060, in plot
self._replot()
File 
"C:\Python26\lib\site-packages\scitools\easyviz\matplotlib_.py", 
line 906, in _replot
self._g.draw()
File 
"C:\Python26\lib\site-packages\matplotlib\pyplot.py", 
line 352, in draw
get_current_fig_manager().canvas.draw()
File 
"C:\Python26\lib\site-packages\matplotlib\backends\backend_tkagg.py", 
line 215, in draw
FigureCanvasAgg.draw(self)
File 
"C:\Python26\lib\site-packages\matplotlib\backends\backend_agg.py", 
line 314, in draw
self.figure.draw(self.renderer)
File 
"C:\Python26\lib\site-packages\matplotlib\artist.py", 
line 46, in draw_wrapper
draw(artist, renderer, *args, 
**kwargs)
File 
"C:\Python26\lib\site-packages\matplotlib\figure.py", 
line 773, in draw
for a in self.axes: a.draw(renderer)
File 
"C:\Python26\lib\site-packages\matplotlib\artist.py", 
line 46, in draw_wrapper
draw(artist, renderer, *args, 
**kwargs)
File 
"C:\Python26\lib\site-packages\matplotlib\axes.py", 
line 1735, in draw
a.draw(renderer)
File 
"C:\Python26\lib\site-packages\matplotlib\artist.py", 
line 46, in draw_wrapper
draw(artist, renderer, *args, 
**kwargs)
File 
"C:\Python26\lib\site-packages\matplotlib\axis.py", 
line 742, in draw
tick.draw(renderer)
File 
"C:\Python26\lib\site-packages\matplotlib\artist.py", 
line 46, in draw_wrapper
draw(artist, renderer, *args, 
**kwargs)
File 
"C:\Python26\lib\site-packages\matplotlib\axis.py", 
line 196, in draw
self.label1.draw(renderer)
File 
"C:\Python26\lib\site-packages\matplotlib\text.py", 
line 518, in draw
bbox, info = 
self._get_layout(renderer)
File 
"C:\Python26\lib\site-packages\matplotlib\text.py", 
line 280, in _get_layout
clean_line, self._fontproperties, 
ismath=ismath)
File 
"C:\Python26\lib\site-packages\matplotlib\backends\backend_agg.py", 
line 148, in 
get_text_width_height_descent
texmanager = self.get_texmanager()
File 
"C:\Python26\lib\site-packages\matplotlib\backend_bases.py", 
line 374, in get_texmanager
from matplotlib.texmanager import 
TexManager
File 
"C:\Python26\lib\site-packages\matplotlib\texmanager.py", 
line 72, in <module>
class TexManager:
File 
"C:\Python26\lib\site-packages\matplotlib\texmanager.py", 
line 94, in TexManager
_dvipng_hack_alpha = 
dvipng_hack_alpha()
File 
"C:\Python26\lib\site-packages\matplotlib\texmanager.py", 
line 68, in dvipng_hack_alpha
raise RuntimeError('Could not obtain 
dvipng version')
RuntimeError: Could not obtain dvipng 
version
>>> 
From: Jack L. <jaa...@gm...> - 2011年01月20日 22:55:56
Ben,
thanks for your advice! With a little modification of your code I got what I
was after for.
BR
Jack
-- 
View this message in context: http://old.nabble.com/Beginner-and-plotting-CFD-data-from-file-tp30705461p30724168.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Gael V. <gae...@no...> - 2011年01月20日 19:34:41
=========================
Announcing EuroScipy 2011
=========================
---------------------------------------------
The 4th European meeting on Python in Science
---------------------------------------------
**Paris, Ecole Normale Supérieure, August 25-28 2011**
We are happy to announce the 4th EuroScipy meeting, in Paris, August
2011.
The EuroSciPy meeting is a cross-disciplinary gathering focused on
the use and development of the Python language in scientific
research. This event strives to bring together both users and
developers of scientific tools, as well as academic research and
state of the art industry.
Main topics
===========
- Presentations of scientific tools and libraries using the
 Python language, including but not limited to:
 - vector and array manipulation
 - parallel computing
 - scientific visualization
 - scientific data flow and persistence
 - algorithms implemented or exposed in Python
 - web applications and portals for science and engineering.
- Reports on the use of Python in scientific achievements or ongoing
 projects.
- General-purpose Python tools that can be of special interest to the
 scientific community.
Tutorials
=========
There will be two tutorial tracks at the conference, an introductory one,
to bring up to speed with the Python language as a scientific tool, and
an advanced track, during which experts of the field will lecture on
specific advanced topics such as advanced use of numpy, scientific
visualization, software engineering...
Keynote Speaker: Fernando Perez
===============================
We are excited to welcome Fernando Perez (UC Berkeley, Helen Wills
Neuroscience Institute, USA) as our keynote speaker. Fernando Perez
is the original author of the enhanced interactive python shell
IPython and a very active contributor to the Python for Science
ecosystem.
Important dates
===============
Talk submission deadline: Sunday May 8
Program announced: Sunday May 29
Tutorials tracks: Thursday August 25 - Friday August 26
Conference track: Saturday August 27 - Sunday August 28
Call for papers
===============
We are soliciting talks that discuss topics related to scientific
computing using Python. These include applications, teaching, future
development directions, and research. We welcome contributions from
the industry as well as the academic world. Indeed, industrial
research and development as well academic research face the
challenge of mastering IT tools for exploration, modeling and
analysis. We look forward to hearing your recent breakthroughs
using Python!
Submission guidelines
=====================
- We solicit talk proposals in the form of a one-page long abstract.
- Submissions whose main purpose is to promote a commercial product or
 service will be refused.
- All accepted proposals must be presented at the EuroSciPy conference
 by at least one author.
The one-page long abstracts are for conference planing and selection
purposes only. We will later select papers for publication of
post-proceedings in a peer-reviewed journal.
How to submit an abstract
=========================
To submit a talk to the EuroScipy conference follow the instructions
here:
http://www.euroscipy.org/card/euroscipy2011_call_for_papers
Organizers
==========
Chairs:
 - Gaël Varoquaux (INSERM, Unicog team, and INRIA, Parietal team)
 - Nicolas Chauvat (Logilab)
Local organization committee:
 - Emmanuelle Gouillart (Saint-Gobain Recherche)
 - Jean-Philippe Chauvat (Logilab)
Tutorial chair:
 - Valentin Haenel (MKP, Technische Universität Berlin)
Program committee:
 - Chair: Tiziano Zito (MKP, Technische Universität Berlin)
 - Romain Brette (ENS Paris, DEC)
 - Emmanuelle Gouillart (Saint-Gobain Recherche)
 - Eric Lebigot (Laboratoire Kastler Brossel, Université Pierre et
 Marie Curie)
 - Konrad Hinsen (Soleil Synchrotron, CNRS)
 - Hans Petter Langtangen (Simula laboratories)
 - Jarrod Millman (UC Berkeley, Helen Wills NeuroScience institute)
 - Mike Müller (Python Academy)
 - Didrik Pinte (Enthought Inc)
 - Marc Poinot (ONERA)
 - Christophe Pradal (CIRAD/INRIA, Virtual Plantes team)
 - Andreas Schreiber (DLR)
 - Stéfan van der Walt (University of Stellenbosch)
Website
=======
http://www.euroscipy.org/conference/euroscipy_2011
From: Uri L. <las...@mi...> - 2011年01月20日 19:10:14
Hi all,
I recently reinstalled MPL from scratch on top of python2.7 that I built
from scratch using homebrew on OS X Snow Leopard. Since then, I have been
getting the following types of warnings whenever I plot something:
/Users/laserson/matplotlib/lib/python2.7/site-packages/matplotlib/font_manager.py:1242:
UserWarning: findfont: Font family ['sans-serif'] not found. Falling back to
Bitstream Vera Sans
 (prop.get_family(), self.defaultFamily[fontext]))
Do I need to specify some configuration parameter to point somewhere that
the installer couldn't find?
Thanks!
Uri
...................................................................................
Uri Laserson
Graduate Student, Biomedical Engineering
Harvard-MIT Division of Health Sciences and Technology
M +1 917 742 8019
las...@mi...
From: Uri L. <las...@mi...> - 2011年01月20日 19:08:19
Hi all,
I recently installed cairo and py2cairo, which seem to import fine. When I
use the cairo backend with MPL, I get no problem when I save as a PNG, but I
get a segfault if I try saving as PDF or SVG. I have no idea how to begin
to figure out the problem. Any help is much appreciated...thanks!
Uri
...................................................................................
Uri Laserson
Graduate Student, Biomedical Engineering
Harvard-MIT Division of Health Sciences and Technology
M +1 917 742 8019
las...@mi...
Hello!
I am also using two axes in a plot and want to be able to pick the lines of
both axes.
So far I used MPL 0.99.3 and a button on my interface to change the z-order
of the axes in order to be able to pick lines of the "active" axes and to
see the correct x/y data in the navigation toolbar. The callback code of my
button is basically the code from othererik.
Since MPL 1.0.0 I have the problem that lines of the second axes simply
disappear from the plot whenever the plot is redrawn and it's zorder is
higher.
Here is my example code:
http://old.nabble.com/file/p30717629/twinxtest.py twinxtest.py 
-----------------------
import matplotlib
matplotlib.use('TkAgg')
from numpy import arange, sin, pi, cos
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg,
NavigationToolbar2TkAgg
from matplotlib.figure import Figure
import Tkinter as Tk
root = Tk.Tk()
f = Figure(figsize=(5,4), dpi=100)
ax1 = f.add_subplot(111)
ax2 = ax1.twinx()
t = arange(0.0,3.0,0.01)
s1 = sin(2*pi*t)
s2 = 2*cos(2*pi*t)
ax1.plot(t,s1,color='red', picker=True)
ax2.plot(t,s2,picker=True)
def pick_cb(event):
 if event.artist.get_lw() > 1:
 event.artist.set_lw(1)
 else:
 event.artist.set_lw(3)
 f.canvas.draw()
 
def toggle():
 if ax1.get_zorder() == 0:
 ax1.set_zorder(0.1)
 ax2.set_zorder(0)
 else:
 ax1.set_zorder(0)
 ax2.set_zorder(0.1)
canvas = FigureCanvasTkAgg(f, master=root)
canvas.show()
canvas.get_tk_widget().pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
toolbar = NavigationToolbar2TkAgg(canvas, root)
toolbar.update()
canvas._tkcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
canvas.mpl_connect('pick_event', pick_cb)
button = Tk.Button(master=root, text='Toggle', command=toggle)
button.pack(side=Tk.BOTTOM)
Tk.mainloop()
------------------
Right after start I can only pick the blue line and both lines are properly
shown even when I resize the plot. When I hit the "Toggle" button now I can
pick the red line but the pick event callback also calls canvas.draw() which
let's the blue line disappear. When I click "Toggle" and call canvas.draw()
again by resizing the window, the blue line is visible again.
In Matplotlib 0.99.3 everything worked as I expected with this code. Both
lines were always visible.
-Stephan
-- 
View this message in context: http://old.nabble.com/onpick-on-a-2-y-plot-%28-via-twinx%28%29-%29-seems-to-only-allow-picking-of-second-axes%27s-artists-tp25049128p30717629.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Benjamin R. <ben...@ou...> - 2011年01月20日 01:27:58
On Tue, Jan 18, 2011 at 5:33 PM, sgee <jaa...@gm...> wrote:
>
> I'm a CFD student and I wish to learn to make high-quality plots from my
> calculations using matplotlib. However, I'm a complete novice in using
> matplotlib and python and I didn't find any earlier posts so here goes.
>
> I have data form Ansys Fluent in the following form
> continuity x-velocity y-velocity energy
> k epsilon
> 1 0.00011115784 1.5359586e-07 1.0506172e-07
> 0.0032920227
> 0.40809903
> 1 0.16584706 0.0047719572 2.7355736e-07
> 0.026478255 0.19814095
> 0.5674 0.044237841 0.0026294924 2.8202695e-07 0.030139321
> 0.13935529
>
> The first line is for the first iteration, the second line for the second
> iteration etc. Basically, I would like to have plot this data and have a
> picture like http://openfoamwiki.net/images/f/ff/Pump_residuals.png this
>
> Any help would be much appreciated.
>
> BR Jack
>
Jack,
First, you would load your data using numpy's loadtxt() function. You can
tell loadtxt() to skip the first line since it is a header. This will give
you a 2-D array (n rows and 6 columns) where n is the number of iterations.
You can then plot the data using matplotlib's plot command (or semilogy to
automatically get y-log scaling), passing in the first column for the x
data, and then the other columns for the y data.
So, your code would look something like this:
import numpy as np
import matplotlib.pyplot as plt
data = np.loadtxt('foobar.txt', skiprows=1)
plt.semilogy(data[:, 0], data[:, 1:])
plt.xlabel('Iteration')
plt.ylabel('Residuals')
plt.legend(['Ux_0', 'Uy_0', 'p_0', 'k_0', 'epsilon_0'])
plt.show()
That should get you a similar plot. There are more things you can do to
control various aspects, but this should get you a good start.
I hope this helps!
Ben Root

Showing 7 results of 7

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /