Ask Your Question

elcojon's profile - activity

2019-05-03 22:04:19 +0200 received badge  Popular Question (source)
2015-02-22 22:02:57 +0200 received badge  Nice Question (source)
2013-01-03 18:22:52 +0200 asked a question What is a sage object?

How do I convert a lambda function to a sage object?

I would like to use the plot command with my lambda function

from numpy import sign
H=lambda x: (sign(x)+1)/2
P = lambda x, a,b: H(x - a) - H(x - b)
plot(P(x,5,10), (x,-10,20)
# or 
BOX510(x) = lambda x: P(x,5,10)
plot(BOX510(x), (x,-10,20)

I get error messages. I had a glance at the documentation. It says the plot command expects a Sage Object, but unfortuntely I do not have the notion for its meaning.

Eureka, it works, when I use the sign function of sage instead of the one I imported from numpy. Yet, I would like to know what a sage object is?

2012-11-03 11:35:05 +0200 commented answer How can i generate a 3D plot with more details?

it does not work! I tested it. It stops running with a TypeError. TypeError: 'Graphics3dGroup' object is not iterable

2012-10-28 06:07:44 +0200 commented answer Changing the Tick Mark Values When Plotting a Matrix

to whom may I send the patch to review it?

2012-10-27 20:41:14 +0200 answered a question Changing the Tick Mark Values When Plotting a Matrix

I modified my sage source code to do solve this for me. I had to modify matrix_plot.py.

2012-10-27 17:15:46 +0200 asked a question Changing the Tick Mark Values When Plotting a Matrix

Hello,

I am using matrix_plot to display my 2 dimensional array of data. Is there a way to change the tick mark values? Right now they are set to the index values of the matrix.

Also see this example from Matlab Stackoverflow

I was already trying to overload matplotlib keyword extent Example:

matrix_plot(mat, extent=[horLeft, horRight, verTop, verBottom])

2012-10-19 10:26:17 +0200 marked best answer put title on matrix_plot

This must be pretty new functionality, because in Sage 5.2

verbose 0 (138: primitive.py, options) WARNING: Ignoring option 'title'=Lena image

and indeed there is no title. In Sage 5.3 we have the following picture, as you point out.

image description

And it looks like [#10512: Jason Grout, Punarbasu Purkayastha, Sébastien Labbé: wrap matplotlib's title functionality Reviewed by Sébastien Labbé, Punarbasu Purkayastha is what happened here - it adds the functionality, but didn't realize that with matrix_plot you will get stuff like this. But compare

sage: matrix_plot(data,axes_labels=piclabels, title='Lena image',origin='lower')

image description

So I think that this will be pretty easy to fix by moving the title like we do for regular plots. I've opened Trac 13625 for this.

2012-10-19 10:26:17 +0200 received badge  Scholar (source)
2012-10-19 10:26:11 +0200 commented answer put title on matrix_plot

Wow, that was fast. And the trac ticket tells us that this is already reported to mpl upstream.

2012-10-19 09:22:55 +0200 received badge  Student (source)
2012-10-19 08:06:13 +0200 asked a question put title on matrix_plot

I am using matrix_plot to show an image. I would like to put a title on top of the plot. Unfortunately the result looks unsatisfactory. Is there a preferred way to put a title to matrix_plot?

piclabels = ('width [px]','height [px]')
import scipy 
data = scipy.lena()
matrix_plot(data,axes_labels=piclabels, title='Lena image')

Due to lack of karma, I cannot attach an image show that the title is overlapping with the axis.

2012-10-06 07:39:17 +0200 received badge  Supporter (source)
2012-10-05 16:28:06 +0200 received badge  Editor (source)
2012-10-05 16:22:54 +0200 answered a question Problem showing images

You can do

import Image
img = Image.open(DATA+"filename") # if you load the image from disk
img = Image.fromarray(imgarray) # if the image is numpy array

img.save("test.png")

It will show up in the notebook. But it will also save a copy of the image to your disk. If I find out how to write the image to /dev/null, then maybe I could avoid writing to disk.