[Matplotlib-users] Multiple Projections On Same Axes

2015-06-29 Thread T J
When I read the transformations documentation:

http://matplotlib.org/devel/add_new_projection.html#creating-a-new-projection

it seems like each projection is tied to an Axes instance.  How might I go
about plotting two different projections on the same axes? Let's just
assume that the actual axes each projection draws is exactly same and all
that differs between to the two is how data is mapped to axis coordinates.
--
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Multiple Projections On Same Axes

2015-06-30 Thread T J
Ok, sounds like I'll have to copy what those do, as I'm not planning on
working with Cartesian or even curvilinear coordinates.

On Tue, Jun 30, 2015 at 11:36 AM, Benjamin Root  wrote:

> twinx()/twiny() I think is your best bet. It isn't a fully generic
> solution, but I think it addresses most needs.
>
> Ben Root
>
> On Mon, Jun 29, 2015 at 6:00 PM, T J  wrote:
>
>> When I read the transformations documentation:
>>
>>
>> http://matplotlib.org/devel/add_new_projection.html#creating-a-new-projection
>>
>> it seems like each projection is tied to an Axes instance.  How might I
>> go about plotting two different projections on the same axes? Let's just
>> assume that the actual axes each projection draws is exactly same and all
>> that differs between to the two is how data is mapped to axis coordinates.
>>
>>
>>
>>
>> --
>> Don't Limit Your Business. Reach for the Cloud.
>> GigeNET's Cloud Solutions provide you with the tools and support that
>> you need to offload your IT needs and focus on growing your business.
>> Configured For All Businesses. Start Your Cloud Today.
>> https://www.gigenetcloud.com/
>> ___
>> Matplotlib-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
--
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Pluggable Backends

2009-07-08 Thread T J
Are matplotlib backends pluggable?  That is, can package X provide an
experimental backend and tell matplotlib to use it?  If so, how?

--
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Interpolation between points during plot()

2010-02-12 Thread T J
Hi,

When plotting,

plot(x, y, marker="-")

and its similar markers, what functionality in MPL is responsible for
interpolating between the points?  My naive guess is that
interpolation is done in "display" coordinates since everything looks
nice even when zooming in.I inquire because I'd like to make
interpolation between two points follow some other path between the
two points.  In other words, I'd like to make a plot structure which
will follow a different type of geodesic.  Any tips or pointers in the
right direction would be greatly appreciated.

Thanks!

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] half-filled markers, two-colors

2010-02-14 Thread T J
I ran across:

http://old.nabble.com/half-filled-markers-td24003576.html

The name "fillstyle" can give the wrong impression about what is being
filled.  For example, see the comment here:

   
http://www.mail-archive.com/[email protected]/msg13074.html

It's probably too late, but would "markerfillstyle" be a better name for this?

Also, the current implementation fills half of the marker with the
markerfacecolor and doesn't fill the marker at all for the other half.
 I think a neat (and simple) feature would be for users to specify two
colors.  Perhaps 'markerfacecolor2'.   The change to the code is
minimal, but the functionality it brings is quite flexible.
markerfacecolor2 can default to 'none' to maintain current
functionality.

Should I file a ticket for this?

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] half-filled markers, two-colors

2010-02-15 Thread T J
On Mon, Feb 15, 2010 at 5:22 PM, John Hunter  wrote:
> Very nice and thorough work.  I think this should be included, but
> I'll wait to hear from other developers before committing.  Could you
> confirm that the unit tests pass?
>
 import matplotlib
 matplotlib.test()
>

Confirmed on rev 8133:

Ran 124 tests in 341.585s

FAILED (KNOWNFAIL=2, errors=2)

and the errors were something to do with hexbin extents and the figimage method.


> I think the markerangle would also be a useful contribution, though it
> would render some of the markers redundant (eg triangle left, right,
> etc, would all just be triangles with different angles...)
>

That was a concern I had as well, but I suppose > ^ v < (etc) could
just be considered shortcuts to particular angles.  Presumably, we
would not be removing them.  Correct?  Also, is the standard to have
the angle specified in degrees?  So what is more useful:  markerangle
or markerdeg?

The other difference is that when one specifies fillstyle='left', then
it would only apply to the marker at 0 degrees.  Whereas, marker='v',
fillstyle='left', markerangle=0  would correspond to marker='^',
fillstyle='right', markerangle=180   (or something like that).

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Trouble gridding irregularly spaced data

2010-02-15 Thread T J
Hi,

