Chaco questions: Fast plotting of spectrograms with logarithmic axis and automatic formatting of tick labels

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Chaco questions: Fast plotting of spectrograms with logarithmic axis and automatic formatting of tick labels

Jianbao Tao
Hi, 

I am curious about Chaco's plotting capabilities. There are two things that I can't tell from the example webpage. First, although there are spectral plotting examples on the webpage, I can't tell whether it is easy and, more importantly, fast to plot spectrograms with logarithmic axis in Chaco. Second, from the zoomed-plot example, I can see that the x axis tick labels don't adjust themselves nicely to show more accurate scales; namely, in the bottom plot of that example, there are several x ticks labeled with 0.03, which are not so useful for that scale. Instead, I expect to see something like 0.039, 0.038, 0.037, etc.. So, my question is: Is it easy, or straightforward, if you will, to adjust tick labels appropriately?

Thank you very much.

Jianbao

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Chaco questions: Fast plotting of spectrograms with logarithmic axis and automatic formatting of tick labels

Adam Hughes


On Mon, Oct 8, 2012 at 10:57 PM, Jianbao Tao <[hidden email]> wrote:
Hi, 

I am curious about Chaco's plotting capabilities. There are two things that I can't tell from the example webpage. First, although there are spectral plotting examples on the webpage, I can't tell whether it is easy and, more importantly, fast to plot spectrograms with logarithmic axis in Chaco.

When you say fast, I assume you're talking about plotting lots of data or changing data rapidly?  If you get EPD and type in the command prompt "demo('chaco')" you can interactively play with these examples.  The spectrogram/waterfall demo shows a spectrogram that updates in real time with data from the microphone on your computer.  It streams pretty quickly, so I think it will show you how fast it can be.  Changing the axis to a log scale should be pretty straightforward.  I think logaxis is a builtin method, but it's also quite easy to use np.log to transform data before plotting it if need be.

 
Second, from the zoomed-plot example, I can see that the x axis tick labels don't adjust themselves nicely to show more accurate scales; namely, in the bottom plot of that example, there are several x ticks labeled with 0.03, which are not so useful for that scale. Instead, I expect to see something like 0.039, 0.038, 0.037, etc.. So, my question is: Is it easy, or straightforward, if you will, to adjust tick labels appropriately?

Maybe someone else can give you a better answer, but one thing is that Chaco is built around Matplotlib, and I imagine working with xticks in Chaco is about the same, although in my experience, the axis usually behave rather intelligently for interactive plots.  I would say you ought to try it out.
 

Thank you very much.

Jianbao

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev



_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Chaco questions: Fast plotting of spectrograms with logarithmic axis and automatic formatting of tick labels

Didrik Pinte-2
On 9 October 2012 17:18, Adam Hughes <[hidden email]> wrote:

>
>
> On Mon, Oct 8, 2012 at 10:57 PM, Jianbao Tao <[hidden email]> wrote:
>>
>> Hi,
>>
>> I am curious about Chaco's plotting capabilities. There are two things
>> that I can't tell from the example webpage. First, although there are
>> spectral plotting examples on the webpage, I can't tell whether it is easy
>> and, more importantly, fast to plot spectrograms with logarithmic axis in
>> Chaco.
>
>
> When you say fast, I assume you're talking about plotting lots of data or
> changing data rapidly?  If you get EPD and type in the command prompt
> "demo('chaco')" you can interactively play with these examples.  The
> spectrogram/waterfall demo shows a spectrogram that updates in real time
> with data from the microphone on your computer.  It streams pretty quickly,
> so I think it will show you how fast it can be.

Chaco works by nicely separating the plotting from the data source.
You just need to properly update your Plot datasource and the ui will
be redrawn. Speed depends mostly on the way you process the data.
Chaco will most probably not be the limiting factor.

> Changing the axis to a log
> scale should be pretty straightforward.  I think logaxis is a builtin
> method, but it's also quite easy to use np.log to transform data before
> plotting it if need be.

See the log_plot.py example for using log axis:

    # Set the value axis to display on a log scale
    plot.value_scale = "log"

