Re: [matplotlib-devel] Large datasets performance....

2009-06-17 Thread Ludwig Schwardt
Hi,

On this subject, one program that has pretty impressive interactive
visualisation is the venerable snd
(http://ccrma.stanford.edu/software/snd/). It displays hours of audio
in a flash and allows you pan and zoom the signal without a hitch. It
only plots an envelope of the audio signal at first, and shows more
and more detail as you zoom in.

Jimmy's comment that there's no need to visualize 3 million points if
you can only display 200 000 is even more true for time signals, where
you can typically only display 1000 to 2000 samples (i.e. the number
of horizontal pixels).

Does the new path simplification code use a similar approach to snd?
I've always wanted something like that in matplotlib... :-)

Regards,
Ludwig

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] building from SVN on Mac OS X 10.5

2009-08-21 Thread Ludwig Schwardt
Hi,

Just my $0.10 on this topic: Stick with the default system Python
2.5.1 on Leopard and save yourself a lot of potential hassle.

In the days of Tiger and its antiquated and hamstrung Python 2.3, many
people were forced to install Python themselves just to get going.
They had to choose between several alternatives: MacPython,
Enthought's EPD, ActiveState Python, etc. This notion of installing
Python on Mac OS X persists to this day, and many people still assume
it is necessary.

If you really want the latest Python or the convenience of a
pre-packaged distribution, go ahead and install one of the fine Mac
Pythons out there. On the other hand, if you just want to get
matplotlib going, the system Python will do just fine. In my
experience it saves you many hassles with CPU architectures during
builds (which has gotten worse under Leopard). I successfully built
and ran the latest MPL r7514 by simply typing "python setup.py build".
No environment variables to be set...

On an aside, Snow Leopard (Mac OS 10.6) looks to have a whole range of
Pythons, from 2.5 all the way up to 3.1. This could make the default
system Python even more of a no-brainer.

Regards,
Ludwig

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Comparison of mlab.csd and Matlab's cpsd

2010-02-05 Thread Ludwig Schwardt
Hi,

> From: Ariel Rokem 
> However - two elements are off by a factor of approximately 2 - the
> very first element and the very last. ... Does anyone have any idea
> why this would be the case?

>From a quick look at the mlab code, it looks like a bug in
mlab._spectral_helper.

The default spectrum is 'onesided' (same as for Matlab's cpsd). A
single-sided spectrum of a real signal has double the magnitude of a
double-sided spectrum, *except* at the origin (frequency index n = 0)
and Nyquist frequency (n = NFFT / 2), where it is the *same* as the
double-sided one [1]_.

In the mlab code, all the spectral values are simply scaled by a
factor of 2 (among other factors) in this line:

# Scale the spectrum by the norm of the window to compensate for
# windowing loss; see Bendat & Piersol Sec 11.5.2.  Also include
# scaling factors for one-sided densities and dividing by the sampling
# frequency, if desired.
Pxy *= scaling_factor / (np.abs(windowVals)**2).sum()

This should be easy to fix (although the function probably needs a
little rework).

Regards,
Ludwig

Quick reference from my bookshelf:
---
.. [1] W. L. Briggs, V. E. Henson, "The DFT: An Owner's Manual for the
Discrete Fourier Transform," Section 1.3, Problem 6 (a), p. 13.

--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Proposal for Broken Axes

2010-03-16 Thread Ludwig Schwardt
Hi,

> Date: Mon, 15 Mar 2010 13:16:59 -0700 (PDT)
> From: klukas 
>
> It's my understanding that there is no built-in method for generating a
> "broken axis" (where you skip over some range of values, indicating this
> with some graphical mark).

I've fudged something similar recently, using a more hacky approach. I
wanted to display a time series with potentially large gaps in its
recording, so I figured out a way to remove the gaps from the plot by
"compacting" the x data, but adjusting the x tick labels to reflect
the original values of the data. Here is an example:

Suppose I have two segments in my time series that are far apart in
time. The segments typically have different lengths. Both the x and y
data are stored as a sequence of 2 arrays (1 per segment), e.g.

x = [ [3, 4, 5, 6, 7, 8, 9], [340, 342, 344, 346, 348] ]
y = [ [ ... ], [ ... ] ]

I only focus on the x (time) axis in this case. I compact the x values
so that the minimum value of the first segment is 0, and the minimum
value of each subsequent segment is equal to the maximum value of the
segment to the left of it. This preserves the relative x-spacing
between the points of the same segment, but shifts the segments to sit
right next to each other. For the above example, I subtract an offset
of 3 for the first segment and 334 for the second segment to get:

compacted_x = [ [0, 1, 2, 3, 4, 5, 6], [6, 8, 10, 12, 14] ]

I then plot the (compacted_x, y) segments as usual on a single Axes,
in my case using a LineCollection. Afterwards, I define a new tick
formatter derived from the standard mpl.ticker.ScalarFormatter that
determines which segment contains the x-value it is called with and
then adds back the appropriate offset before creating the tick label.
I also add dashed vertical "break lines" to indicate the breaks
between segments.

This scheme works especially well for monotonically increasing ticks
(such as time series). I can provide code if anyone is interested.
I've extended it to x and y axes, and it will split image segments in
the same way as line segments (for spectrograms, for example). The
only major current downside is that the cursor displays the compacted
x-value when hovering over the plot (maybe this could be fixed too?).

Regards,
Ludwig

--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] web gui