I'm trying to grid irregularly spaced data, such that the convex hull
of the data is not rectangular.  Specifically, all my data lies in an
equilateral triangle inside the unit circle.  I found:

 http://www.scipy.org/Cookbook/Matplotlib/Gridding_irregularly_spaced_data

and tried the suggested technique.  For my grid, I made a square of
the min and max of my data.  However, it had problems:

...
  File 
"/home/guest/.local/lib/python2.6/site-packages/matplotlib/delaunay/triangulate.py",
line 125, in _compute_convex_hull
hull.append(edges.pop(hull[-1]))
KeyError: 0


Should I expect matplotlib.mlab.griddata to work with a dataset like
this?  I know that I can use hexbin, but it'd be really nice to see
contours explicitly.

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] DateFormatter + Latex issue

2010-02-17 Thread T J
On Tue, Feb 16, 2010 at 2:03 PM, Jae-Joon Lee  wrote:
> If what you want is to have more padding for the major tick labels, I
> recommend you to use
>
> rcParams['xtick.major.pad'] = 20
>
> If you don't like to change the global setting, you may set the
> ticklabel padding for an specific axis. Try
>
> for tck in ax.xaxis.get_major_ticks():
>    tck.set_pad(20)
>    tck.label1 = tck._get_text1()
>
> Regards,
>
> -JJ
>

Wow. This is really useful and perhaps, should be placed in a wiki
somewhere.  Is this a common enough task to warrant a method?

   ax.xaxis.repad_ticks(20)

Being unfamiliar with the Tick class, I wouldn't have expected that it
would have been necessary to reassign label1 (after setting the pad
size).

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Transparent figures no longer working

2010-04-25 Thread T J
Not sure when this occurred, but I just updated to the latest SVN and
still see the issue:
   I am no longer able to save transparent figure---specifically, I
need no patch drawn for the figure and axis when saving to EPS.

>>> savefig('test.eps', transparent=True)

The above should work, but it doesn't..  Explicitly setting the patch
colors to 'none' doesn't work either.

Anyone else seeing this?

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


Re: [Matplotlib-users] Transparent figures no longer working

2010-04-26 Thread T J
On Mon, Apr 26, 2010 at 12:01 PM, Jae-Joon Lee  wrote:
> Looking at the code, the "transparent" option set alphas of paches to
> 0, which I think is simply ignored in ps backend (which does not
> support alpha). I think it is better if the visibility of patches is
> set to False when the "transparent" option is set.
>

Or both.

> Setting patch's (face) color to "none" work for me. If it does not
> work, please post a complete script.
>

Attached. But I'm not doing anything fancy.  I've also attached the
EPS along with a TEX document.
import matplotlib
import matplotlib.pyplot as plt

ax = plt.gca()
f = ax.figure

ax.plot(range(10))
ax.set_axis_bgcolor('none')
f.set_facecolor('none')
f.savefig('transeps.eps')




transeps.eps
Description: PostScript document


transeps.tex
Description: TeX document
--
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Transparent figures no longer working

2010-04-28 Thread T J
On Mon, Apr 26, 2010 at 12:28 PM, T J  wrote:
> On Mon, Apr 26, 2010 at 12:01 PM, Jae-Joon Lee  wrote:
>> Looking at the code, the "transparent" option set alphas of paches to
>> 0, which I think is simply ignored in ps backend (which does not
>> support alpha). I think it is better if the visibility of patches is
>> set to False when the "transparent" option is set.
>>
>
> Attached. But I'm not doing anything fancy.  I've also attached the
> EPS along with a TEX document.
>


Has anyone been able to reproduce this?  If not, it suggests a local
problem for me. I am still interested in figuring it out, but I could
use some pointers.

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


Re: [Matplotlib-users] Transparent figures no longer working

2010-04-30 Thread T J
On Wed, Apr 28, 2010 at 12:22 PM, Eric Firing  wrote:
>
> It's a bug, made more confusing by the trickery that is done when printing a
> figure.  DPI, facecolor, and edgecolor that are set for a figure object are
> used only for screen display, and are overridden when the figure is saved.
>  The overriding values can be supplied to the savefig call or via rcParams.
>
> I think I have fixed the bug in svn, so that "transparent" will work as
> advertised.  In addition, I made a change so that even with
> transparent=True, if you supply facecolor and/or edgecolor to the savefig
> call, those values should be used for the figure patch when the figure is
> saved.  This might be useful if you want to keep the line around the figure,
> for example.
>

