[Matplotlib-users] Equivalent of d3's step-after interpolation?

2014-10-30 Thread Skip Montanaro
I've been doing some work with d3 http://d3js.org/ recently. It's
certainly been an education... Out of the box, it supports several
different types of interpolation between two points
https://github.com/mbostock/d3/wiki/SVG-Shapes#line_interpolate, which
I've found quite useful. It allows me to focus on assembling my data, and
not worry about transforming it to achieve the desired visual effect. For
example, in trading markets, once a trade is seen at a certain price, X,
it's useful to think of that price holding until the next trade price seen
at Y. With d3's step-after interpolation, given two points, (t0, X) and
(t1, Y), instead of drawing a single line between the two points, it draws
a horizontal line between (t0, X) and (t1, X), then a vertical line between
(t1, X) and (t1, Y).

I've don't a bit of searching, but didn't find anything obviously like this
in matplotlib. Does it support such a feature?

Thx,

Skip
--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Equivalent of d3's step-after interpolation?

2014-10-30 Thread Benjamin Root
Kinda sounds a bit like a barchart with the 'step' option, I think?

On Thu, Oct 30, 2014 at 12:16 PM, Skip Montanaro s...@pobox.com wrote:

 I've been doing some work with d3 http://d3js.org/ recently. It's
 certainly been an education... Out of the box, it supports several
 different types of interpolation between two points
 https://github.com/mbostock/d3/wiki/SVG-Shapes#line_interpolate, which
 I've found quite useful. It allows me to focus on assembling my data, and
 not worry about transforming it to achieve the desired visual effect. For
 example, in trading markets, once a trade is seen at a certain price, X,
 it's useful to think of that price holding until the next trade price seen
 at Y. With d3's step-after interpolation, given two points, (t0, X) and
 (t1, Y), instead of drawing a single line between the two points, it draws
 a horizontal line between (t0, X) and (t1, X), then a vertical line between
 (t1, X) and (t1, Y).

 I've don't a bit of searching, but didn't find anything obviously like
 this in matplotlib. Does it support such a feature?

 Thx,

 Skip




 --

 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Equivalent of d3's step-after interpolation?

2014-10-30 Thread Sterling Smith
http://stackoverflow.com/questions/8921296/how-do-i-plot-a-step-function-with-matplotlib-in-python

On Oct 30, 2014, at 11:29AM, Benjamin Root wrote:

 Kinda sounds a bit like a barchart with the 'step' option, I think?
 
 On Thu, Oct 30, 2014 at 12:16 PM, Skip Montanaro s...@pobox.com wrote:
 I've been doing some work with d3 recently. It's certainly been an 
 education... Out of the box, it supports several different types of 
 interpolation between two points, which I've found quite useful. It allows me 
 to focus on assembling my data, and not worry about transforming it to 
 achieve the desired visual effect. For example, in trading markets, once a 
 trade is seen at a certain price, X, it's useful to think of that price 
 holding until the next trade price seen at Y. With d3's step-after 
 interpolation, given two points, (t0, X) and (t1, Y), instead of drawing a 
 single line between the two points, it draws a horizontal line between (t0, 
 X) and (t1, X), then a vertical line between (t1, X) and (t1, Y).
 
 I've don't a bit of searching, but didn't find anything obviously like this 
 in matplotlib. Does it support such a feature?
 
 Thx,
 
 Skip
 
 
 
 --
 
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 
 --
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Equivalent of d3's step-after interpolation?

2014-10-30 Thread Skip Montanaro
Benjamin Kinda sounds a bit like a barchart with the 'step' option, I think?

Almost, but not quite. I think of barcharts as displaying truly
discrete data, often with the dependent variable being a count of some
sort and the independent variable being a bucket. In my example, while
prices X and Y are constrained to be discrete by the nature of the
market (US stocks trade in one cent increments, for example), they are
connected in time, and there is no fixed bucket size (time
increment).

Sterling 
http://stackoverflow.com/questions/8921296/how-do-i-plot-a-step-function-with-matplotlib-in-python

Thanks, that's exactly what I needed. I wasn't using the correct terms
when searching Google. I was thinking interpolation, not step
function.

Skip

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Equivalent of d3's step-after interpolation?

2014-10-30 Thread Pierre Haessig
You might also be interested in 
http://stackoverflow.com/questions/15188005/linestyle-in-matplotlib-step-function
which details the `drawstyle` parameters. It can be set to 'steps-post' 
for example.

The only case I was not able to cover with this parameter are the 
fill_between plots, because they do not use Line objects...

-- 
Pierre

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Equivalent of d3's step-after interpolation?

2014-10-30 Thread Thomas Caswell
https://stackoverflow.com/questions/12841847/step-function-in-matplotlib/12846384#12846384
is a much better example of how to control the step function.

On Thu, Oct 30, 2014 at 1:01 PM, Pierre Haessig
pierre.haes...@crans.org wrote:
 You might also be interested in
 http://stackoverflow.com/questions/15188005/linestyle-in-matplotlib-step-function
 which details the `drawstyle` parameters. It can be set to 'steps-post'
 for example.

 The only case I was not able to cover with this parameter are the
 fill_between plots, because they do not use Line objects...

 --
 Pierre

 --
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users



-- 
Thomas Caswell
tcasw...@gmail.com

--
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users