2010-06-17 Thread Ludwig Schwardt
Hi,

Simon Ratcliffe (the other Ratcliff :-)) and myself are working on an
MPL backend that uses the HTML5 Canvas element. It is nearly done and
soon to be released, once we get permission from our employer to
release it under an open-source license. It does zooming and pretty
good animation as well. It also has no additional dependencies except
for Matplotlib and currently runs on the latest HTML5-compliant
browsers (Chrome 4+, Safari 5, IE9 when released, Firefox nightlies).

Some idea of its functionality can be seen at
http://genotrak.webfactional.com/mplh5canvas/.

We will keep the list updated on its progress.

Regards,
Ludwig Schwardt

--
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] web gui

2010-06-18 Thread Ludwig Schwardt
Hi,

On Thu, Jun 17, 2010 at 8:07 PM, william ratcliff
 wrote:
> How do you deal with interactivity?

When you create a figure, a WebSocket server is spawned on its own
socket, with its own thread. The client (browser) then interacts with
these threads. Zooming, panning and resizing are all done on the
server side, under request from the client. This allows you the full
functionality of matplotlib, as this corresponds to how other
interactive backends work. The interactivity is better than expected -
with local connections we achieve 40 frames per second while animating
a 2000-point plot, for example.

We also provide a management port, which serves as the portal for the
available figures. At the start of your session, you connect the
browser to this management port. Thereafter, new figures pop up as new
thumbnails on this page, and can be selected for viewing. This port
also provides the static HTML/JS framework for the plots.

This interactivity is what makes it a true replacement for the other
interactive backends. If people are interested, we can put together a
screencast of the functionality.

Ludwig

--
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] web gui

2010-06-18 Thread Ludwig Schwardt
Hi,

On Thu, Jun 17, 2010 at 6:30 PM, Ondrej Certik  wrote:
> That would be exactly what I need. Do you have any time frame for the
> release? The problem is that I need it right now. So I'll try to
> finish my own stuff today, so that I can at least work and then later
> improve it or switch to your stuff.

We have the go-ahead to release the HTML5 Canvas backend and will get
it out by Monday. Testers will be welcome!

Ludwig

--
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


[matplotlib-devel] Data limit oddity when combining normal line and axvline collections

2010-08-18 Thread Ludwig Schwardt
Hi,

I am hesitant to call the following a bug. It might just be a
misunderstanding on my side. Anyhow...

I am plotting a normal line collection and an "axvline" collection on
the same Axes. The latter is a collection of lines with data
coordinates for x and axes coordinates for y, using a blended
transform. I find that the data limits are messed up by the axvline
collection, which unexpectedly sets the bottom y limit to 0. This
results in a badly scaled plot when adjusting the view with
autoscale_view. Interestingly, this problem goes away if the normal
line collection is viewed first via autoscale_view, if the normal line
collection is replaced by a normal plot command, or if the axvline
collection is replaced by a normal axvline command. The problem
appears if the two collections are added to the Axes without an
autoscale_view in between.

I ran the code below with matplotlib trunk (SVN r8646) on Mac OS 10.5
with TkAgg backend. The same behaviour appears in matplotlib 0.99.1.1.
Please let me know if I am doing something obviously stupid,
especially in the way I create the axvline collection. At the moment I
am working around the behaviour by inserting an autoscale_view between
the two collections, so it is not a major show-stopper.

Regards,
Ludwig


### Start code snippet ###

import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np

# Create sine wave to plot (offset from zero)
t = np.arange(200)
x = 10 + np.cos(2 * np.pi * t / 20)

plt.figure(1)
plt.clf()
ax = plt.gca()