This still does not work for me.  I dug around a bit and found an
issue.  Figure.savefig() sets the 'edgecolor' and 'facecolor' of the
axis patches but delegates the patches of the figure to the actual
print command.  It does this by setting the edgecolor and facecolor
values in the kwargs dict.  However, self.canvas.print_figure()
expects edgecolor and facecolor as args, not kwargs.  So
print_figure() uses the default value: 'w' instead of 'none'.  This is
a bit inconsistent, it seems, especially b/c the PS backend  (which is
called after print_figure()) expects facecolor and edgecolor as
kwargs.

I went ahead and changed this, hoping it'd fix the issue, but it does
not.  At least now, I can see that the edgecolor and facecolor are
both set to 'none' all the way until self.figure.draw(renderer) is
called.  So somehow, the draw() command is unaffected by this still.

What next?

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


Re: [Matplotlib-users] Transparent figures no longer working

2010-04-30 Thread T J
On Fri, Apr 30, 2010 at 1:55 AM, Eric Firing  wrote:
>
> I don't see this in the version as I changed it in svn r8282.  Are you sure
> you installed and built from svn after I made the change?  Using the
> attached script,  I get the two attached (gzipped) eps files. The first with
> transparent=True, has no fill operations other than for generation of the
> glyphs; the second differs from the first in having two extra fill
> operations, one for the axes patch, the other for the figure patch.
>

It looks like I messed up my install.  On top of that, when I was
testing this second time, I was not bothering to create the ps (from
latex) and just using my OS's default EPS viewer to verify that
transparency was working---the problem was that Evince displays images
on a white background rather than on some distinguishing background to
let me know that it is a transparent image.  Sorry for the noise, its
definitely working in r8282.

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


[Matplotlib-users] pstricks backend?

2008-06-09 Thread T J
Hi,

I use pstricks frequently, and it has provided an alpha channel
(provided we eventually use ps2pdf).  With matplotlib, when I save to
eps, I lose all transparency (understandable), but I wonder if it is
possible to export the picture as a bunch of pstricks commands, which,
after using ps2pdf, would give transparency.

Yes, I am aware of pdflatex which supports pdf, but I need pstricks
(and I haven't yet explored pst-pdf).  Either way, a pstricks-backend
would be quite nice! Is this feasible?

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Consist Symbols/Sizes between Plot/Scatter

2008-06-12 Thread T J
I am making a scatter plot and want the legend to display the symbols.
 This functionality doesn't seem to exist, so I have followed the
workaround outlined here:

http://www.nabble.com/Legend-for-a-scatter-plot-based-on-symbols-td17554839.html#a17554839

Are there any plans to make the symbols which are available in plot()
the same as those available for scatter()?  If not, can we at least
get the diamond symbol the same?  I want to pass the same symbol to
plot() and scatter() and get the same symbol---as it is, I must use
'd' in scatter and 'D' in plot.

Also, how are the markersizes scaled? For example, in scatter(), I am
using s=30...but if I do plot(...,markersize=30), then the markers are
not the same size as the markers from the scatter plot.  I can go back
and forth until the scale is right, but is there a better way?

Thanks.

-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] All CM fonts

2009-01-12 Thread T J
Hi, my matplotlibrc file is:

backend : GTKAgg
text.usetex : True
text.latex.preview : True
ps.usedistiller : xpdf

However, when I create images, regular text is not in the CM font.
When checking the fonts in a pdf viewer, I get:

CM12, Type 1, Embedded
NimbusSanL-Regu, Type 1, Embedded

So it looks as if the plot title, for example, is getting Nimbus
rather than CM.  What is the 'proper' way to get all the fonts to
match my document?  Using:

title(r'$\textrm{title}$')

results in a different font (but still not what I was expecting):
CenturySchL-Roma  Below is the output of rcParams.

Thanks.