>> Second, from the zoomed-plot example, I can see that the x axis tick
>> labels don't adjust themselves nicely to show more accurate scales; namely,
>> in the bottom plot of that example, there are several x ticks labeled with
>> 0.03, which are not so useful for that scale. Instead, I expect to see
>> something like 0.039, 0.038, 0.037, etc.. So, my question is: Is it easy, or
>> straightforward, if you will, to adjust tick labels appropriately?
>
>
> Maybe someone else can give you a better answer, but one thing is that Chaco
> is built around Matplotlib, and I imagine working with xticks in Chaco is
> about the same, although in my experience, the axis usually behave rather
> intelligently for interactive plots.  I would say you ought to try it out.

Chaco is not built around matplotlib. The code base are totally different ;-)

Regarding the axis, you can easily customize them with the
tick_label_formatter trait of the PlotAxis or by implementing your own
TickGenerator or customize the existing one.
See : http://docs.enthought.com/chaco/api/axis.html and the examples
for more details.

-- Didrik
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Chaco questions: Fast plotting of spectrograms with logarithmic axis and automatic formatting of tick labels

Adam Hughes


On Tue, Oct 9, 2012 at 1:35 PM, Didrik Pinte <[hidden email]> wrote:
On 9 October 2012 17:18, Adam Hughes <[hidden email]> wrote:
>
>
> On Mon, Oct 8, 2012 at 10:57 PM, Jianbao Tao <[hidden email]> wrote:
>>
>> Hi,
>>
>> I am curious about Chaco's plotting capabilities. There are two things
>> that I can't tell from the example webpage. First, although there are
>> spectral plotting examples on the webpage, I can't tell whether it is easy
>> and, more importantly, fast to plot spectrograms with logarithmic axis in
>> Chaco.
>
>
> When you say fast, I assume you're talking about plotting lots of data or
> changing data rapidly?  If you get EPD and type in the command prompt
> "demo('chaco')" you can interactively play with these examples.  The
> spectrogram/waterfall demo shows a spectrogram that updates in real time
> with data from the microphone on your computer.  It streams pretty quickly,
> so I think it will show you how fast it can be.

Chaco works by nicely separating the plotting from the data source.
You just need to properly update your Plot datasource and the ui will
be redrawn. Speed depends mostly on the way you process the data.
Chaco will most probably not be the limiting factor.

> Changing the axis to a log
> scale should be pretty straightforward.  I think logaxis is a builtin
> method, but it's also quite easy to use np.log to transform data before
> plotting it if need be.

See the log_plot.py example for using log axis:

    # Set the value axis to display on a log scale
    plot.value_scale = "log"

>> Second, from the zoomed-plot example, I can see that the x axis tick
>> labels don't adjust themselves nicely to show more accurate scales; namely,
>> in the bottom plot of that example, there are several x ticks labeled with
>> 0.03, which are not so useful for that scale. Instead, I expect to see
>> something like 0.039, 0.038, 0.037, etc.. So, my question is: Is it easy, or
>> straightforward, if you will, to adjust tick labels appropriately?
>
>
> Maybe someone else can give you a better answer, but one thing is that Chaco
> is built around Matplotlib, and I imagine working with xticks in Chaco is
> about the same, although in my experience, the axis usually behave rather
> intelligently for interactive plots.  I would say you ought to try it out.

Chaco is not built around matplotlib. The code base are totally different ;-)

Sorry Didrik, I don't mean to mislead people on the mailing list.  So, maybe you can clarify this for my understanding.  The actual plots that Chaco produces are matplotlib plots, no?  The terminology is that that matplotlib is the plotting "backend".  Is this true, or this also incorrect?
 

Regarding the axis, you can easily customize them with the
tick_label_formatter trait of the PlotAxis or by implementing your own
TickGenerator or customize the existing one.
See : http://docs.enthought.com/chaco/api/axis.html and the examples
for more details.

-- Didrik
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev


_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Chaco questions: Fast plotting of spectrograms with logarithmic axis and automatic formatting of tick labels

