id summary reporter owner description type status priority milestone component resolution keywords cc merged author reviewer upstream work_issues branch commit dependencies stopgaps
4529 Implement plots with logarithmic scale ronanpaixao ronanpaixao "Attached is a patch which introduces log scale to `Graphics()` class.
Depends on #12974.
Apply
* [attachment:trac_4529-add-log-scale.patch]
* [attachment:trac_4529-single-tick.patch]
* [attachment:trac_4529-docs-and-funcs.patch]
* [attachment:trac_4529-more-doc.patch]
* [attachment:trac_4529-typo_fixes-rebase.patch]
* [attachment:trac_4529-final-fixes.patch]
Alternate instructions:
Apply the following patches in the specified order. `SAGE_ROOT` is the directory where the sage installation is present.
{{{
cd SAGE_ROOT/devel/sage
../../sage -hg qimport -P http://trac.sagemath.org/sage_trac/raw-attachment/ticket/12974/trac_12974-fix_graphics_attributes-rebase.patch
../../sage -hg qimport -P http://trac.sagemath.org/sage_trac/raw-attachment/ticket/12974/trac_12974-refactor.patch
../../sage -hg qimport -P http://trac.sagemath.org/sage_trac/raw-attachment/ticket/12974/trac_12974-reorder_some_arguments.patch
../../sage -hg qimport -P http://trac.sagemath.org/sage_trac/raw-attachment/ticket/12974/trac_12974-whitespace-rebase.patch
../../sage -hg qimport -P http://trac.sagemath.org/sage_trac/raw-attachment/ticket/4529/trac_4529-add-log-scale.patch
../../sage -hg qimport -P http://trac.sagemath.org/sage_trac/raw-attachment/ticket/4529/trac_4529-single-tick.patch
../../sage -hg qimport -P http://trac.sagemath.org/sage_trac/raw-attachment/ticket/4529/trac_4529-docs-and-funcs.patch
../../sage -hg qimport -P http://trac.sagemath.org/sage_trac/raw-attachment/ticket/4529/trac_4529-more-doc.patch
../../sage -hg qimport -P http://trac.sagemath.org/sage_trac/raw-attachment/ticket/4529/trac_4529-typo_fixes-rebase.patch
../../sage -hg qimport -P http://trac.sagemath.org/sage_trac/raw-attachment/ticket/4529/trac_4529-final_fixes.patch
../../sage -b
}}}
----
'''OLD DISCUSSION BELOW :)'''
Currently plot() has no option to use logarithmic scales.
One workaround is to use matplotlib directly, with its semilogy(), semilogx() and loglog() functions, but that wouldn't produce plots with the customisations implemented in sage.
Another workaround is messing with the plot figure like:
{{{
#!python
import pylab
p=plot(x,marker='.')
f=pylab.figure()
f.gca().set_xscale('log')
p.save(figure=f)
}}}
But that creates two problems:
* The first problem is that the adaptive choosing of points just considers linear scale, so the points get too much spaced apart in the beginning of the plot and too close in the end.
* The second problem relates to the axis, which, for the same reason, isn't located right.
Also, this requires the user to know how to deal with figures, which is not directly exposed by sage.
There are some possibilities to fix that:
1. Make plot() detect if the figure changes the scales and modify the adaptive algorithm and the axis codes accordingly
2. Create a kwarg to tell plot() to implement the scale-change internally
3. Create other functions to use loglog(), semilogx() and semilogy()
4. Many (or all) of the above together, since they aren't mutually exclusive
From what I noticed, Mathematica implements the separate functions way, but it may be better to fix the issue in plot() itself and if the other functions are wanted, just make it so that they call plot() with the correct arguments
" enhancement positive_review major sage-3.2.1 graphics plot log scale Punarbasu Purkayastha, Karl-Dieter Crisman Karl-Dieter Crisman, Punarbasu Purkayastha N/A #12810, #12605, #12974