# Add main plot as a line collection containing one segment
segments = mpl.collections.LineCollection([zip(t, x)])
ax.add_collection(segments)
print ax.dataLim
# Output: Bbox(array([[   0.,9.], [ 199.,   11.]]))

# Uncommenting the line below actually fixes the problem...
#ax.autoscale_view()

# Add break lines as a collection of axvlines
breaks = np.arange(0, 200, 20)
transFixedY = mpl.transforms.blended_transform_factory(ax.transData,
ax.transAxes)
break_lines = mpl.collections.LineCollection([[(s, 0), (s, 1)] for s
in breaks], transform=transFixedY, colors='k', linewidths=0.5,
linestyles='dotted')
ax.add_collection(break_lines)
print ax.dataLim
# Output: Bbox(array([[   0.,0.], [ 199.,   11.]]))
# Notice that y0 is now 0 instead of the expected 9

# Autoscaling now inserts a lot of space below the original plot
ax.autoscale_view()

### End code snippet ###

--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] PATCH: fix libpng URLs for OS X makefile

2010-12-09 Thread Ludwig Schwardt
Hi,

This patch reminded me to ask why the builtin libpng, zlib and
libfreetype on Mac OS 10.5 and later are not used to build Matplotlib,
removing the need to download these extra libraries. I was pleased to
discover that Snow Leopard shipped with libpng and libfreetype as part
of X11, only to find that even my old Leopard installation had them.
I've been successfully building Matplotlib against them on both
platforms. Besides skipping the download step, these libraries have
the advantage of being correct universal binaries, eliminating another
potential stumbling block. The only problem would be if these
libraries were outdated, but I haven't come across any problems yet.

For the record, I set the following environment variables in
~/.profile on Snow Leopard:

# These compiler flags ensure 32-bit + 64-bit code generation, as
Snow Leopard produces 64-bit code by default
export MACOSX_DEPLOYMENT_TARGET=10.6
export CFLAGS="-arch i386 -arch x86_64 -isysroot
/Developer/SDKs/MacOSX10.6.sdk"
export LDFLAGS="-arch i386 -arch x86_64
-syslibroot,/Developer/SDKs/MacOSX10.6.sdk"
export FFLAGS="-m32 -m64"

I then build a Matplotlib egg with:

CFLAGS=${CFLAGS}" -I/usr/X11/include -I/usr/X11/include/freetype2"
LDFLAGS=${LDFLAGS}" -L/usr/X11/lib" python setupegg.py bdist_egg

I've been meaning to publish my installation instructions for
numpy/scipy/matplotlib/ipython on Snow Leopard somewhere for quite a
while, but that will have to wait for another day... I've tried to
trim down my installation procedure to the minimum steps that will
guarantee a working system without introducing extra libraries /
Pythons / etc, so there might be some interest in it.

Ludwig

--
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] How to decouple non-GUI stuff from the GUI?

2010-12-14 Thread Ludwig Schwardt
Hi,

Weighing in on the Mac build issue:

- The only GUI backends worth building on Mac OS X are TkAgg and the
native macosx one, in my humble opinion. Sticking to them will prevent
the kind of pain Kynn described. These backends are autodetected by
default during the build process and you only land in trouble if you
explicitly enable the rest. My suggestion is therefore to do the
default "python setup.py install".

- I have been successfully using the Apple "system" Python since Mac
OS 10.5 to run numpy/scipy/matplotlib/ipython and never encountered
any major build or usage problems. I agree that Mac OS 10.4 and
earlier needed a Python reinstallation, but do not see why it is
currently still a strong requirement. Ben, do you know off-hand what
issues numpy has been having with Apple Python?

As improved documentation I can contribute (yet another :-)) tutorial
for building and installing matplotlib and friends on a clean Mac OS
10.6 system, with a minimum of downloaded packages and using the
standard system stuff as far as possible. I fine-tuned the
instructions on several iMacs at work. I will just check that it still
works with the latest packages.

Regards,
Ludwig


> Message: 4
> Date: Thu, 18 Nov 2010 16:57:10 -0600
> From: Benjamin Root 
>
> There are a variety of issues depending on your Mac system that needs to be
> sorted out to determine the best way to go about installing everything.  The
> particular sticking point is that Apple supplied their own interperater
> rather than the standard python interpreater.  Unfortunately, this causes
> problems with numpy (and thus matplotlib).

--
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] matplotlib on PyPI

2011-01-20 Thread Ludwig Schwardt
Hi,

I feel your pain on the issue of eggs...

