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



Showing results of 492

<< < 1 .. 3 4 5 6 7 .. 20 > >> (Page 5 of 20)
From: Jae-Joon L. <lee...@gm...> - 2010年03月25日 20:10:32
With the current svn, I cannot reproduce the problem, i.e., bars with
0 height are correctly displayed. The x-range is incorrectly set, but
it is not clear if this is what you meant.
Can you post a screenshot of your figure? Also, version of your
matplotlib will be helpful.
Regards,
-JJ
On Wed, Mar 24, 2010 at 10:46 PM, b b <coo...@gm...> wrote:
> Hi there,
>
> While creating bar plots I found that bars with height 0 are not being
> displayed. Their space is distributed evenly between the other
> columns.
>
> Sample script:
> /--------------------------------------
> from pylab import *
> import sys
> figure(8)
> if(sys.argv[1].lower() == 'y'):
>  bar([0, 1, 0, 0, 0], [0, 1, 0, 0, 0])
> else:
>  bar([1, 2, 3, 4, 5], [1, 2, 3, 4, 5])
> show()
> \--------------------------------------
>
> Try it with argument 'y' and without.
>
> So far I didn't find a solution. '0' is not an easy thing to google
> :-) Anyone got an idea?
>
> Cheers, B.
>
> ------------------------------------------------------------------------------
> Download Intel&#174; 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: Brian G. <ell...@gm...> - 2010年03月25日 20:04:54
Greetings everyone,
This year, there will be two days of tutorials (June 28th and 29th) before the
main SciPy 2010 conference. Each of the two tutorial tracks (intro, advanced)
will have a 3-4 hour morning and afternoon session both days, for a total of 4
intro sessions and 4 advanced sessions.
The main tutorial web page for SciPy 2010 is here:
http://conference.scipy.org/scipy2010/tutorials.html
We are currently in the process of planning the tutorial sessions. You
can help us in two ways:
Brainstorm/vote on potential tutorial topics
============================================
To help us plan the tutorials, we have setup a web site that allow everyone in
the community to brainstorm and vote on tutorial ideas/topics.
The website for brainstorming/voting is here:
http://conference.scipy.org/scipy2010/tutorialsUV.html
The tutorial committee will use this information to help select the tutorials.
Please jump in and let us know what tutorial topics you would like to see.
Tutorial proposal submissions
=============================
We are now accepting tutorial proposals from individuals or teams that would
like to present a tutorial. Tutorials should be focused on covering a well
defined topic in a hands on manner. We want to see tutorial attendees coding!
We are pleased to offer tutorial presenters stipends this year for the first
time:
 * 1 Session: 1,000ドル (half day)
 * 2 Sessions: 1,500ドル (full day)
Optionally, part of this stipend can be applied to the presenter's
registration costs.
To submit a tutorial proposal please submit the following materials
to 201...@sc... by April 15:
* A short bio of the presenter or team members.
* Which track the tutorial would be in (intro or advanced).
* A short description and/or outline of the tutorial content.
* A list of Python packages that attendees will need to have installed to
 follow along.
Cheers,
Brian Granger
SciPy 2010, Tutorial Chair
From: Friedrich R. <fri...@gm...> - 2010年03月25日 19:19:15
2010年3月24日 Jonno <jon...@gm...>:
> Well I realized my error with the extra window being caused by the
> TopLevel() command. I switched this to Tk.Tk() and it works nicely.
> However I still have to pack the frame instead of using grid. I can
> work around this but I wonder if there isn't something else I'm
> missing.
If I'm not completely mistaken you can .grid() your Frame as well, but
you might have to .columnconfigure() and/or .rowconfigure() the Tk
instance with argument weight = 1 or something integer positive, to
make the row containing the plot not collapse to zero?
The main problem is, that the NavigationToolbar2TkAgg actually in
matplotlib.backends.backend_tkagg.py:681 calls self.pack(side =
Tkinter.BOTTOM, fill = Tk.X), where the toolbar is actually derived
from Tkinter.Frame. This means, subclass and overload, or:
toolbar_frame = Tkinter.Frame(tl)
toolbar_frame.grid(column = 0, row = 1)
toolbar=NavigationToolbar2TkAgg(canvas, toolbar_frame)
Now I see why your script hangs, because when you try to pack() and
grid() widgets to the same master, Tk somehow hangs up without error
message, weird if you ask me. But this I encounter often.
hth,
Friedrich
From: Friedrich R. <fri...@gm...> - 2010年03月25日 18:57:12
You must give a proper :param width: argument:
 plt.bar(bins, height, 0.01)
