Re: [Matplotlib-users] Efficient matplotlib use on iOS and Android apps

2015-07-10 Thread asiga
Why do you suggest MathJax? I assume Javascript will be less efficient than
Python. Moreover, I'm not sure I can get the MathJax output as polygonal
primitives that I can send to OpenGL. And, to complicate things, you cannot
use JIT Javascript engines on iOS such as V8, due to sandboxing.

In fact, I'm considering to build myself a minimal LaTeX distro. Maybe that
would be the best option.

 



--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/Efficient-matplotlib-use-on-iOS-and-Android-apps-tp45901p45914.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] question on spherical coordinate plots

2015-07-10 Thread Romain Madar

Dear experts,

I am trying to plot spherical harmonics with matplotlib and I have some 
troubles. I am starting from the example 
http://matplotlib.org/examples/mplot3d/surface3d_demo2.html where I 
change the factor 10 in a function of r=f(theta,phi) (or r=f(u,v) as 
they are named in the example). I observe very strange behaviours:


(1) (x,y,z) = (r cos(phi) sin(theta) , r sin(phi) sin(theta) , r 
cos(theta)). But np.outer(a,b) is not commutative while the 
multiplication is. So how to choose the order in the np.outer() product? 
In fact, different order gives very different results.


(2) It's seem impossible to reproduce the well known Ylm(theta,phi) 
plots. Using for example this document 
http://www.cs.dartmouth.edu/~wjarosz/publications/dissertation/appendixB.pdf 
:






I don't know if I am doing something wrong or so, but I don't understand 
... My full code is bellow.


Thanks a lot in advance !
Cheers,
Romain


PS:

import math
import numpy as np
import pylab as p
from mpl_toolkits.mplot3d import Axes3D

def f(theta,phi):
return np.sin(phi)*np.cos(phi)*np.sin(theta)**2

fig = p.figure()
ax = fig.add_subplot(111, projection='3d')

theta = np.linspace(0,   np.pi, 500)
phi   = np.linspace(0, 2*np.pi, 500)

r = f(theta,phi)
x = r**2 * np.outer( np.cos(phi) , np.sin(theta) )
y = r**2 * np.outer( np.sin(phi) , np.sin(theta) )
z = r**2 * np.outer(np.ones(phi.shape), np.cos(theta))

#x = r**2 * np.outer( np.sin(theta) , np.cos(phi) )
#y = r**2 * np.outer( np.sin(theta) , np.sin(phi) )
#z = r**2 * np.outer( np.cos(theta), np.ones(theta.shape) )

ax.plot_surface(x,y,z)
ax.set_xlabel("X")
ax.set_ylabel("Y")
ax.set_zlabel("Z")

p.show()


--
=
Romain Madar

Laboratoire de Physique Corpusculaire de Clermont-Ferrand
  Campus Universitaire des Cézeaux
  4 avenue Blaise Pascal
  TSA 60026, CS 60026
  63178 Aubière cedex, FRANCE

Email: romain.ma...@cern.ch
Tel. : +33 (0)4 73 40 71 57
Off. : 8204-8205
=

--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] how to install freetype & png for matplotlib

2015-07-10 Thread Varada Anirudhan
Hello there

When I was trying to install matplotlib, the output said that I needed to
install freetype and png first

How do I install freetype and png on my Ubuntu 14.04 powered-Linux system?
Please help me with the lines of code for this installation

Thanks in advance




--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/how-to-install-freetype-png-for-matplotlib-tp45916.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] how to install freetype & png for matplotlib

2015-07-10 Thread Thomas Caswell
See
http://matplotlib.org/1.4.3/faq/installing_faq.html?highlight=install#linux-notes

On Fri, Jul 10, 2015, 9:10 AM Varada Anirudhan 
wrote:

> Hello there
>
> When I was trying to install matplotlib, the output said that I needed to
> install freetype and png first
>
> How do I install freetype and png on my Ubuntu 14.04 powered-Linux system?
> Please help me with the lines of code for this installation
>
> Thanks in advance
>
>
>
>
> --
> View this message in context:
> http://matplotlib.1069221.n5.nabble.com/how-to-install-freetype-png-for-matplotlib-tp45916.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> --
> 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
> Matplotlib-users@lists.sourceforge.net
> 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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Efficient matplotlib use on iOS and Android apps

2015-07-10 Thread Benjamin Root
The way matplotlib does its MathText rendering is 1) incomplete (we don't
support all of MathTex), and 2) has *massive* overhead (relatively
speaking). Matplotlib is intended for producing figures with many disparate
components. The amount of code it takes to just generate a simple plot is
fairly significant (along with also firing up a python interpreter).
Meanwhile, MathJax is much lighter in the sense that all it needs to do is
parse a string and render out font characters.

As for matplotlib vs. MathJax, you will likely sending bitmaps to OpenGL
(if possible) anyway because that is pretty much what you will need to do
with matplotlib as well as MathJax. It is technically possible to obtain
the stroke data to send the font lines to OpenGL, but it will not look the
same as it would if you let a font renderer generate the bitmap. There are
a few reasons why matplotlib does not have an OpenGL backend yet, one of
them is because OpenGL does a terrible job in rendering text.