> - Is there some way to name the eggs to disambiguate between 32-bit
> Python 2.7 (which works on all versions of Mac OS X) and 64-bit Python
> 2.7 (which only works on 10.6) that is compatible with easy_install?
> In the past if the eggs had strange names easy_install misbehaved.

When I built the readline package on the Mac, I ran into similar
issues. To keep things simple (or so I thought), I built one universal
egg. On Leopard with Apple Python 2.5 (see
http://pypi.python.org/pypi/readline/2.5.1) and the setuptools at the
time (May 2008), the egg was named *-fat.egg. Since there is no
architecture called "fat", easy_install refused to select it for
installation. So I renamed it to the explicit architectures
(*-i386.egg, *-ppc.egg, *-ppc64.egg, *-x86_64.egg), but this was
another saga, since PyPI refused to upload identical files with
different names. I then tweaked each egg slightly to bypass this...
Very silly, as you can see.

The latest version of the readline package
(http://pypi.python.org/pypi/readline) has an egg for Leopard and Snow
Leopard built against the default Apple Python on each system. On Snow
Leopard and Python 2.6, the egg is now called *-universal.egg and
seems to work with the latest easy_install. To avoid repeating the
silly tweaking of eggs, I renamed the Leopard *-fat.egg to *-i386.egg
only, as that is pretty much the dominant architecture which will keep
most easy_install users happy (70% of the downloads of the 2.5.1
Leopard version with four eggs picked the i386 egg).

To get back to your question, I would venture something like
matplotlib-1.0.1-py2.7-macosx-10.3-i386.egg and
matplotlib-1.0.1-py2.7-macosx-10.6-x86_64.egg (ditto for the ppc
architectures).

Regards,
Ludwig

P.S.
> So my recommendation is not to Python 2.5 on a Mac.
I have been running matplotlib on Apple Python 2.5 on Leopard mostly
with the TkAgg backend (on Apple Tk) for a few years now - maybe it's
time to upgrade ;-)

--
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] matplotlib.cbook.iterable

2011-03-23 Thread Ludwig Schwardt
Hi,

In my code I have yet another version:

def is_iterable(x):
"""Checks if object is iterable (but not a string)."""
return hasattr(x, '__iter__')

I specifically wanted to test for lists, tuples and numpy arrays, but
not strings. Depending on the semantics of underscored methods could
be considered flaky coding, though :-)

Ludwig

--
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


[matplotlib-devel] Patch: Building TkAgg backend without a running X server

2007-10-31 Thread Ludwig Schwardt
Hi,

I've reworked the Tcl/Tk checking code in setupext.py (see attached
patch). It is now possible to build matplotlib with Tk support without
requiring a running X server. This is useful for doing autobuilds
(e.g. as done by Debian) and for building a package on one machine to
be installed and used on another.

This seems to be an old issue... (see matplotlib-devel, "building
matplotlib without X-server connection," 11 Nov 2004)

The patch also fixes a potential hang, which happens when I try to
build the latest matplotlib on Debian Etch with Python 2.4, on a
system with libtk8.4-dev installed but no running X server. The build
should have continued without TkAgg support, but it hangs. The hang
occurs because the Tcl/Tk checking code calls Tkinter.Tk() multiple
times, which is not a good idea. In fact, just running the following
snippet hangs the interpreter in this scenario:

import Tkinter
tk = Tkinter.Tk()
tk = Tkinter.Tk()

The patch applies to setupext.py in revision r3975. I checked it with
matplotlib r4064, using Python 2.4 on Debian Etch, and Python 2.5 on
Mac OS X 10.4.10. Could someone please check it with Python 2.3 and on
Windows?

Regards,
Ludwig


setupext.py.patch
Description: Binary data
-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] rgb versus cmyk

2007-11-21 Thread Ludwig Schwardt
Hi,

> Publishers sometimes require electronic figures as tif or eps, and using
> the cymk color system.  We do everything in rgb.  I don't understand
> color systems well.  What would be needed to give mpl the ability to
> produce files using the cymk system?

I don't understand color systems very well, either, but I ran into
this problem when I printed out some color figures recently.

I saved a mpl line plot containing 'r', 'g' and 'b' lines to a PDF
file. The file displayed on-screen as expected, using both Linux
acroread and Mac OS X Preview as viewer. It also printed out as
expected on an HP Color Laserjet via Linux acroread. On the Mac,
however, a straightforward printout resulted in purple instead of blue
lines. The problem disappeared when I selected ColorSync -> Color
Conversion -> In Printer in the print dialog.

