Colobar and change axis x and y labels

Thanks Alexa and Jerzy.

other questions? ... Here they are:

- changing to an image grey scale only needs ... what?

- I need to do a 'plane fit' of the image. Does matplotlib
   have some routine for this? Or shall I use other math libs?

Thanks again.

···

Le 16/02/2012 02:20, Alexa Villaume a écrit :

Try using 'xticks' and 'yticks', those commands let you define the
location and label fo your tick marks.

This *alone* will not do, the image might be scaled badly. Add extent.

Try this:

fig = plt.figure()
frame = plt.subplot(111)
im=frame.imshow(data,extent=[0,3400,0,3400])
plt.xticks([0,3400]); plt.yticks([0,3400])
plt.xlabel('X (nm)')
plt.ylabel('Y (nm)')
plt.colorbar(im)

plt.show()

==

Jerzy Karczmarczuk
Caen, France

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

You need to use the ‘imshow’ function to display an image in greyscale. You have to turn your image into an array of values and then put that array into imshow with the colormap set to grey.

I don’t know about how to do a plane fit…

···

On Wed, Feb 15, 2012 at 9:18 PM, <Pythphys@…3969…> wrote:

Thanks Alexa and Jerzy.

other questions? … Here they are:

  • changing to an image grey scale only needs … what?

  • I need to do a ‘plane fit’ of the image. Does matplotlib

    have some routine for this? Or shall I use other math libs?

Thanks again.

Le 16/02/2012 02:20, Alexa Villaume a écrit :

Try using ‘xticks’ and ‘yticks’, those commands let you define the

location and label fo your tick marks.

This alone will not do, the image might be scaled badly. Add extent.

Try this:

fig = plt.figure()

frame = plt.subplot(111)

im=frame.imshow(data,extent=[0,3400,0,3400])

plt.xticks([0,3400]); plt.yticks([0,3400])

plt.xlabel(‘X (nm)’)

plt.ylabel(‘Y (nm)’)

plt.colorbar(im)

plt.show()

==

Jerzy Karczmarczuk

Caen, France


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

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users


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

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

"Pythphys", would it be too demanding to ask you to sign your messages with a human name?...
Danke.

You ask:

- changing to an image grey scale only needs ... what?

plt.set_cmap(plt.cm.gray)

in the context of your current figure. Or, use cmap=... in your imshow.
Please, look up "colormap" in the documentation.

- I need to do a 'plane fit' of the image. Does matplotlib
    have some routine for this? Or shall I use other math libs?

I am not a guru of matplotlib, but this is a visualisation package, not a data processing one. Scipy (numpy) have some interpolation procedures, polyfit, etc. but I don't remember without digging the docs (which you might do as well) whether multidimensional fitting is there.

Anyway, why not use your head? This is a standard student exercise.

You need to fit: zf = ax + by + c, having z =f(x,y) in your image, am I right? If not, forget the rest.

Use the linear regression, find the zero of the gradient wrt (a,b,c) of

SUM[(ax +by +c - z)^2]

and that's all.

The most tragic part of the exercise is the necessity of solving a linear equation set in 3 variables...

Jerzy Karczmarczuk
Caen, France