This is not to say that what you are thinking of doing is impossible to do.
It may be quite possible, but given that no one (that I am aware of) have
managed to get matplotlib running on a mobile OS, you have a huge
undertaking ahead of you just to get started. And, once you get there, it
is quite likely that the performance won't be what you need. In addition,
you might not like the resulting render. More power to you if you can get
it working, and I know many people who are interested in getting that stack
working on tablets and such.

On the other hand, there are plenty of documentation on how to build mobile
apps that take advantage of javascript-based technologies. Your startup
cost is very low here. And given that you will likely going to need to use
bitmaps anyway, it might not be all that bad of an option. I have no clue
what the performance penalty of firing up a javascript renderer on a mobile
OS, but in the face of the unknown, I avoid guessing. Don't fall victim to
premature optimization. I have been very surprised at how fast certain
(slow) technologies can be.

A minimalist LaTeX distro is an intriguing idea. I have no clue how much
effort it would take to do that, but that may be quite feasible.

Best of luck to you, and I look forward to finding out what you manage to
get working.

Cheers!
Ben Root

On Fri, Jul 10, 2015 at 4:37 AM, asiga  wrote:

> Why do you suggest MathJax? I assume Javascript will be less efficient than
> Python. Moreover, I'm not sure I can get the MathJax output as polygonal
> primitives that I can send to OpenGL. And, to complicate things, you cannot
> use JIT Javascript engines on iOS such as V8, due to sandboxing.
>
> In fact, I'm considering to build myself a minimal LaTeX distro. Maybe that
> would be the best option.
>
>
>
>
>
> --
> View this message in context:
> http://matplotlib.1069221.n5.nabble.com/Efficient-matplotlib-use-on-iOS-and-Android-apps-tp45901p45914.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> --
> 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
> Matplotlib-users@lists.sourceforge.net
> 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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] question on spherical coordinate plots

2015-07-10 Thread Benjamin Root
Your theta and phi were essentially 1D rather than 2D, so it didn't allow
for 2 degrees of freedom. And you don't need np.outer() for this:

theta = np.linspace(0,   np.pi, 500)[:, None]
phi   = np.linspace(0, 2*np.pi, 500)[None, :]

r = f(theta, phi)
x = r**2 * np.cos(phi) * np.sin(theta)
y = r**2 * np.sin(phi) * np.sin(theta)
z = r**2 * np.cos(theta)

The use of np.outer() in the original example acted a bit like a creating a
grid of u/v values in a 2D grid. However, your formulation required
computing a 2D grid of radius values in order to work correctly.

Cheers!
Ben Root

On Fri, Jul 10, 2015 at 7:54 AM, Romain Madar  wrote:

>  Dear experts,
>
> I am trying to plot spherical harmonics with matplotlib and I have some
> troubles. I am starting from the example
> http://matplotlib.org/examples/mplot3d/surface3d_demo2.html where I
> change the factor 10 in a function of r=f(theta,phi) (or r=f(u,v) as they
> are named in the example). I observe very strange behaviours:
>
> (1) (x,y,z) = (r cos(phi) sin(theta) , r sin(phi) sin(theta) , r
> cos(theta)). But np.outer(a,b) is not commutative while the multiplication
> is. So how to choose the order in the np.outer() product? In fact,
> different order gives very different results.
>
> (2) It's seem impossible to reproduce the well known Ylm(theta,phi) plots.
> Using for example this document
> http://www.cs.dartmouth.edu/~wjarosz/publications/dissertation/appendixB.pdf
> :
>
>
>
>
>
> I don't know if I am doing something wrong or so, but I don't understand
> ... My full code is bellow.
>
> Thanks a lot in advance !
> Cheers,
> Romain
>
>
> PS:
>
> import math
> import numpy as np
> import pylab as p
> from mpl_toolkits.mplot3d import Axes3D
>
> def f(theta,phi):
> return np.sin(phi)*np.cos(phi)*np.sin(theta)**2
>
> fig = p.figure()
> ax = fig.add_subplot(111, projection='3d')
>
> theta = np.linspace(0,   np.pi, 500)
> phi   = np.linspace(0, 2*np.pi, 500)
>
> r = f(theta,phi)
> x = r**2 * np.outer( np.cos(phi) , np.sin(theta) )
> y = r**2 * np.outer( np.sin(phi) , np.sin(theta) )
> z = r**2 * np.outer(np.ones(phi.shape), np.cos(theta))
>
> #x = r**2 * np.outer( np.sin(theta) , np.cos(phi)
> )
>
> #y = r**2 * np.outer( np.sin(theta) , np.sin(phi) )
> #z = r**2 * np.outer( np.cos(theta), np.ones(theta.shape) )
>
> ax.plot_surface(x,y,z)
> ax.set_xlabel("X")
> ax.set_ylabel("Y")
> ax.set_zlabel("Z")
>
> p.show()
>
>
> --
> =
>   Romain Madar
>
> Laboratoire de Physique Corpusculaire de Clermont-Ferrand
>   Campus Universitaire des Cézeaux
>   4 avenue Blaise Pascal
>   TSA 60026, CS 60026
>   63178 Aubière cedex, FRANCE
>
> Email: romain.ma...@cern.ch
> Tel. : +33 (0)4 73 40 71 57
> Off. : 8204-8205
> =
>
>
>
> --
> 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
> Matplotlib-users@lists.sourceforge.net
> 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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How to visualize a, b results of x, y variables