When I printed out an OmniGraffle PDF diagram, however, the colors
were messed up using "In Printer" and correct when using "Standard"
color conversion. This forced me to print the color pages in my thesis
containing OmniGraffle diagrams and mpl figures using different
printer settings, which is quite annoying.

There is another option, which makes Linux and Mac PDFs much more
compatible (especially for color), and that is PDF/X-3
(http://en.wikipedia.org/wiki/PDF/X). This subset of PDF forces the
document to include all fonts and color profiles, leaving nothing to
chance. While the file is possibly bigger, it is more likely to
display correctly on all manner of printers and screens. I eventually
converted my Omnigraffle diagrams to PDF/X-3, and now their colors and
shadows appear correct on Linux, while they were psychedelic before.

PDF/X-3 might be a worthwhile standard to follow for mpl figure output
(even only as an option). At least embedding ICC profiles is probably
a good idea.

Regards,
Ludwig

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] rgb versus cmyk

2007-11-21 Thread Ludwig Schwardt
Hi,

On Nov 21, 2007 3:39 PM, Gael Varoquaux <[EMAIL PROTECTED]> wrote:
> I have had some problems printing posters on a plot where indeed the
> colors came out a bit wrong. I was told by the staff that it was because
> the conversion RGB->CMYK was handled differently by different printers
> and screens. I don't know if providing and ICC profile would solve the
> problem, but it can't harm.

The ICC profile maps the device-dependent RGB (or CMYK) values stored
in the plot to a device-independent color space (either CIE Lab or the
equivalent XYZ). This independent color space describes *absolute*
color - a point in Lab space is therefore intended to look the same on
any screen or printer. When this profile is combined with a second ICC
profile for the target screen or printer on which the plot is to be
viewed/printed, it allows the color management software to convert the
RGB values in the PDF to the appropriate RGB or CMYK values that will
produce the intended absolute color on the target device.

It is therefore important to realise that both RGB and CMYK are
*relative* color spaces, relative to some device. The R, G and B
values are merely weights mixing together the device's interpretation
of true R, G and B (the same goes for CMYK).

Some problems:

- Devices produce different subsets of the set of all visible colors
(the issue of color gamut). For example, CMYK printers struggle with
highly saturated green. If you make an RGB plot on your LCD screen, a
pure green line with color 'g' or 0x00FF00 may not ever come out the
same way on your printer.

- Matplotlib plots typically use an abstract concept of color. Lines
are usually colored to distinguish them from each other, and
frequently the absolute color is not that important. More importantly,
there is typically no device associated with the input color (as is
the case with images derived from scanners or digital cameras), and
therefore no way to map the RGB relative values to absolute color.

Possible solutions:

- Use colors that are safe for printing and displaying (less saturated colors?).

- Use Lab color, which is absolute. This is cumbersome, and RGB is
much more commonplace and well-understood in plotting packages,
including Matlab.

- Associate a generic ICC profile with the mpl plot, to attach
absolute color values to the RGB values in the plot in a consistent
way. Maybe this is the default in many graphics file formats and
therefore redundant, or maybe it does make a difference specifying it
explicitly, I'm not sure.

> Is this also possible for EPS, or are we stuck with the problem without a
> good solution?

As far as I can tell, you can embed ICC profiles in most graphic file
formats, including PDF, EPS, JPG, PNG, SVG, TIFF, etc.

Regards,
Ludwig

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


[matplotlib-devel] Building TkAgg backend without a running X server [revisited]

2007-11-29 Thread Ludwig Schwardt
Hi,

Is there any chance that the patch I submitted on 31 October on this
list could still make it into 0.91.0?

On an aside, what is the best way to submit patches to mpl? Via the
bug-tracker, or as attached files or direct in-line in mpl-devel
mails?

To refresh your memory on the patch:

I've reworked the Tcl/Tk checking code in setupext.py (see attached
patch). It is now possible to build matplotlib with Tk support without
requiring a running X server. This is useful for doing autobuilds
(e.g. as done by Debian) and for building a package on one machine to
be installed and used on another.