http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.bar
Friedrich
2010年3月25日 timothee cezard <tc...@st...>:
> Hi all,
> I'm trying to plot a distribution using bar() but when I'm setting the
> left variable to as a sequence of float some of the bar look weird.
> When I replace this sequence by a sequence of int it works fines
> Does anybody know why this happens and how I can fix it?
>
> Here is the code I'm using:
>
> if __name__=="__main__":
>  bins=[0.0, 0.02, 0.04, 0.06, 0.08, 0.1, 0.12, 0.14, 0.16,
>     0.18, 0.2, 0.22, 0.24, 0.26, 0.28, 0.30, 0.32, 0.34,
>     0.36, 0.38, 0.40, 0.42, 0.44, 0.46, 0.48, 0.5, 0.52,
>     0.54, 0.56, 0.58, 0.60, 0.62, 0.64, 0.66, 0.68, 0.70,
>     0.72, 0.74, 0.76, 0.78, 0.80, 0.82, 0.84, 0.86, 0.88,
>     0.90, 0.92, 0.94, 0.96, 0.98, 1.0]
>  height=[89775, 1665, 1791, 1695, 1467, 1395, 1306, 1169,
>      1252, 1134, 1190, 1117, 1018, 995, 1055, 904, 960,
>      886, 810, 821, 829, 763, 766, 857, 737, 862, 724,
>      852, 742, 644, 733, 679, 630, 672, 665, 659, 663,
>      653, 657, 700, 731, 721, 699, 871, 837, 913, 940,
>      966, 1028, 159774, 40002]
>  fig = plt.figure()
>  ax = fig.add_subplot(1,1,1)
>  plt.bar(bins, height)
>  plt.show()
From: Yeates, M. C (388D) <mat...@jp...> - 2010年03月25日 18:38:55
Hi
I would expect
hgt=ma.masked_where(div == 0,hgt)
m.contourf(x,y,hgt,15,cmap=plt.cm.jet)
to produce a map complementary to the map produced by
hgt=ma.masked_where(div != 0,hgt)
m.contourf(x,y,hgt,15,cmap=plt.cm.jet)
But, this is not the case.
What am I missing?
Mathew
From: Gökhan S. <gok...@gm...> - 2010年03月25日 18:17:08
On Wed, Mar 24, 2010 at 1:25 PM, Tom Kuiper <ku...@jp...> wrote:
> Greetings, everyone.
>
> I have some time tagged data spanning about three minutes with 4 ms
> resolution. If I plot these with plot_data and focus in on some event
> at high resolution I lose the tick marks. It seems that the minimum
> tick spacing is 1 sec. That appears consistent with strftime which does
> not provide for fractional seconds.
>
> I thought I saw this issue go by not long ago but I don't recall the
> solution, if any.
>
> I'm using python 2.5.2 and matplotlib 1.1.0.
>
> Thanks and regards,
>
> Tom
>
Hi,
As far as I know SecondLocator() is the smallest it gets for time-date
plotting in matplotlib. Probably a new class needs to be written for
MilliSecondLocator() in dates.py
Alternatively, you might use just floating-point version of your time values
and with a little adjustment (Ryan mentioned this in the recently, and will
forward there for other suggestions) millisecond resolutions should be
visible when zoomed in furthest.
Something like:
sci_fmt = plt.FormatStrFormatter("%.2f")
plt.gca().xaxis.set_major_formatter(sci_fmt)
By the way, where did you get mpl v1.1.0? Mine says:
In[19]: matplotlib.__version__
Out[19]: '1.0.svn'
-- 
Gökhan
From: Jeff K. <kl...@wi...> - 2010年03月25日 17:45:31
I would like to add tick labels to a 3d plot, but so far have had no
luck. I would like to start with something like the bars3d example:
http://matplotlib.sourceforge.net/examples/mplot3d/bars3d_demo.html
But I would like to have each bar chart labeled by its tick on the
y-axis. The traditional ax.yaxis.set_ticklabels() method has no
effect, and the ax.yaxis.set_ticks() just messes up the output
catastrophically.
My attempt at modifying the example is below. Any thoughts?
Thanks,
Jeff
-------------------
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
ax = Axes3D(fig)
for c, z in zip(['r', 'g', 'b', 'y'], [30, 20, 10, 0]):
 xs = np.arange(20)
 ys = np.random.rand(20)
 ax.bar(xs, ys, zs=z, zdir='y', color=c, alpha=0.8)
## My changes
ax.yaxis.set_ticks([0, 10, 20, 30]) # This totally screws things up
ax.yaxis.set_ticklabels(['first', 'second', 'third', 'fourth']) # This
does absolutely nothing
## End my changes
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')
plt.show()
------------------------
|| Jeff Klukas, Research Assistant, Physics
|| University of Wisconsin -- Madison
|| jeff.klukas@gmail | jeffyklukas@aim | jeffklukas@skype
|| http://www.hep.wisc.edu/~jklukas/
From: timothee c. <tc...@st...> - 2010年03月25日 17:33:45
Hi all,
I'm trying to plot a distribution using bar() but when I'm setting the 
left variable to as a sequence of float some of the bar look weird.
When I replace this sequence by a sequence of int it works fines
Does anybody know why this happens and how I can fix it?
Here is the code I'm using:
if __name__=="__main__":
 bins=[0.0, 0.02, 0.04, 0.06, 0.08, 0.1, 0.12, 0.14, 0.16,
 0.18, 0.2, 0.22, 0.24, 0.26, 0.28, 0.30, 0.32, 0.34,
 0.36, 0.38, 0.40, 0.42, 0.44, 0.46, 0.48, 0.5, 0.52,
 0.54, 0.56, 0.58, 0.60, 0.62, 0.64, 0.66, 0.68, 0.70,
 0.72, 0.74, 0.76, 0.78, 0.80, 0.82, 0.84, 0.86, 0.88,
 0.90, 0.92, 0.94, 0.96, 0.98, 1.0]
 height=[89775, 1665, 1791, 1695, 1467, 1395, 1306, 1169,
 1252, 1134, 1190, 1117, 1018, 995, 1055, 904, 960,
 886, 810, 821, 829, 763, 766, 857, 737, 862, 724,
 852, 742, 644, 733, 679, 630, 672, 665, 659, 663,
 653, 657, 700, 731, 721, 699, 871, 837, 913, 940,
 966, 1028, 159774, 40002]
 fig = plt.figure()
 ax = fig.add_subplot(1,1,1)
 plt.bar(bins, height)
 plt.show()
Tim
-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
From: David K. <dav...@gm...> - 2010年03月25日 17:16:18
I finally found a binary package at rpm bones, so all is fine. Thank you very 
much.
lmkli wrote:
> Thank you!
> 
> I just thought there must be a solution.
> I saw someone posted he can modified contour.py to fix this, but I failed.
> :(
> 
What version of mpl are you using? Are you modifying the default 
anti-aliasing in the patch collections that contour is creating? Are you 
seeing the problem when using the ps and pdf backends, or only with agg 
(that is, creating png files directly)?
There are two problems that can contribute to this, one related to the 
way the agg backend handles the boundaries between filled regions, and 
the other a bug in path simplification, which has been fixed in svn.
Eric
> 
> Marius 't Hart-3 wrote:
>> Actually, it does not draw the polygon edges, but leaves small gaps 
>> between them. Through those gaps you can see the background. (This also 
>> happens with polar plots and other polygons by the way.) I consider this 
>> a bug, though there are ways around it. For contour plots one can plot 
>> two contourplots over each other, one with different levels (or a 
>> different number of levels) than the other. Messy, but it works.
>>
>> Marius.
>>
>> lmkli wrote:
>>> When I use contourf to plot a filled contour map, I get some white-like
>>> lines
>>> between each two color patches, or you can call them gaps.
>>> This is not like the contourf doc string says: "it does not draw the
>>> polygon edges.", actually, it does.
>>> http://old.nabble.com/file/p27982822/contourf1.png contourf1.png 
>>> The figure above is what I get by contourf, but this is not exactlly what
>>> I
>>> want.
>>>
>>> The filled contour map I want should be like this one:
>>> http://old.nabble.com/file/p27982822/contourf2.png contourf2.png 
>>>
>>> Any advice?
>>>
>>> Thank you!
>>> 
>>
>> ------------------------------------------------------------------------------
>> Download Intel&#174; 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: Ryan M. <rm...@gm...> - 2010年03月25日 14:26:20
On Wed, Mar 24, 2010 at 8:03 PM, Angus McMorland <am...@gm...> wrote:
> On 24 March 2010 17:33, Nils Wagner <nw...@ia...> wrote:
>> Hi all,
>>
>> how can I change the output format of yticks from 1000000
>> to 1.e6 ?
>
> I'm not sure if there's an easier way still, but this works:
>
> from matplotlib.ticker import Formatter
> class SciFormatter(Formatter):
>  def __call__(self, x, pos=None):
>    return "%0.2e" % x
>
> ax = plt.gca()
> ax.yaxis.set_major_formatter(SciFormatter())
> plt.draw()
There's an easier way to format based on a string:
import matplotlib.pyplot as plt
#Also available in matplotlib.ticker namespace
sci_formatter = plt.FormatStrFormatter('%0.2e')
plt.gca().yaxis.set_major_formatter(sci_formatter)
plt.draw()
You can also make the default formatter (ScalarFormatter) display
scientific notation for smaller numbers (the default is anything with
an abs() >= 1e7). This displays in a slightly different way, with the
base power off to the side of the axis:
form = plt.gca().yaxis.get_major_formatter()
 # so anything with abs() >= 10000 will display in scientific notation
form.set_powerlimits((-4, 4))
plt.draw()
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
From: b b <coo...@gm...> - 2010年03月25日 02:46:57
Hi there,
While creating bar plots I found that bars with height 0 are not being
displayed. Their space is distributed evenly between the other
columns.
Sample script:
/--------------------------------------
from pylab import *
import sys
figure(8)
if(sys.argv[1].lower() == 'y'):
 bar([0, 1, 0, 0, 0], [0, 1, 0, 0, 0])
else:
 bar([1, 2, 3, 4, 5], [1, 2, 3, 4, 5])
show()
\--------------------------------------
Try it with argument 'y' and without.
So far I didn't find a solution. '0' is not an easy thing to google
:-) Anyone got an idea?
Cheers, B.
From: David C. <dl...@ha...> - 2010年03月25日 02:08:40
At what point is a line Collection useful? 
From: Angus M. <am...@gm...> - 2010年03月25日 02:04:14
On 24 March 2010 17:33, Nils Wagner <nw...@ia...> wrote:
> Hi all,
>
> how can I change the output format of yticks from 1000000
> to 1.e6 ?
I'm not sure if there's an easier way still, but this works:
from matplotlib.ticker import Formatter
class SciFormatter(Formatter):
 def __call__(self, x, pos=None):
 return "%0.2e" % x
ax = plt.gca()
ax.yaxis.set_major_formatter(SciFormatter())
plt.draw()
Angus.
-- 
AJC McMorland
Post-doctoral research fellow
Neurobiology, University of Pittsburgh
From: Amenity A. <am...@en...> - 2010年03月24日 23:48:18
Enthought is hiring a Software Developer.
See the description below, or on our website: http://www.enthought.com/company/sd-scientific-app.php
Best,
Amenity
--
Amenity Applewhite
Enthought, Inc.
Scientific Computing Solutions
www.enthought.com
Software Developer
The Software Developer at Enthought, Inc. participates in the 
development of scientific and technical applications involving GUIs, 2- 
D and 3-D graphics, workflow and pipeline architecture, and numerical 
algorithms. The position also involves some interaction with 
clients. Some travel may be required.
We are interested both in experienced applicants as well as in recent 
graduates. Applicants should have a BS, MS, or PhD degree with a 
strong background in science and mathematics, as well as real 
experience developing quality software, either commercial or open 
source. More experienced applicants should also have demonstrated 
project management skills and the ability to lead a team of strong 
developers with highly technical backgrounds.
Applicants will be measured against the following qualifications:
	• (Required) Bachelor's Degree in Computer Science or other 