2015-07-10 Thread Jonno
Thanks for all the ideas.

On Thu, Jul 9, 2015 at 8:09 PM, Joy merwin monteiro 
wrote:

> Maybe you could plot the ratio? That should give you rainfall per degree
> Celsius.
> On 9 Jul 2015 20:11, "Jonno"  wrote:
>
>> I was thinking of doing that or having 2 surface plots but I think it
>> would be visually quite confusing.
>> I was trying to think of an example since I'm sure someone has come up
>> with a nice way to display this kind of data.
>> Imagine if the data was average temperature (a) and average rainfall (b)
>> for a region in the world (lat/long = x,y). The goal is to display the data
>> such that it's obvious where the locations are that have closest to the
>> ideal temp/rain combination.
>> How would you go about that?
>>
>> On Thu, Jul 9, 2015 at 12:28 AM, Sterling Smith 
>> wrote:
>>
>>> In the x,y plane, could you overlay contours of a with contours of b?
>>> -Sterling
>>>
>>> On Jul 8, 2015, at 8:19PM, Jonno  wrote:
>>>
>>> > I have a bunch of experimental data points each of which has 2
>>> variables (x,y) and 2 results (a,b). Each pair or x,y values produces a
>>> pair of a,b resultant values.
>>> > There is a single optimal pair of a,b values and I'd like to figure
>>> out a way to illustrate the data to show the relationship between each x,y
>>> pair and how close each a,b pair is to the ideal.
>>> > I'm thinking about a dual surface/contour plot with 2 different
>>> z-axes. Ideally I would center both z-axes at the ideal values. I don't
>>> know if this is possible. Might be kinda messy.
>>> >
>>> > Any other thoughts? I'm sure there must be other examples where this
>>> is a problem.
>>> >
>>> --
>>> > 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
>>> > Matplotlib-users@lists.sourceforge.net
>>> > 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
>> Matplotlib-users@lists.sourceforge.net
>> 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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] New matplotlib book: Mastering matplotlib

2015-07-10 Thread Duncan McGreggor
Hey all,

I wanted to let folks know that there is a new matplotlib book available,
having just been published:
 *
https://www.packtpub.com/big-data-and-business-intelligence/mastering-matplotlib

The IPython notebooks are listed here (with links to NBViewer as well as
the individual chapter repos):
 * https://github.com/masteringmatplotlib/notebooks

The book didn't ship with an Acknowledgements section, so I am attempting
to make up for that here:
 *
http://oubiwann.blogspot.com/2015/07/mastering-matplotlib-acknowledgments.html

The ToC for the book hasn't been updated on the publisher's (or Amazon's)
site, so for your reading pleasure I have included the text from the
section "What this book covers" below:

Chapter 1, Getting Up to Speed, covers some history and background of
matplotlib, goes over some of the latest features of the library, provides
a refresher on Python 3 and IPython Notebooks, and whets the reader's
appetite with some advanced plotting examples.

Chapter 2, matplotlib Architecture, reviews the original design goals of
matplotlib and then proceeds to discuss its current architecture in detail,
providing visualizations of the conceptual structure and relationships
between the Python modules.

Chapter 3, matplotlib APIs and Integrations, walks the reader through the
matplotlib APIs adapting a single example accordingly, examines how the
third-party libraries are integrated with matplotlib, and gives migration
advice to the advanced users of the deprecated pylab API.

Chapter 4, Event Handling and Interactive Plots, provides a review of the
event-based systems, covers event loops in matplotlib and IPython, goes
over a selection of matplotlib events, and shows how to take advantage of
these to create interactive plots.

Chapter 5, High-level Plotting and Data Analysis, combines the interrelated
topics, providing a historical background of plotting, a discussion on the
grammar of graphics, and an overview of high-level plotting libraries. This
is then put to use in a detailed analysis of weather-related data that
spans 120 years.

Chapter 6, Customization and Configuration, covers the custom styles in
matplotlib and the use of grid specs to create a dashboard effect with the
combined plots. The lesser-known configuration options are also discussed
with an eye to optimization.

Chapter 7, Deploying matplotlib in Cloud Environments, explores a use case
for matplotlib in a remote deployment, which is followed by a detailed
programmatic batch-job example using Docker and Amazon AWS.

Chapter 8, matplotlib and Big Data, provides detailed examples of working
with large local data sets as well as the distributed ones, covering
options such as numpy.memmap, HDF5, and Hadoop. Plots with millions of
points will also be demonstrated.

Chapter 9, Clustering for matplotlib, introduces parallel programming and
clusters that are designed for use with matplotlib, demonstrating how to
distribute parts of a problem and then assemble the results for analysis in
matplotlib.

Hope everyone's having a good time at SciPy 2015!

d
--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users