This seems to be an old issue... (see matplotlib-devel, "building
matplotlib without X-server connection," 11 Nov 2004)

The patch also fixes a potential hang, which happens when I try to
build the latest matplotlib on Debian Etch with Python 2.4, on a
system with libtk8.4-dev installed but no running X server. The build
should have continued without TkAgg support, but it hangs. The hang
occurs because the Tcl/Tk checking code calls Tkinter.Tk() multiple
times, which is not a good idea. In fact, just running the following
snippet hangs the interpreter in this scenario:

import Tkinter
tk = Tkinter.Tk()
tk = Tkinter.Tk()

The patch applies to setupext.py in revision r4501. I checked it with
matplotlib r4064, using Python 2.4 on Debian Etch, and Python 2.5 on
Mac OS X 10.4.10. It hasn't been checked on Python 2.3 or on
Windows.

Regards,
Ludwig


setupext.py.patch
Description: Binary data
-
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


[matplotlib-devel] Patch: allowing non-interactive plots with axes3d

2007-11-29 Thread Ludwig Schwardt
Hi,
I'm glad you liked my Tk patch! Along the same line, I patched axes3d.py to
allow the creation of non-interactive 3D plots.

Currently, the 3D axis object (matplotlib.axes3d.Axes3D) can only be created
in an interactive session (i.e. while the figure is being displayed), as it
attempts to connect mouse events during initialisation. This simple patch
removes this restriction. If you later decide to display a figure that was
created offline, you can restore mouse events by calling the following on
all axis objects in the figure:

if isinstance(axis, matplotlib.axes3d.Axes3DI):
axis.mouse_init()

Regards,
Ludwig


axes3d.py.patch
Description: Binary data
-
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Doesn't find Tcl/Tk headers on Ubuntu 8.04

2008-05-27 Thread Ludwig Schwardt
Hi,

Fernando wrote:
> The code for this path detection is obviously rather convoluted and
> brittle, since there seems to be no clear API provided by Tk for this
> information, unfortunately.

Michael wrote:
> I know the Tcl/Tk header lookup mechanism is inherently complex.
> Could someone who knows what's going on there have a look?

I last rewrote the Tcl/Tk detection routines, but did not touch
add_tk_flags(), which is definitely the grungy heart of this problem.
On that function I am unfortunately as clueless as the rest.

Jon wrote:
>  I thought you are expected to pick up the correct include directories from
>  the files tclConfig.sh and tkConfig.sh, which are found in the lib
>  directory returned from your query_tcltk function?

In response to Jon's comment: Many systems have broken t*Config.sh
scripts, for example way back on cygwin. My current Mac OS X 10.4.11
installation has the following in tkConfig.sh:

TK_PREFIX='/Users/andreask/dbn/lba/night/builds/macosx-ix86/out'

Mmmm. So exclusive use of these files are also not an option... We
need to deduce the include dir from the library dir returned by the
tk.getvar() or tcl.getvar() calls in some robust(?) way.

Regards,
Ludwig

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] new release?

2008-05-30 Thread Ludwig Schwardt
Hi,

John Hunter wrote:
>  I've done a fair amount of testing on the branch (0.91.3),
>  particularly looking at all the PDF and SVG output from backend
>  driver, and these backends are in the best shape I've ever seen them.
>  [...]
>   I think we should take a crack at fixing these since the branch is
>  otherwise in such good shape that we could perhaps go a  long time w/o
>  another  maintenance release.

Before the branches and releases are all frozen for the foreseeable
future, I might mention a minor but long-lived bug that has been
around since at least the end of 2006... Please excuse me if this is
old news, as I haven't checked the archives recently for any progress
on this. I've noticed that the bug is still around in r5314 of trunk.

On Mac OS X (both Tiger and Leopard), there is a small misalignment
between grid lines and tick marks on the standard plot (as well as
loglog and semilog) with the PS backend. I did not check which one of
the lines is in the correct place. The problem does not occur with the
PDF backend.

I attach a ps and pdf file produced by the following snippet:

import pylab as pl
pl.plot([1,2,3,4,5])
pl.grid()
pl.savefig('grid_misaligned_with_ticks.ps')
pl.savefig('grid_misaligned_with_ticks.pdf')

The pdf file is fine, but the ps file shows a misalignment. To view
this in Mac OS X, I used Preview (which converts the PS to PDF first).
To eliminate Preview as the problem, I also saved the file as an EPS
and used epstopdf from MacTeX to convert it for Preview. Viewed on
Linux with acroread, the PS file produced on the Mac also shows
misalignment (I haven't verified this recently).

The same code snippet produces no problems on Linux.

I realise this might not be a problem with matplotlib itself, but I'm
just curious if anyone picked it up and whether it is fixable before
the next release.

Thanks!
Ludwig


grid_misaligned_with_ticks.ps
Description: PostScript document


grid_misaligned_with_ticks.pdf
Description: Adobe PDF document
-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Using the Agg renderer by itself

2011-11-27 Thread Ludwig Schwardt
Hi Chris and others,


On 11/23/11 12:39 PM, Chris Barker wrote:
> On 11/23/11 10:38 AM, Benjamin Root wrote:

> 
> 

> > There is an HTML5 backend, supposedly. Don't know how well documented it 
> > is, though.
> > 
> 



> Hmm -- coll idea -- I'll look into that at some point. However, as I
> don't need the MPL machinerey, but just the renderer, I'm not sure it
> would buy me much.
> 
> And I'm not sure I can:
> 
> a) count on html 5 on all browsers we need to support
> 
> or
> 
> b) get the drawing performance I want if I have to push all the data to
> the client to draw.
> 
> But something to keep an eye on, thanks.