scientific or engineering field with preferably an M.S. or Ph.D. degree.
	• (Required) Minimum 2 years of technical lead or development 
experience with 4 or more years preferred.
	• Ability to understand a problem domain and then conceive of and 
implement an intuitive user interface geared toward the scientist or 
engineer user.
	• Discipline, pride, and professionalism to write readable, 
documented, and unit-tested code that serves as an example to others 
who later study your work.
	• Strong work ethic and commitment to satisfying the customer.
	• Experience with Python, and a strong understanding of how to apply 
its capabilities to develop GUI frameworks, work flow frameworks, and 
elegant scientific applications.
	• Strong understanding of statistics, optimization, image processing, 
signal processing, or other technical area.
	• Experience with the following:
		• GUI frameworks such as NetBeans or Eclipse
		• wxPython, Qt
		• Low-level 2-D graphics APIs such as Quartz or GDI+
		• 3-D graphics, preferably using VTK
		• Developing or working with plotting APIs
		• Experience using (and interest in contributing to) SciPy
		• numeric algorithms
Enthought offers competitive salaries and the opportunity to work on 
varied and interesting technical projects. We are located in Austin, 
TX, consistently rated as one of the best places to live in the US. 
Benefits include health, dental, vision and a 401k plan.
If you are interested in applying, submit a resume to 
jo...@en.... Code samples and links to previous work are 
encouraged but not required.
From: Rich K. <ric...@gm...> - 2010年03月24日 23:12:53
On Wed, Mar 24, 2010 at 4:19 PM, Michael Droettboom <md...@st...> wrote:
> Rich Krauter wrote:
>>>
>>> Rich Krauter wrote:
>>>
>>>>
>>>> Hello,
>>>>
>>>> I am a relatively new user of matplotlib; thank you to the matplotlib
>>>> team for this excellent package.
>>>> I have a question about serializing matplotlib figures. I have searched
>>>> for serialization options for matplotlib figures but have not found much
>>>> information. I am interested to hear about serialization use cases and the
>>>> approaches others use in these cases.
>>>>
>>>> Here is the reason I am asking:
>>>>
>>>> My use case for serialization is that I want to build a CouchDB database
>>>> of matplotlib figures. The database could be accessed from a web
>>>> application (in my case I want to build a django app to create, edit and
>>>> manage figures) or desktop gui, or whatever. For storage of the figures in
>>>> CouchDB, I am working on JSON representations of matplotlib figures. The
>>>> JSON could be run through simple python functions to regenerate the
>>>> matplotlib figures. I have very simple working examples, but to more
>>>> completely test out this approach I would attempt to recreate the plots in
>>>> the matplotlib gallery using JSON representations and a small set of
>>>> (hopefully) very simple python functions which would process the JSON
>>>> markup.
>>>>
>>>> Before I get too far, I wanted to see what others have done for similar
>>>> use cases, make sure I am not missing existing approaches, etc. I am
>>>> getting ahead of myself now, but if there is broader interest in this
>>>> approach, and no other better solutions exist, I would set up a project on
>>>> Google Code or some other site to work on this.
>>>>
>>
>> On Wed, Mar 24, 2010 at 1:15 PM, Michael Droettboom <md...@st...>
>> wrote:
>>
>>>
>>> What is the advantage of JSON (is this specific case) over Python source
>>> code? matplotlib is designed around it and it's more flexible. Unless
>>> you're planning on automatically manipulating the JSON, I don't see why you
>>> wouldn't just use Python source.
>>>
>>> Mike
>>>
>>>
>>
>> Mike,
>>
>> I don't know that there is much of a benefit to JSON outside of my use
>> case or similar use cases. I want to manipulate the JSON
>> representation of a figure within a javascript-based web interface to
>> provide dynamic plotting through a web page. I also want to be able
>> to store and query JSON representations using CouchDB.
>>
>> I am probably not exactly clear on what you mean by "using python
>> source" to represent a figure. Is there a standard agreed upon way to
>> do this?
>
> In general, most matplotlib users write Python scripts to generate their
> plots. These scripts usually read in data from an external file in any
> number of formats (the format tends to be domain-specific, but matplotlib
> provides support for a number of CSV formats, Numpy itself supports a number
> of ways of reading arrays etc.) matplotlib tends to be agnostic about data
> (as long as you can convert it to a Numpy array somehow, it's happy), but
> has a clearly defined API for plot types and styles.
>>
>> I do have python source code representations of figures.
>> i.e. I have dict representations of matplotlib figures. The dicts
>> have a "required" internal structure. I feed the dict to a function
>> which regenerates the figure graphic from that structure. If I want
>> to update the plot, I just change the contents of the dict data
>> structure representing the plot, not the source code that is used to
>> generate the figure. If I instead had a JSON object representation of
>> a figure, I would convert it to a python dict and use the same
>> function as before to produce the figure.
>>
>
> I guess I have trouble seeing why a dictionary representation which is then
> interpreted to convert it to function calls is better than just making the
> function calls directly. That's the "interface" to matplotlib that is known
> and tested.
>
Here are my reasons why a structured representation (dict, JSON, XML,
...) is useful:
- I want to access the same plot representation through both python
and through javascript. I need to access it in python to run MPL and
create plot images, and I want to use javascript to build the user
interface.
- I want to separate the plot content from the plot generation. I
can serialize a data structure containing plot contents more easily
than I can record the commands a user might call to generate a plot.
The content of the plot is not python specific, only the generation of
the MPL plot is. I need to be able to serialize the content to
support later modifications.
> The only use case I can imagine where a dictionary might be preferable would
> be if an external tool needs to read in the dictionary, modify it and spit
> it back out. Reading arbitrary Python code is of course extremely hairy,
> whereas the JSON dictionary could be defined to be a more limited and
> manageable subset. Another possible advantage may be security related -- if
> you need to run untrusted plot code, you certainly don't want to be running
> untrusted Python code.
>>
>> I haven't found much discussion about serialization of matplotlib
>> figures, but I probably have not searched well enough, or maybe it is
>> not a high interest topic. The discussion I have found seems to
>> suggest using the script you used to create the figure as the
>> serialization of that figure. To modify the figure, you modify the
>> script an rerun it.
>
> Yes -- that's the general consensus (at least among the core developers)
> when the discussion comes up. There have been discussions and experiments
> using enthought.Traits that might make plots serializable and malleable, but
> it's a significant refactoring of matplotlib to take such an approach, for a
> fairly minor gain. It's also extremely difficult to invent a serialization
> that would survive version upgrades to matplotlib. One advantage of the
> script approach is that when APIs change in a backward-incompatible way, it
> is generally easier for end users to update their plots. If plots were in a
> less human readable/writable format the changes required may be less
> obvious.
>>
I can see why an MPL-internal serialization capability would be low on
the priority list. It's hard to do and no one is really asking for
it. I don't think you were implying this, but just to be clear I am
not requesting a change to MPL or complaining about its functionality.
 Hope I didn't give the impression that I was.
Agreed that API changes could be difficult to deal with.
>> What I would like to have (and what I have somee
>> very preliminary examples for) are versioned data structures that can
>> be converted to matplotlib figures without modifying any python source
>> code (other than the structured representation of the figure itself.)
>> However, I don't know how much the matplotlib API changes, and an
>> approach like this may be very sensitive to those changes.
>>
>
> I don't understand the motivation to avoid modifying Python source code. If
> you want to have common functionality that needs to change en masse, you can
> use Python functions in a library. You could write Python scripts defining
> a plot that are nothing more than data and a single function call to said
> library.
I am not opposed to modifying python source code. What I meant is
that I tried to separate the content of the figure from its
generation. There is nothing python-specific about the content of a
figure. To change a plot I change its content (as represented by a
python dict, XML, JSON, etc.), not the python code used to generate
the figure from the content. I can add support for other MPL features
by changing the JSON, XML, python dict representation; I shouldn't
have to add server side python code to support additional MPL
features.
> Are you indexing the JSON at a fine-grained level in the couchdb, or are
> they ultimately just blobs anyway? In which case a Python blob or a JSON
> blob should make no difference.
>
Good point, they will probably mostly be blobs, with some associated
metadata to query against.
> I'm not trying to dissuade you from creating a JSON frontend if there's a
> strong advantage. But keeping that frontend in sync with the progress of
> matplotlib may be difficult, depending on how much coverage you want to
> provide.
>
> Mike
Understood, and thanks for the input.
Rich
From: David K. <dav...@gm...> - 2010年03月24日 22:48:31
Hello, I have a problem when compiling matplotlib. 
python setup.py build stop here :
copying lib/matplotlib/mpl-data/matplotlibrc -> build/lib.linux-
x86_64-2.4/matplotlib/mpl-data
copying lib/matplotlib/mpl-data/matplotlib.conf -> build/lib.linux-
x86_64-2.4/matplotlib/mpl-data
running build_ext
error: don't know how to compile C/C++ code on platform 'posix' with 'gcc' 
compiler
Any idea? 
By the way, do you know how to install matplotlib in a selected location ? 
Thank you very much.
David
From: Christopher B. <Chr...@no...> - 2010年03月24日 22:46:45
David Kremer wrote:
>> Does anybody know where I could get a
>> copy of superpack?
I don't know of the status of that, but this is what I recommend:
install the python2.6 from python.org
install the numpy1.3 binary from scipy.org
install the matplotlib binary (*.dmg) from matplotlib.org
(optional)
install the scipy binary from scipy.org
and there you go -- I suppose it would be nice to have it all in one 
install, but that's not too hard.
(if you really want all in one -- check out Python(x,y) or EPD)
-Chris
-- 
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
From: David K. <dav...@gm...> - 2010年03月24日 22:23:39
Le Wednesday 24 March 2010 22:02:15, Pau a écrit :
> Hello,
> 
> I am using macosx 10.6 aka snow leopard (not willingly btw) and I need
> to install matplotlib. I know of superpack but the site seems to have
> been "dead" for some weeks now. Does anybody know where I could get a
> copy of superpack?
> 
> thanks,
> 
> Pau
You could find interesting the sage package, which is embedding matplotlib and 
other mathematical stuff. 
take a look : http://www.sagemath.org/
From: Nils W. <nw...@ia...> - 2010年03月24日 21:33:56
Hi all,
how can I change the output format of yticks from 1000000 
to 1.e6 ?
Nils
From: Pau <vim...@go...> - 2010年03月24日 21:02:22
Hello,
I am using macosx 10.6 aka snow leopard (not willingly btw) and I need
to install matplotlib. I know of superpack but the site seems to have
been "dead" for some weeks now. Does anybody know where I could get a
copy of superpack?
thanks,
Pau
From: Rich K. <ric...@gm...> - 2010年03月24日 20:53:50
On Wed, Mar 24, 2010 at 1:37 PM, Chris Barker <Chr...@no...> wrote:
> Michael Droettboom wrote:
>> What is the advantage of JSON (is this specific case) over Python source
>> code? matplotlib is designed around it and it's more flexible. Unless
>> you're planning on automatically manipulating the JSON, I don't see why
>> you wouldn't just use Python source.
>
> Indeed. There have been a few threads about this topic, and I think the
> consensus is that the way to auto-generate figures is with python.
>
> I don't think that there is any technical reason that one couldn't
> create a serialized version of an MPL figure in XML, or JSON, (or, for
> that matter, a python data structure), but it would be a fair bit of
> effort to write the code, and I don't think you'd get any real advantage
> over just using scripts -- you need a python script to create a figure
> in the first place, why not serialize that?
Chris,
To answer your question, because I can't think of a way to build a
web-based user interface to let users make incremental changes to the
plot produced by that script. Or some other plot that was generated
using a different script.
ISTM if I have a defined serialization structure (whether it be in
XML, JSON, or a python data structure) I can more easily build a
web-based user interface for manipulating that structure. Below is an
example figure structured as a python dict and a rendering function.
Not sure if this clarifies what I am trying to do ...
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
plot = {
 'metadata': {
 'description': 'This is a sample plot representation',
 'matplotlib_version': '0.99.0',
 'author': 'RMK',
 'last_updated': [2010, 3, 24, 13, 25, 0],
 'type': 'lineplot'
 },
 'figure':
 {'methods':
 [
 ['set_size_inches', [10,4], {} ]
 ]
 },
 'axes':
 {
 121:
 {'datasets':[
 {
 'data': [ [1,2,3], [4,5,6] ],
 'options': {'linewidth':4, 'label': 'Source 1'},
 },
 {
 'data': [ [1,2,3], [12,13,14] ],
 'options': {'linewidth':4, 'label': 'Source 2',
 'marker':'*', 'visible': True},
 }
 ],
 'methods': [
 ['set_xlabel', ["Testing ..."], {} ],
 ['legend', [], {} ]
 ]
 },
 122:
 { 'datasets': [
 {
 'data': [ [1,2,3], [7,8,9] ],
 'options':{'linewidth':4, 'label': 'Source 3'},
 }
 ],
 'methods': [
 ['set_xlabel', ["Label ..."], {} ],
 ['legend', [], {} ]
 ]
 }
 }
}
def generate(plot,figname):
 fig = plt.figure()
 methods = plot['figure']['methods']
 for method, args, kwds in methods:
 getattr(fig, method)(*args, **kwds)
 for axes in plot['axes']:
 ax = plt.subplot(axes)
 datasets = plot['axes'][axes]['datasets']
 for dataset in datasets:
 plt.plot(*(dataset['data']), **(dataset['options']))
 for method, args, kwds in plot['axes'][axes]['methods']:
 getattr(ax, method)(*args, **kwds)
 plt.savefig(figname)
if __name__ == '__main__':
 generate(plot, 'junk.png')
Rich
From: Ryan M. <rm...@gm...> - 2010年03月24日 20:29:13
On Wed, Mar 24, 2010 at 10:55 AM, <dav...@gm...> wrote:
> Hello.
>
> I would like to know, please, how you can add graphics on a same plot.
>
> eg :
>
> superpose sine and cosine graphs on the same plot.
If you're just starting out with matplotlib, spending some time in our
gallery is a great place to learn:
http://matplotlib.sourceforge.net/gallery.html
For your particular need, I'd look at:
http://matplotlib.sourceforge.net/examples/pylab_examples/legend_demo2.html
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
From: Jim V. <Jim...@no...> - 2010年03月24日 20:23:01
dav...@gm... wrote:
> Hello.
>
> I would like to know, please, how you can add graphics on a same plot.
>
> eg :
>
> superpose sine and cosine graphs on the same plot.
>
> Thank you very much.
>
>
> ------------------------------------------------------------------------------
> Download Intel&#174; 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
> 
Have you looked at: screenshots 
<http://matplotlib.sourceforge.net/users/screenshots.html> and/or 
examples <http://matplotlib.sourceforge.net/examples/index.html> ?
-- jv
From: Alan G I. <ala...@gm...> - 2010年03月24日 20:22:10
On 3/24/2010 12:58 PM, dav...@gm... wrote:
> I would like to know, please, how you can add graphics on a same plot.
>
> eg :
>
> superpose sine and cosine graphs on the same plot.
> 
Just use `plot` again.
Or do many lines in one go:
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.plot
Here are some possibilities:
http://matplotlib.sourceforge.net/gallery.html
hth,
Alan Isaac
27 messages has been excluded from this view by a project administrator.

Showing results of 492

<< < 1 .. 3 4 5 6 7 .. 20 > >> (Page 5 of 20)
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 によって変換されたページ (->オリジナル) /