Robert Kern
On Tue, Oct 9, 2012 at 7:00 PM, Adam Hughes <[hidden email]> wrote:
>
>
> On Tue, Oct 9, 2012 at 1:35 PM, Didrik Pinte <[hidden email]> wrote:
>>
>> On 9 October 2012 17:18, Adam Hughes <[hidden email]> wrote:

>> > Maybe someone else can give you a better answer, but one thing is that
>> > Chaco
>> > is built around Matplotlib, and I imagine working with xticks in Chaco
>> > is
>> > about the same, although in my experience, the axis usually behave
>> > rather
>> > intelligently for interactive plots.  I would say you ought to try it
>> > out.
>>
>> Chaco is not built around matplotlib. The code base are totally different
>> ;-)
>
> Sorry Didrik, I don't mean to mislead people on the mailing list.  So, maybe
> you can clarify this for my understanding.  The actual plots that Chaco
> produces are matplotlib plots, no?  The terminology is that that matplotlib
> is the plotting "backend".  Is this true, or this also incorrect?

No, Chaco does its own plotting. matplotlib is not used at all.

--
Robert Kern
Enthought
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Chaco questions: Fast plotting of spectrograms with logarithmic axis and automatic formatting of tick labels

Jonathan March

On Tue, Oct 9, 2012 at 3:31 PM, Robert Kern <[hidden email]> wrote:
On Tue, Oct 9, 2012 at 7:00 PM, Adam Hughes <[hidden email]> wrote:
>
>
> On Tue, Oct 9, 2012 at 1:35 PM, Didrik Pinte <[hidden email]> wrote:
>>
>> On 9 October 2012 17:18, Adam Hughes <[hidden email]> wrote:

>> > Maybe someone else can give you a better answer, but one thing is that
>> > Chaco
>> > is built around Matplotlib, and I imagine working with xticks in Chaco
>> > is
>> > about the same, although in my experience, the axis usually behave
>> > rather
>> > intelligently for interactive plots.  I would say you ought to try it
>> > out.
>>
>> Chaco is not built around matplotlib. The code base are totally different
>> ;-)
>
> Sorry Didrik, I don't mean to mislead people on the mailing list.  So, maybe
> you can clarify this for my understanding.  The actual plots that Chaco
> produces are matplotlib plots, no?  The terminology is that that matplotlib
> is the plotting "backend".  Is this true, or this also incorrect?

No, Chaco does its own plotting. matplotlib is not used at all.



The "backends" (for either Chaco or MPL) are, for example, QT or WX

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Chaco questions: Fast plotting of spectrograms with logarithmic axis and automatic formatting of tick labels

Adam Hughes
Ah, sorry guys!

On Tue, Oct 9, 2012 at 4:46 PM, Jonathan March <[hidden email]> wrote:

On Tue, Oct 9, 2012 at 3:31 PM, Robert Kern <[hidden email]> wrote:
On Tue, Oct 9, 2012 at 7:00 PM, Adam Hughes <[hidden email]> wrote:
>
>
> On Tue, Oct 9, 2012 at 1:35 PM, Didrik Pinte <[hidden email]> wrote:
>>
>> On 9 October 2012 17:18, Adam Hughes <[hidden email]> wrote:

>> > Maybe someone else can give you a better answer, but one thing is that
>> > Chaco
>> > is built around Matplotlib, and I imagine working with xticks in Chaco
>> > is
>> > about the same, although in my experience, the axis usually behave
>> > rather
>> > intelligently for interactive plots.  I would say you ought to try it
>> > out.
>>
>> Chaco is not built around matplotlib. The code base are totally different
>> ;-)
>
> Sorry Didrik, I don't mean to mislead people on the mailing list.  So, maybe
> you can clarify this for my understanding.  The actual plots that Chaco
> produces are matplotlib plots, no?  The terminology is that that matplotlib
> is the plotting "backend".  Is this true, or this also incorrect?

No, Chaco does its own plotting. matplotlib is not used at all.



The "backends" (for either Chaco or MPL) are, for example, QT or WX

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev



_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev