[Matplotlib-users] colorbar: format labels with mathtext

2011-01-18 Thread Stefan Mauerberger
Hi Everyone, 

I would like to format the labels of a colorbar with mathtext. I have
tried a lot with all the cax.formatter.___ options but unfortunately I
was not able to get it working. 

I am plotting some Data with
   col = ax.pcolorfast( ... )
after this I create a colorbar with 
   cax = fig.colorbar(col)
Then I would like to change the formatter and the powerlimits with
   cax.formatter.format = '$%1.2f$'
   cax.formatter.set_powerlimits( (-4,4) )
but this does not work for me.  

Could you pleas help me to set the powerlimits and to format the labels
of a colorbar with mathtext. 

Regards,

Stefan 



--
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] tick formatter - floating axis

2010-11-11 Thread Stefan Mauerberger
Hi JJ, 

thanks a lot for your Answer. Now I have understand how this works and
created my one formatter:

class MyFormatter(object):
def __init__(self, fmt='$%f$'):
self.fmt = fmt
def __call__(self, direction, factor, values):
return [self.fmt % v for v in values] 

Is there something like this already in Matplotlib? I looked into
axisartist but can not find anything similar. 

Regards 

Stefan 


On Thu, 2010-11-11 at 09:38 +0900, Jae-Joon Lee wrote:
 How do you want your ticklabels formatted?
 
 If axisartist does not provide a formatter that fits your need, you
 can create a custom formatter.
 Formatter for axisartist can be any callable object with following signature.
 
 def Formatter(direction, factor, values):
 # ...
 return list_of_string_that corresponds_to_values
 
 You may ignore direction and factor parameters for now.
 For example,
 
 class MyFormatter(object):
 def __call__(self, direction, factor, values):
 _fmt = $%.1f$
 return [_fmt % v for v in values]
 
 then you could do
 
 grid_helper = floating_axes.GridHelperCurveLinear( tr, extremes=( 1, 2,
 1000, 2000 ), tick_formatter1 = None, tick_formatter2 = MyFormatter() )
 
 Regards,
 
 -JJ
 
 
 On Wed, Nov 10, 2010 at 10:17 PM, Stefan Mauerberger
 stefan.mauerber...@mnet-online.de wrote:
  Hello everyone,
 
  I have a question regarding the formatting of ticks in a curved
  coordinate system. To create my plots I am useing the
  mpl_toolkits.axisartist.floating_axes.GridHelperCurveLinear() function.
  This works quite well but I have difficulties with formatting the axis.
  I am working in a polar coordinate system. To format the longitudinal
  axis I found the function
  mpl_toolkits.axisartist.angle_helper.FormatterDMS() and it works good.
  But I want to chance the formatting of the radius too. For this I need
  to pass something to the kwargs tick_formatter2 of the function
  GridHelperCurveLinear but I do not know what.
 
  Could you give me some advice?
 
  Regards
 
  Stefan
 
  Here is the code I use:
 
  import matplotlib.pyplot as plt
  import mpl_toolkits.axisartist.floating_axes as floating_axes
  from   matplotlib.projections import PolarAxes
 
  fig = plt.figure()
 
  tr = PolarAxes.PolarTransform()
 
  grid_helper = floating_axes.GridHelperCurveLinear( tr, extremes=( 1, 2,
  1000, 2000 ), tick_formatter1 = None, tick_formatter2 = None )
 
  ax1 = floating_axes.FloatingSubplot( fig, 111, grid_helper=grid_helper )
 
  fig.add_subplot( ax1 )
 
  ax1.grid( True )
 
  plt.show()
 
 
  --
  The Next 800 Companies to Lead America's Growth: New Video Whitepaper
  David G. Thomson, author of the best-selling book Blueprint to a
  Billion shares his insights and actions to help propel your
  business during the next growth cycle. Listen Now!
  http://p.sf.net/sfu/SAP-dev2dev
  ___
  Matplotlib-users mailing list
  Matplotlib-users@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 


--
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] how to make a polar plot just of a section with grid

2010-10-21 Thread Stefan Mauerberger
Hi Frederick, 

thanks for your answer. The option *faceted* I already knew but this is
not exactly what I want. Perhaps it would be possible to draw the grid
without labels. 

My goal is to draw a grid with labels above the data. Similar to the
example 'demo curvelinear grid'. 

Regards 

Stefan 


--
Nokia and ATT present the 2010 Calling All Innovators-North America contest
Create new apps  games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] colormap from blue to transparent to red

2010-10-20 Thread Stefan Mauerberger
Ben, thanks a lot! Your way does exactly what I want. 

Scott, I do not understand your solution, unfortunately. I have already
known the example from the gallery. But up to now, I have not dealt with
masked arrays. Anyway ... 

Thanks a lot again. 

Stefan 


--
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly 
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] how to make a polar plot just of a section with grid

2010-10-20 Thread Stefan Mauerberger
Hello everyone, 

I want to make a polar plot with grid not of the full circle but a
section (e.g. r=[5:6], phi=[-20:30]). The result should look like this:
http://homepages.physik.uni-muenchen.de/~Stefan.Mauerberger/example.png
I have tried a lot and had also looked to the examples but my results
are not satisfying. This example
http://matplotlib.sourceforge.net/examples/axes_grid/demo_curvelinear_grid.html 
 seems to be highly relevant for my needs but i do not understand it at all.

I tried two different ways: 
Using the option polar=True works fine but I was not able to shrink the
plot to the section. 
Otherwise transforming the data to cartesian coordinates (e.g.
pcolor(r*np.sin(phi),r*np.cos(phi),data) ) the data are plotted into a
box. But in this case I do not know how to draw a grid. 

Could anyone give me some advice how to do this?

Regards

Stefan


--
Nokia and ATT present the 2010 Calling All Innovators-North America contest
Create new apps  games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] colormap from blue to transparent to red

2010-10-12 Thread Stefan Mauerberger
Hi everyone, 

I am having trouble with colormaps unsing pcolormesh. I would like to
plot and colorise a seismic wave field above a map. Plotting works fine
but I do not know how to bring transparency into colormaps. For negative
values I want the coloration being blue then it should become
transparent and the greatest value should be drawn red. I have tried a
lot but without any success. As far as I can see, the keyarg alpha does
not fit my needs at all. 

Do you have any suggestions for me? 

Regards

Stefan


--
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2  L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users