{'agg.path.chunksize': 0,
 'axes.axisbelow': False,
 'axes.edgecolor': 'k',
 'axes.facecolor': 'w',
 'axes.formatter.limits': [-7, 7],
 'axes.grid': False,
 'axes.hold': True,
 'axes.labelcolor': 'k',
 'axes.labelsize': 'medium',
 'axes.linewidth': 1.0,
 'axes.titlesize': 'large',
 'axes.unicode_minus': True,
 'backend': 'GTKAgg',
 'backend_fallback': True,
 'cairo.format': 'png',
 'contour.negative_linestyle': 'dashed',
 'datapath': '/usr/local/lib/python2.5/site-packages/matplotlib/mpl-data',
 'docstring.hardcopy': False,
 'figure.autolayout': False,
 'figure.dpi': 80,
 'figure.edgecolor': 'w',
 'figure.facecolor': '0.75',
 'figure.figsize': [8.0, 6.0],
 'figure.subplot.bottom': 0.10001,
 'figure.subplot.hspace': 0.20001,
 'figure.subplot.left': 0.125,
 'figure.subplot.right': 0.90002,
 'figure.subplot.top': 0.90002,
 'figure.subplot.wspace': 0.20001,
 'font.cursive': ['Apple Chancery',
  'Textile',
  'Zapf Chancery',
  'Sand',
  'cursive'],
 'font.family': 'sans-serif',
 'font.fantasy': ['Comic Sans MS',
  'Chicago',
  'Charcoal',
  'ImpactWestern',
  'fantasy'],
 'font.monospace': ['Bitstream Vera Sans Mono',
'DejaVu Sans Mono',
'Andale Mono',
'Nimbus Mono L',
'Courier New',
'Courier',
'Fixed',
'Terminal',
'monospace'],
 'font.sans-serif': ['Bitstream Vera Sans',
 'DejaVu Sans',
 'Lucida Grande',
 'Verdana',
 'Geneva',
 'Lucid',
 'Arial',
 'Helvetica',
 'Avant Garde',
 'sans-serif'],
 'font.serif': ['Bitstream Vera Serif',
'DejaVu Serif',
'New Century Schoolbook',
'Century Schoolbook L',
'Utopia',
'ITC Bookman',
'Bookman',
'Nimbus Roman No9 L',
'Times New Roman',
'Times',
'Palatino',
'Charter',
'serif'],
 'font.size': 12.0,
 'font.stretch': 'normal',
 'font.style': 'normal',
 'font.variant': 'normal',
 'font.weight': 'normal',
 'grid.color': 'k',
 'grid.linestyle': ':',
 'grid.linewidth': 0.5,
 'image.aspect': 'equal',
 'image.cmap': 'jet',
 'image.interpolation': 'bilinear',
 'image.lut': 256,
 'image.origin': 'upper',
 'image.resample': False,
 'interactive': True,
 'legend.borderaxespad': 0.5,
 'legend.borderpad': 0.40002,
 'legend.columnspacing': 2.0,
 'legend.fancybox': False,
 'legend.fontsize': 'large',
 'legend.handlelength': 2.0,
 'legend.handletextpad': 0.80004,
 'legend.isaxes': True,
 'legend.labelspacing': 0.5,
 'legend.loc': 'upper right',
 'legend.markerscale': 1.0,
 'legend.numpoints': 2,
 'legend.shadow': False,
 'lines.antialiased': True,
 'lines.color': 'b',
 'lines.dash_capstyle': 'butt',
 'lines.dash_joinstyle': 'miter',
 'lines.linestyle': '-',
 'lines.linewidth': 1.0,
 'lines.marker': 'None',
 'lines.markeredgewidth': 0.5,
 'lines.markersize': 6,
 'lines.solid_capstyle': 'projecting',
 'lines.solid_joinstyle': 'miter',
 'maskedarray': 'obsolete',
 'mathtext.bf': 'serif:bold',
 'mathtext.cal': 'cursive',
 'mathtext.default': 'it',
 'mathtext.fallback_to_cm': True,
 'mathtext.fontset': 'cm',
 'mathtext.it': 'serif:italic',
 'mathtext.rm': 'serif',
 'mathtext.sf': 'sans\\-serif',
 'mathtext.tt': 'monospace',
 'numerix': 'numpy',
 'patch.antialiased': True,
 'patch.edgecolor': 'k',
 'patch.facecolor': 'b',
 'patch.linewidth': 1.0,
 'path.simplify': True,
 'pdf.compression': 6,
 'pdf.fonttype': 3,
 'pdf.inheritcolor': False,
 'pdf.use14corefonts': False,
 'plugins.directory': '.matplotlib_plugins',
 'polaraxes.grid': True,
 'ps.distiller.res': 6000,
 'ps.fonttype': 3,
 'ps.papersize': 'letter',
 'ps.useafm': False,
 'ps.usedistiller': 'xpdf',
 'savefig.dpi': 100,
 'savefig.edgecolor': 'w',
 'savefig.facecolor': 'w',
 'savefig.orientation': 'portrait',
 'svg.embed_char_paths': True,
 'svg.image_inline': True,
 'svg.image_noscale': False,
 'text.color': 'k',
 

[Matplotlib-users] fill_between

2009-04-30 Thread T J
Fill between is for filling between two y-values over a range of
x-values.  Is there anything which fills between to x-values over a
range of y-values?

--
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Missing Segments in Output of imshow()

2012-02-08 Thread T J
Hi,

I am experiencing missing "segments" in the output of imshow().  I draw a
slowly growing line in an array, and then display it.  The line is
continuous but in the output, there are segments missing from it.  Of
course, if I zoom into the picture (before saving to output), then I can
see the lines.  However, if I save directly to a file then the segments are
missing.

Here is a minimal example:

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

N = 600
slope = 15
x = np.zeros((N,N))
j = np.arange(N)
i = N/2 - j/slope
for idx in zip(i,j):
x[idx] = 1

plt.imshow(x, interpolation='nearest', cmap=plt.cm.gray_r)
plt.savefig('bug.pdf')
plt.savefig('bug.png')
"""

I have attached an example of the output.  In theory, there should be a
continuous line from the left side of the picture to the right side.  The
problem seems to occur across backends.  Additionally, the thickness of the
segments is not uniform.  Some are thinner than the rest.   Decreasing the
value of N seems to make the issue go away.  Increasing the value of N
makes the problem worse.

Any ideas on what is going on and how I can fix it?


bug.pdf
Description: Adobe PDF document
--
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-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Clipping Contours

2012-10-16 Thread T J
I'm interested in clipping the result of plt.contour (and
plt.contourf) to a patch.  However, QuadContourSet does not have a
set_clip_path() method.  Is there a way to do this?

Here is an example plot that I have generated.

   http://imgur.com/pybIf

For the curious, it plots contours of a function on the 2-simplex.
The way I've gone about computing this is, unfortunately, convoluted.
I generate a regular grid in 2D and treat each point as a projection
of a 3D probability vector into 2D.  Then, I invert the projection so
that I have "distributions" and then compute the Z value for each
point.  The contours are then calculated, but now, I need to clip
everything outside the triangle, as only points within the triangle
correspond to actual distributions.

Is there a more direct way to calculate contours on a restricted set?

Thanks.

--
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-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Clipping Contours

2012-10-16 Thread T J
On Tue, Oct 16, 2012 at 2:34 AM, Damon McDougall
 wrote:
> On Tue, Oct 16, 2012 at 8:04 AM, T J  wrote:
>> I'm interested in clipping the result of plt.contour (and
>> plt.contourf) to a patch.  However, QuadContourSet does not have a
>> set_clip_path() method.  Is there a way to do this?
>>
>> Here is an example plot that I have generated.
>>
>>http://imgur.com/pybIf
>>
>> For the curious, it plots contours of a function on the 2-simplex.
>> The way I've gone about computing this is, unfortunately, convoluted.
>> I generate a regular grid in 2D and treat each point as a projection
>> of a 3D probability vector into 2D.  Then, I invert the projection so
>> that I have "distributions" and then compute the Z value for each
>> point.  The contours are then calculated, but now, I need to clip
>> everything outside the triangle, as only points within the triangle
>> correspond to actual distributions.
>>
>> Is there a more direct way to calculate contours on a restricted set?
>>
>> Thanks.
>
> The contour functions support masked regions. I think that might be
> what you're looking for. Since the region you want to mask is a
> triangle, maybe even use a masked triangulated contour plot? Here's
> the call signature:
> http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.tricontour
>
> Does that help?
>

Yes, that looks to be exactly what I am looking for.  Note, the mask
kwarg is barely mentioned in that docstring, but I think I get it.
However, I am having some trouble.  tricontour seems to fail when
computing the Triangulation() object.  Here is my code:

http://codepad.org/cVB7YP9r

This is a set of 152 points on a triangle.  delaunay is mentioned to
have problems for some pathological cases.  Is a complete triangular
grid considered as such a case?

Code is shown below as well.



import numpy as np
import matplotlib.pyplot as plt

points = np.array([
 [0.8660254037844384, -0.5004],
 [0.7577722283113836, -0.5004],
 [0.6495190528383288, -0.5003],
 [0.5412658773652739, -0.5003],
 [0.4330127018922191, -0.5002],
 [0.3247595264191642, -0.5002],
 [0.21650635094610943, -0.5002],
 [0.10825317547305463, -0.5001],
 [-2.220446049250313e-16, -0.5001],
 [-0.10825317547305507, -0.5],
 [-0.21650635094610993, -0.5],
 [-0.32475952641916467, -0.5],
 [-0.4330127018922195, -0.4999],
 [-0.5412658773652743, -0.4999],
 [-0.6495190528383291, -0.49983],
 [-0.7577722283113839, -0.4998],
 [-0.8660254037844388, -0.4997],
 [0.811898816047911, -0.406250044],
 [0.7036456405748561, -0.40625004],
 [0.5953924651018013, -0.406250033],
 [0.48713928962874653, -0.40625003],
 [0.3788861141556917, -0.40625002],
 [0.2706329386826369, -0.40625002],
 [0.16237976320958203, -0.40625001],
 [0.05412658773652723, -0.40625001],
 [-0.05412658773652762, -0.406250006],
 [-0.16237976320958242, -0.40625],
 [-0.2706329386826372, -0.40625],
 [-0.37888611415569207, -0.406249994],
 [-0.4871392896287469, -0.40624999],
 [-0.5953924651018018, -0.406249983],
 [-0.7036456405748566, -0.40624998],
 [-0.8118988160479114, -0.40624997],
 [0.7577722283113836, -0.31250004],
 [0.6495190528383288, -0.312500033],
 [0.541265877365274, -0.312500033],
 [0.4330127018922191, -0.31250002],
 [0.3247595264191643, -0.31250002],
 [0.21650635094610948, -0.312500017],
 [0.10825317547305463, -0.31250001],
 [-1.6653345369377348e-16, -0.31256],
 [-0.10825317547305502, -0.3125],
 [-0.21650635094610982, -0.3125],
 [-0.3247595264191646, -0.31244],
 [-0.43301270189221946, -0.3124],
 [-0.5412658773652743, -0.312499983],
 [-0.6495190528383292, -0.31249998],
 [-0.7577722283113839, -0.31249998],
 [0.7036456405748562, -0.218750036],
 [0.5953924651018013, -0.21875003],
 [0.48713928962874653, -0.218750028],
 [0.37888611415569173, -0.218750022],
 [0.2706329386826369, -0.218750017],
 [0.16237976320958208, -0.218750014],
 [0.05412658773652723, -0.218750008],
 [-0.054126587736527565, -0.218750006],
 [-0.16237976320958242, -0.21875],
 [-0.2706329386826372, -0.218749994],
 [-0.378886114155692, -0.218749992],
 [-0.48713928962874686, -0.218749986],
 [-0.5953924651018017, -0.21874998],
 [-0.7036456405748566, -0.218749978],
 [0.6495190528383288, -0.12533],
 [0.541265877365274, -0.12528],
 [0.43301270189221913, -0.12525],
 [0.32475952641916433, -0.1252],
 [0.21650635094

[Matplotlib-users] Finding fonts

2010-05-26 Thread T J
When I plot, I get:

UserWarning: findfont: Font family ['sans-serif'] not found. Falling
back to Bitstream Vera Sans
  (prop.get_family(), self.defaultFamily[fontext]))

My matplotlibrc file has:

font.sans-serif: Computer Modern Sans Serif
font.serif:  Computer Modern Roman
font.monospace:  Computer Modern Typewriter

Have I typed these names incorrectly?  I recently (two days ago)
upgraded to the latest SVN of matplotlib and that is when the warning
started appearing.  I have a working TeXLive distribution in linux, so
the fonts should exist on my computer.

--

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


Re: [Matplotlib-users] Finding fonts

2010-05-26 Thread T J
On Wed, May 26, 2010 at 4:20 PM, Michael Droettboom  wrote:
> On 05/26/2010 04:47 PM, T J wrote:
>> When I plot, I get:
>>
>> UserWarning: findfont: Font family ['sans-serif'] not found. Falling
>> back to Bitstream Vera Sans
>>    (prop.get_family(), self.defaultFamily[fontext]))
>>
>> My matplotlibrc file has:
>>
>> font.sans-serif: Computer Modern Sans Serif
>> font.serif:      Computer Modern Roman
>> font.monospace:  Computer Modern Typewriter
>>
>> Have I typed these names incorrectly?  I recently (two days ago)
>> upgraded to the latest SVN of matplotlib and that is when the warning
>> started appearing.  I have a working TeXLive distribution in linux, so
>> the fonts should exist on my computer.
>>
> The warning was recently introduced in SVN, but the behaviour shouldn't
> have changed -- it's just a little more "in your face" now that
> something may not be what you expect.
>
> TeXLive doesn't usually install Truetype versions of the Computer Modern
> fonts.  You can use the Computer Modern Bakoma fonts that come with
> matplotlib by using "cmr10", "cmss10" etc. (see mpl-data/fonts/ttf for a
> list of the available ones), or for fonts that are a little more
> friendly and have standard unicode character points, you may want to
> install these:
>
> http://cm-unicode.sourceforge.net/
>
> Or, you can side-step all this and set the rcParam "text.usetex" to
> True, which will render all the text in the plot with TeX itself.
>
> Mike
>

Hmm...this is partly why I was confused in the first place.  I
originally included the above lines in my matplotlibrc file because my
generated PDFs did not have all CM fonts, despite my text.usetex being
set to True.


http://www.mail-archive.com/[email protected]/msg09852.html

The recommendation there was that setting the various font.* rcParams
would fix this issue.  And indeed, it did.  After specifying the
fonts, my PDFs only included CM fonts.

Even now, my PDFs only contain CM fonts. So it seems that this is a
"useless" warning in the sense that findfont() is complaining about a
situation that won't manifest b/c text.usetex is True.  Have I
understood this correctly?

--

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


[Matplotlib-users] interpolation and colormaps, over and under colors

2010-05-27 Thread T J
Hi,

I am plotting with imshow() and interpolation is turned on
('gaussian').  Part of my issue is that the distribution of values is
such that I need to set the over/under colors to grab the most
relevant values.  If I set the over color to be the "maximum" color,
then the result is too dark.  Conversely for the under color.  I can
set the over/under colors to not draw, but then I have "holes" in my
image.  Is it possible to incorporate interpolation?  That is, I would
like to set my over color to be interpolated among its neighboring
cells.  This seems like it would require an (more) "intelligent"
colormap, so my guess is that this isn't currently supported.  I'm
growing more comfortable with the mpl internals and might give a stab
at implementing this, but I'm not quite sure where to start.

Thanks in advance.

--

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


Re: [Matplotlib-users] interpolation and colormaps, over and under colors

2010-05-27 Thread T J
On Thu, May 27, 2010 at 3:23 PM, Eric Firing  wrote:
>
> I'm not sure I understand the problem; could you provide a tiny example
> to illustrate?
>

Sure, let me focus just on the interpolation and I'll leave the
filtering issue out.

In the script below, I plot a 3x3 array with the center element having
an "over" value.  In the default case, because its value is over, the
colormap will assign it the maximum color.  I also plot the case when
the "over" color is explicitly set to the minimum color and also to
white.  What I want is this:

   The center element should be an equal mixture of the 4 elements around it.

This is partially achieved with "white" (and I suppose I could pick
"grey" or "black"), but I think it might be nicer if it were a pure
mixture, rather than a mixture of the surrounding colors and the
"over" color.

The script is attached below.  Sorry it is a bit long, but I needed a
discrete colormap.  Can we get cmap_discrete() into matplotlib?

--

import matplotlib.pyplot as plt
import matplotlib.colors

import numpy as np
from scipy import interpolate

 http://www.scipy.org/Cookbook/Matplotlib/ColormapTransformations
 Can this be added to matplotlib?
def cmap_discretize(cmap, N):
"""Return a discrete colormap from the continuous colormap cmap.

cmap: colormap instance, eg. cm.jet.
N: Number of colors.

Example
x = resize(arange(100), (5,100))
djet = cmap_discretize(cm.jet, 5)
imshow(x, cmap=djet)
"""

cdict = cmap._segmentdata.copy()
# N colors
colors_i = np.linspace(0,1.,N)
# N+1 indices
indices = np.linspace(0,1.,N+1)
for key in ('red','green','blue'):
# Find the N colors
D = np.array(cdict[key])
I = interpolate.interp1d(D[:,0], D[:,1])
colors = I(colors_i)
# Place these colors at the correct indices.
A = np.zeros((N+1,3), float)
A[:,0] = indices
A[1:,1] = colors
A[:-1,2] = colors
# Create a tuple for the dictionary.
L = []
for l in A:
L.append(tuple(l))
cdict[key] = tuple(L)
# Return colormap object.
return matplotlib.colors.LinearSegmentedColormap('colormap',cdict,1024)

def draw(m, cm, norm, ncolors):
ax = plt.gca()
ai = ax.imshow(m, cmap=cm, norm=norm, interpolation='gaussian')
cb = ax.figure.colorbar(ai)
cb.set_ticks(np.linspace(.5, ncolors-.5, ncolors))
cb.set_ticklabels(['$%s$' % (i,) for i in np.arange(ncolors)])
return ai, cb

if __name__ == '__main__':
ncolors = 4
norm = plt.Normalize(vmax=ncolors)
m = np.array([[0,  0, 1],
  [3, 10, 1],
  [3,  2, 2]])

for over in [None, 'min', (1,1,1,1)]:
f = plt.figure()
cm = cmap_discretize(plt.cm.jet, ncolors)
if over == 'min':
cm.set_over(cm(0.0))
elif over is not None:
cm.set_over(over)
ai, cb = draw(m, cm, norm, ncolors)

plt.show()

--

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


Re: [Matplotlib-users] interpolation and colormaps, over and under colors

2010-05-28 Thread T J
On Thu, May 27, 2010 at 5:44 PM, Eric Firing  wrote:
> You can't do this via any manipulation of the colormap, or any fancier
> colormap specification--instead, you have to manipulate the data value.  For
> example, you could identify the "over" values in your data, and then use 2-D
> interpolation to replace them with the values you want.
>
> Basemap includes a 2-D interpolation routine:
>
> from mpl_toolkits.basemap import interp
>

Thanks!

>>
>> This is partially achieved with "white" (and I suppose I could pick
>> "grey" or "black"), but I think it might be nicer if it were a pure
>> mixture, rather than a mixture of the surrounding colors and the
>> "over" color.
>>
>> The script is attached below.  Sorry it is a bit long, but I needed a
>> discrete colormap.  Can we get cmap_discrete() into matplotlib?
>
> No, because it doesn't make much sense, given the mpl paradigm in which a
> colormap and a norm work together.  If you want 4 colors, make a colormap
> with 4 colors, and use a norm that maps your data to those 4 colors.
>
> For example:
>
> cm4 = get_cmap('jet', 4)
> cm4a = mpl.colors.ListedColormap(get_cmap('jet', 256)([20, 70, 150, 200]))
>
> You can select any discrete set of colors you want using ListedColormap.
>
> Then you can use the default Normalize, or a custom BoundaryNorm, to map
> data ranges to the colors.  You just don't need a lookup table with 1024
> entries to specify 4 colors--it doesn't gain you anything.
>

Wonderful.  Definitely makes the cookbook entry seem unnecessary

--

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


[Matplotlib-users] imshow only half of each unit

2011-03-08 Thread T J
imshow fills an entire "unit" in the grid.  I'd like to overlay two
imshow's on top of each other, but in a non-destructive manner.  One
way of doing this would be to modify the behavior of imshow so that it
only fills a portion of each "unit" in the grid.  For example, in the
first imshow, I'd fill everything below the diagonal and in the second
imshow, I'd fill everything above the diagonal.

Would this type of modification to AxesImage be feasible?  Or should I
just (manually) make a PolyCollection for each imshow?  I'd still want
interpolations to work as expected, but where filling (or not) is
restricted to a region within the "unit".  Generally, I think this
could be a nice addition to mpl, but if there is a more typical way of
visualizing two imshows on the same axis, I might try that instead.

thanks.

--
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] GraphicsArray

2011-03-31 Thread T J
Any chance matplotlib can get functionality similar to GraphicsArray
in Mathematica?  It'd be nice to make a single method to draw whatever
you want and then do this in a list comprehension.  At the end, you
can arrange all those plots however you want.

It looks like Sage has implemented something like this (built on top
of matplotlib, I presume).  Would it be difficult to port this to
"pure" matplotlib?

   
http://ask.sagemath.org/question/308/can-i-convert-a-graphicsarray-object-to-a-graphics

--
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Change hatch intensity/color for PDF backend

2011-04-25 Thread T J
I am using the PDF backend and specifying a hatch for a fill_between()
call.  The resultant PDF looks okay, but the hatch lines are too
light.

Is there a way to darken them?  Also, is it possible to change the
color of the hatch lines? I'm okay solutions that are low-level hacks.
 I just need the PDF to have proper hatches.

--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Change hatch intensity/color for PDF backend

2011-04-25 Thread T J
On Mon, Apr 25, 2011 at 1:15 PM, T J  wrote:
> I am using the PDF backend and specifying a hatch for a fill_between()
> call.  The resultant PDF looks okay, but the hatch lines are too
> light.
>
> Is there a way to darken them?  Also, is it possible to change the
> color of the hatch lines? I'm okay solutions that are low-level hacks.
>  I just need the PDF to have proper hatches.
>

I can change their color by specifying 'edgecolor' to PathPatch, but
their intensity is still too low.  :(

--
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
___
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users