Matplotlib Contour Plots

Christian Gollwitzer auriocus at gmx.de
Mon Aug 18 13:49:29 EDT 2014


Am 18.08.14 18:51, schrieb Jamie Mitchell:
> On Friday, August 15, 2014 4:13:26 PM UTC+1, Steven D'Aprano wrote:
> So I have two 1D arrays:
>
> 1st array - ([8, 8.8,8.5,7.9,8.6 ...], dtype=float32)
>
> It has a shape (150,)
>
> 2nd array - ([2, 2.2, 2.5, 2.3, ...],dtype=float32)
>
> It has a shape (150,)
>
> What I want to do is create a 2D array which merges the 1st and 2nd array so that I would have:
>
> ([[8, 8.8,8.5,7.9,8.6 ...],[2,2,2,2,5,2.3, ...]], dtype=float32) that would have a shape (150,150)

There is a logical error in your description. This array would not have 
the shape (150,150), but (2,150).

> In this form I could then plot a 2D contour.

An image with 150x150 pixels has in total 150x150=22500 pixels. You've 
got only 300 datapoints. So it's very unclear what you want to do. A 
"contour plot" displays lines of equal height over a two-dimensional 
dataset, as in a topographic map. You don't seem to have a 
two-dimensional dataset at first place; maybe you already have *contour 
data*, and you just want to plot(x,y) ?

	Christian




More information about the Python-list mailing list