Ben is referring to mplh5canvas, available at 
http://code.google.com/p/mplh5canvas/. The main advantage of this approach is 
interactive zooming of plots within the browser. If this is not important to 
you, it will probably be faster to generate static PNGs or SVGs.

The HTML5 backend should be easy to try out, as it is a pure Python package 
with no onerous dependencies.

I'll try to address your concerns mentioned above:

a) The Canvas element is quite well supported in modern browsers, but the 
WebSocket component (used to communicate between the matplotlib backend 
"server" code in Python and the "client" code on the browser in JavaScript) is 
a bit trickier to support.

b) Here the matplotlib machinery actually helps, by reducing the primitives to 
draw via path simplification before sending them to the client browser.

We have also used flot (http://code.google.com/p/flot/) for simple time-series 
plots without matplotlib. I'm not sure how well it performs on large data sets, 
though.

Regards,
Ludwig

--
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Suggestion for setupext.py darwin changes

2012-03-03 Thread Ludwig Schwardt
Hi Russell,

> At present all people buliding matplotlib on Mac OS X must edit 
> setupext.py. I have modified setupext.py to make it work with Mac OS X 
> ("darwin") for Apple's python, python.org (http://python.org) python and 
> presumably Homebrew 
> python (since that uses /usr/local).
> 
> 


I've never actually edited setupext.py in order to build matplotlib using 
Apple's python, and it has never been a problem for me. I guess it's because 
system python uses the standard include locations (unlike fink and macports).

Regards,
Ludwig

--
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Matplotlib Qt4Agg backend ignores 'resize_event'

2012-08-01 Thread Ludwig Schwardt
Hi, 

I've noticed the same problem on the MacOSX backend recently (TkAgg works fine 
on OS X though). I assumed that it would be more than a one-line fix, therefore 
I did not look into it further. It would be great if your solution worked for 
MacOSX too!

Regards,
Ludwig

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


[matplotlib-devel] Missing 1.1.1 tarball on PyPI

2012-08-24 Thread Ludwig Schwardt
Hi,  

There does not seem to be an actual tarball of matplotlib 1.1.1 on PyPI at 
http://pypi.python.org/pypi/matplotlib/1.1.1 … Maybe I'm the only person who 
still likes to easy_install my matplotlib :-)

L.  

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Missing 1.1.1 tarball on PyPI

2012-08-24 Thread Ludwig Schwardt
Hi Mike and Damon,
> It seems to finally be uploaded correctly, and "pip install matplotlib"
> is working for me. Can you please confirm?
> 
> 

It works, thanks!

> OP mentioned easy_install. Is there a difference between this and pip?
> 
> 


Depends on who you ask :-) I used to hate pip in the pre-1.0 days and used 
easy_install instead, but now I've mostly moved over to pip. They are pretty 
similar nowadays and I still mix up my terminology...

Regards,
Ludwig

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] [IPython-dev] Interactive Matplotlib in the browser

2012-10-12 Thread Ludwig Schwardt
Exciting stuff!

The latency would be an important factor for the user experience, but this 
neatly sidesteps a lot of the JS issues. This would keep the main matplotlib 
machinery on the Python side, which is great.

We could still do simple high-speed annotations requiring very low latency such 
as cursors or selection rectangles on the JS side. I therefore don't foresee 
the requirement of sending hundreds or thousands of PNGs during e.g. a simple 
zoom (smooth resizing might be more intensive...).

Ironically, one of the motivations for the mplh5canvas backend is also to send 
*less* data over the network, as matplotlib's path simplification would 
effectively compress large data sets. However, path simplification does not yet 
apply to scatter plots, an important use case for us (although there are ways 
to implement that with clustering algorithms).

Obviously, a large number of vector operations could still end up being more 
data than a PNG file, where this idea will work better. I'm very keen to see 
how this pans out!

Regards,
Ludwig


--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] 1.3.0 final tagged and uploaded

2013-08-01 Thread Ludwig Schwardt
 Hi Russell (and Mike),

