Question about Plot

7 views
Skip to first unread message

Michel

unread,
Nov 1, 2008, 9:35:50 AM11/1/08
to sage-support
I would like to make a simple 2D plot of a function. However I cannot
figure out from the manual how to specify the frequency of the tick
marks. Currently they seem to be multiples of 2.5 and I would like
them to be multiples of 1.0.

Any help?

Regards,
Michel

David Joyner

unread,
Nov 1, 2008, 10:29:15 AM11/1/08
to sage-s...@googlegroups.com
This probably doesn't help, but there is a method in axes.py called
"tasteless_tick_marks" which I guess you have to figure out how to use
somehow.

sage: from sage.plot.axes import Axes
sage: P = plot(x^2,2,10)
sage: Axes(P)._tasteless_ticks(2,10, 10)

([9.1999999999999993,
8.4000000000000004,
2.0,
4.4000000000000004,
6.0,
5.2000000000000002,
10.0,
6.8000000000000007,
3.6000000000000001,
7.6000000000000005,
2.7999999999999998],
9.1999999999999993,
0.80000000000000004)

I couldn't figure it out though.

Marshall Hampton

unread,
Nov 1, 2008, 1:44:31 PM11/1/08
to sage-support
This has been irritating for a long time. I have tried to look at
this code too but I find it confusing. I have been reduced to writing
my own code to produce axes (sometimes I need some funny things, like
2 sets of axes for a plot with two different scales). There is
probably already a ticket for this but I'm not sure what it is off
hand.

In general there needs to be clearer ways to override the choices that
plot makes. For example, I think currently that when one specifies
xmin, xmax, etc, the plot is still padded out a little, which is
sometimes unacceptable. It also sometimes put the axes in the middle
of the plot, sometimes on the side...ack.

Maybe it would make sense to make an alternative plot command,
something like "manual_plot", with more direct and fine-grained
control. Doing it from scratch might be easier than changing the
current code.

-M. Hampton

On Nov 1, 9:29 am, "David Joyner" <wdjoy...@gmail.com> wrote:
> This probably doesn't help, but there is a method in axes.py called
> "tasteless_tick_marks" which I guess you have to figure out how to use
> somehow.
>
> sage: from sage.plot.axes import Axes
> sage: P = plot(x^2,2,10)
> sage: Axes(P)._tasteless_ticks(2,10, 10)
>
> ([9.1999999999999993,
> 8.4000000000000004,
> 2.0,
> 4.4000000000000004,
> 6.0,
> 5.2000000000000002,
> 10.0,
> 6.8000000000000007,
> 3.6000000000000001,
> 7.6000000000000005,
> 2.7999999999999998],
> 9.1999999999999993,
> 0.80000000000000004)
>
> I couldn't figure it out though.
>

William Stein

unread,
Nov 1, 2008, 2:58:21 PM11/1/08
to sage-s...@googlegroups.com
On Sat, Nov 1, 2008 at 10:44 AM, Marshall Hampton <hamp...@gmail.com> wrote:
>
> This has been irritating for a long time. I have tried to look at
> this code too but I find it confusing. I have been reduced to writing
> my own code to produce axes (sometimes I need some funny things, like
> 2 sets of axes for a plot with two different scales). There is
> probably already a ticket for this but I'm not sure what it is off
> hand.
>
> In general there needs to be clearer ways to override the choices that
> plot makes. For example, I think currently that when one specifies
> xmin, xmax, etc, the plot is still padded out a little, which is
> sometimes unacceptable. It also sometimes put the axes in the middle
> of the plot, sometimes on the side...ack.
>
> Maybe it would make sense to make an alternative plot command,
> something like "manual_plot", with more direct and fine-grained
> control. Doing it from scratch might be easier than changing the
> current code.
>

No. The problem is that plot is only partly implemented.
One should look at the mathematica design for doing this (where this
involves anything with axes), design a sage-friendly way of doing
at least that functionality (and more), then implement it on top
of the current plot command. I wish I personally had time to do
this right now, but I don't.

-- William

Marshall Hampton

unread,
Nov 2, 2008, 9:40:02 AM11/2/08
to sage-support
I also do not have time to do this myself. The idea of the
"manual_plot" is that I might be able to do a seperate command, but
for the foreseeable future I will not have the time to understand the
current plot command well enough to improve it; I've tried and failed
already. Instead, I have ended up writing my own commands for things
like multiple axes when I need them for critical things like
publications.

If you think its a bad idea to put such code in Sage itself, I won't
try to. Some of it is likely to appear in some @interact examples I
am working on for modeling circulatory systems.

-Marshall

On Nov 1, 12:58 pm, "William Stein" <wst...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages