log in hist() and toggling

Hi,

I very much miss the 'l' shortcut for toggling log/lin y-scale in the trunk! I use it a lot.

I suggest restoring it with something like

if self.get_yscale() is ("log" or "linear"):
    self.toggle_log_lineary()
else: pass

I think most of time most people use log or linear scales.

The new hist() function looks really good, I especially welcome the "step" mode. A couple of comments:

The latest svn incarnation doesn't allow for log scale in step-mode (unless you set it manually).

Also, I think the step-mode should have fill=False as default, otherwise it does not look that much different from bar-mode. The nice thing about step histograms is that you can put several of them in the same plot while keeping it intelligible!

Cheers,
/Olle

I very much miss the 'l' shortcut for toggling log/lin y-scale in the
trunk! I use it a lot.

I suggest restoring it with something like

if self.get_yscale() is ("log" or "linear"):
   self.toggle_log_lineary()
else: pass

I think most of time most people use log or linear scales.

This seems reasonable, but when I tried to implement it it looked like
the nan mask for the simple_plot.py example was sticky, eg when I
toggled back to linear the negative values were still masked. I tried
a simpler example still (all positive y data) and got something very
strange: the plotted y values appear to change on a toggle from log
and back to linear:

In [18]: import matplotlib.pyplot as plt

In [19]: plt.close('all')

In [20]: ax = plt.subplot(111)

In [21]: ax.plot(np.random.rand(20))
Out[21]: [<matplotlib.lines.Line2D object at 0x123082f0>]

In [22]: ax.set_yscale('linear'); ax.figure.canvas.draw()

In [23]: ax.set_yscale('log'); ax.figure.canvas.draw()

In [24]: ax.set_yscale('linear'); ax.figure.canvas.draw() # the y
data are now plotted differently

I am not sure what is going on yet, but I'm sure Michael will chime in
since I think we are seeing some funkiness in the new transforms and
path infrastructure.

The new hist() function looks really good, I especially welcome the "step"
mode. A couple of comments:

The latest svn incarnation doesn't allow for log scale in step-mode
(unless you set it manually).

Also, I think the step-mode should have fill=False as default, otherwise
it does not look that much different from bar-mode. The nice thing about
step histograms is that you can put several of them in the same plot while
keeping it intelligible!

Manuel is the developer behind these nice new changes to hist --
hopefully he can help you here.

JDH

···

On Sat, May 24, 2008 at 6:02 PM, Olle Engdegård <olle@...599...> wrote:

Should be working now on the trunk. The line transformation wasn't getting invalidated when the scale changed.

Cheers,
Mike

John Hunter wrote:

···

On Sat, May 24, 2008 at 6:02 PM, Olle Engdeg�rd <olle@...599...> wrote:

I very much miss the 'l' shortcut for toggling log/lin y-scale in the
trunk! I use it a lot.

I suggest restoring it with something like

if self.get_yscale() is ("log" or "linear"):
   self.toggle_log_lineary()
else: pass

I think most of time most people use log or linear scales.
    
This seems reasonable, but when I tried to implement it it looked like
the nan mask for the simple_plot.py example was sticky, eg when I
toggled back to linear the negative values were still masked. I tried
a simpler example still (all positive y data) and got something very
strange: the plotted y values appear to change on a toggle from log
and back to linear:

In [18]: import matplotlib.pyplot as plt

In [19]: plt.close('all')

In [20]: ax = plt.subplot(111)

In [21]: ax.plot(np.random.rand(20))
Out[21]: [<matplotlib.lines.Line2D object at 0x123082f0>]

In [22]: ax.set_yscale('linear'); ax.figure.canvas.draw()

In [23]: ax.set_yscale('log'); ax.figure.canvas.draw()

In [24]: ax.set_yscale('linear'); ax.figure.canvas.draw() # the y
data are now plotted differently

I am not sure what is going on yet, but I'm sure Michael will chime in
since I think we are seeing some funkiness in the new transforms and
path infrastructure.

The new hist() function looks really good, I especially welcome the "step"
mode. A couple of comments:

The latest svn incarnation doesn't allow for log scale in step-mode
(unless you set it manually).

Also, I think the step-mode should have fill=False as default, otherwise
it does not look that much different from bar-mode. The nice thing about
step histograms is that you can put several of them in the same plot while
keeping it intelligible!
    
Manuel is the developer behind these nice new changes to hist --
hopefully he can help you here.

JDH

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
  
--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

John Hunter wrote:

···

On Sat, May 24, 2008 at 6:02 PM, Olle Engdeg�rd <olle@...599...> wrote:

I very much miss the 'l' shortcut for toggling log/lin y-scale in the
trunk! I use it a lot.

I suggest restoring it with something like

if self.get_yscale() is ("log" or "linear"):
   self.toggle_log_lineary()
else: pass

I think most of time most people use log or linear scales.

This seems reasonable, but when I tried to implement it it looked like
the nan mask for the simple_plot.py example was sticky, eg when I
toggled back to linear the negative values were still masked. I tried
a simpler example still (all positive y data) and got something very
strange: the plotted y values appear to change on a toggle from log
and back to linear:

In [18]: import matplotlib.pyplot as plt

In [19]: plt.close('all')

In [20]: ax = plt.subplot(111)

In [21]: ax.plot(np.random.rand(20))
Out[21]: [<matplotlib.lines.Line2D object at 0x123082f0>]

In [22]: ax.set_yscale('linear'); ax.figure.canvas.draw()

In [23]: ax.set_yscale('log'); ax.figure.canvas.draw()

In [24]: ax.set_yscale('linear'); ax.figure.canvas.draw() # the y
data are now plotted differently

I am not sure what is going on yet, but I'm sure Michael will chime in
since I think we are seeing some funkiness in the new transforms and
path infrastructure.

The new hist() function looks really good, I especially welcome the "step"
mode. A couple of comments:

The latest svn incarnation doesn't allow for log scale in step-mode
(unless you set it manually).

Also, I think the step-mode should have fill=False as default, otherwise
it does not look that much different from bar-mode. The nice thing about
step histograms is that you can put several of them in the same plot while
keeping it intelligible!

Manuel is the developer behind these nice new changes to hist --
hopefully he can help you here.

log-scale support for step-histograms is done now on the trunk.

   Manuel