Is it useful in the long term to have such a packager? My impression is
that as soon as packaging is more robust we'll switch to using pip or
easy_install.

First off, sorry for the long email - got a bit carried away :-) The
summary is that I propose we keep the dmg installer but maybe make it use
the system Python for reasons illustrated below.

For the record, I'm using pip / easy_install to install matplotlib from
source on my Mac and that has been working fine for a while now. You only
need to add pkg-config (and the development tools, obviously) to a virgin
Mac system and this is now really easy in the days of Homebrew.

Of course, binary packages have the extra issue of a dependency on the
environment for which it is built, which complicates matters for binary
eggs (thanks for the reminder of wheel, Mike - definitely something to
watch). This is the main reason why I don't use the Mac installer dmg: it's
built for python.org Python and I prefer to use system Python instead.

(On this note, it would be interesting to find out how matplotlib people
get Python on their Mac these days. My gut feel tells me that Homebrew
Python will be quite popular these days, followed by EPD / Anaconda and
then maybe python.org Python. If you use Homebrew there is now the option
of "brew install matplotlib" courtesy of Samuel
John,
while EPD and Anaconda ship with their own versions of matplotlib, so most
of those users are taken care of.)

To answer your original question: I do see a use for a dmg installer in the
long term, but one you might not have considered. I picture a Mac user who
is not familiar with Python but wants to try out matplotlib (the image of
Justin Long saying "Hello, I'm a Mac" somehow comes to mind :-)).

Justin has never heard of easy_install or even a compiler and might not be
that comfortable with the Terminal. On the other hand, he is used to
installing software by downloading and clicking on a dmg or via the App
Store. This is a person who is starting out with these tools and needs as
few obstacles as possible to get going. Once he is up and running and likes
what he sees, he might be persuaded to install a more full-fledged Python
distribution or the rest of the SciPy stack.

As an experiment I put myself in the shoes of Justin. I actually did the
steps below on a spare MacBook Pro running Mac OS X 10.7.5 that was
unsullied by extra Pythons and rogue matplotlibs and what not.



Someone told me about "matplotlib" (maybe after seeing a plot in a talk or
a paper) which led me to matplotlib.org (first Google hit).

I see "Download" and go to the downloads
page.
I see a bunch of links, including these two under "Latest stable version":

matplotlib-1.2.1-py2.7-python.org-macosx10.3.dmg
matplotlib-1.2.1-py2.7-python.org-macosx10.6.dmg

Since I am on Lion I guess I have to download the latter (although the fact
that it says 10.6 and not 10.7 worries me…). I'm not sure what the rest of
the filename means - what is py27-python.org? I download the dmg and open
it. I am impatient like most users and click on "Continue".

Oops, there is a problem. The third "Continue" button is grayed out with an
error that says: "matplotlib 1.2.1 can't be installed on this disk.
matplotlib requires System Python 2.7 to install." [This is ironic because,
unbeknownst to Justin, he actually *has* System Python 2.7 installed…] Time
to click on "Go Back"… Aah, Important Information (I kick myself for not
reading this): "matplotlib for MacOS X 10.6 or later [cool!] and 64-bit
Python 2.7 from python.org (not Apple's built-in Python)". So that's
probably what py2.7-python.org refers to. If Justin is patient enough he
might also spot the following line: "Before running matplotlib, you must
install numpy."

[Clicking "Go Back" would have been the more useful thing to do in this
case. If I had decided to return to matplotlib.org, I might have seen "Need
help?" and clicked on the "faq" link and ended up at the OS-X
Notes.
This mentions "several alternative versions of python" such as EPD,
MacPython (yikes, Leopard only!) or python.org. But the installer only
works with the latter… Surprisingly enough I could not find *any* explicit
mention in the matplotlib installation docs that you need to install NumPy
first. EDIT: Oh wait, it's well documented
here but
I can only reach this important page by clicking on "docs" in the toolbar
below the page title and spotting the "Installing" link. Maybe the
"Download" section on the front page should read "Read the installation
instructions  first and then
visit the matplotlib downloads page 
."]

Time to visit python.org. I see "Download" and then notice "Python 2.7.5
Ma

Re: [matplotlib-devel] 1.3.0 final tagged and uploaded

2013-08-02 Thread Ludwig Schwardt
Oops,  

I noticed that my lengthy previous email lost the quotes around Russell's 
comment at the start. It should begin with:

> Is it useful in the long term to have such a packager? My impression is
> that as soon as packaging is more robust we'll switch to using pip or
> easy_install.


Hope that's less confusing…

L.

--
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel